diff src/testdir/test_filter_cmd.vim @ 18454:b912277e3877 v8.1.2221

patch 8.1.2221: cannot filter :disp output Commit: https://github.com/vim/vim/commit/8fc42964363087025a27e8c80276c706536fc4e3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 26 17:33:13 2019 +0200 patch 8.1.2221: cannot filter :disp output Problem: Cannot filter :disp output. Solution: Support filtereing :disp output. (Andi Massimino, closes https://github.com/vim/vim/issues/5117)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Oct 2019 17:45:03 +0200
parents 9c206a78ec04
children 068337e86133
line wrap: on
line diff
--- a/src/testdir/test_filter_cmd.vim
+++ b/src/testdir/test_filter_cmd.vim
@@ -145,3 +145,30 @@ func Test_filter_commands()
   bwipe! file.h
   bwipe! file.hs
 endfunc
+
+func Test_filter_display()
+  edit Xdoesnotmatch
+  let @a = '!!willmatch'
+  let @b = '!!doesnotmatch'
+  let @c = "oneline\ntwoline\nwillmatch\n"
+  let @/ = '!!doesnotmatch'
+  call feedkeys(":echo '!!doesnotmatch:'\<CR>", 'ntx')
+  let lines = map(split(execute('filter /willmatch/ display'), "\n"), 'v:val[5:6]')
+
+  call assert_true(index(lines, '"a') >= 0)
+  call assert_false(index(lines, '"b') >= 0)
+  call assert_true(index(lines, '"c') >= 0)
+  call assert_false(index(lines, '"/') >= 0)
+  call assert_false(index(lines, '":') >= 0)
+  call assert_false(index(lines, '"%') >= 0)
+
+  let lines = map(split(execute('filter /doesnotmatch/ display'), "\n"), 'v:val[5:6]')
+  call assert_true(index(lines, '"a') < 0)
+  call assert_false(index(lines, '"b') < 0)
+  call assert_true(index(lines, '"c') < 0)
+  call assert_false(index(lines, '"/') < 0)
+  call assert_false(index(lines, '":') < 0)
+  call assert_false(index(lines, '"%') < 0)
+
+  bwipe!
+endfunc