diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-01-13 12:10:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-13 12:10:26 +0100 |
commit | a7fc01a532e753e2f5a7d0f2b8f670144d78a878 (patch) | |
tree | 36060b7fdfb919a7f36faf0dad9790a95088c0e7 /test/functional/ui/syntax_conceal_spec.lua | |
parent | 424388c207eaf6b5f564ff8247b5800ab337bc56 (diff) | |
parent | 23c71d5182a5e717c3a1852d9d3c90e81b4735fd (diff) | |
download | rneovim-a7fc01a532e753e2f5a7d0f2b8f670144d78a878.tar.gz rneovim-a7fc01a532e753e2f5a7d0f2b8f670144d78a878.tar.bz2 rneovim-a7fc01a532e753e2f5a7d0f2b8f670144d78a878.zip |
Merge pull request #9492 from bfredl/cul_cole
redraw: share more code between cursorline and conceal redraws. Add tests for conceal cursor
Diffstat (limited to 'test/functional/ui/syntax_conceal_spec.lua')
-rw-r--r-- | test/functional/ui/syntax_conceal_spec.lua | 496 |
1 files changed, 495 insertions, 1 deletions
diff --git a/test/functional/ui/syntax_conceal_spec.lua b/test/functional/ui/syntax_conceal_spec.lua index e7a7004c1e..d678784dc9 100644 --- a/test/functional/ui/syntax_conceal_spec.lua +++ b/test/functional/ui/syntax_conceal_spec.lua @@ -12,7 +12,11 @@ describe('Screen', function() screen:attach() screen:set_default_attr_ids( { [0] = {bold=true, foreground=Screen.colors.Blue}, - [1] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray} + [1] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray}, + [2] = {bold = true, reverse = true}, + [3] = {reverse = true}, + [4] = {bold = true}, + [5] = {background = Screen.colors.Yellow}, } ) end) @@ -329,4 +333,494 @@ describe('Screen', function() ]]) end) end) -- conceallevel + + + describe("cursor movement", function() + before_each(function() + command("syn keyword concealy barf conceal cchar=b") + command("set cole=2") + feed('5Ofoo barf bar barf eggs<esc>') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo barf bar barf egg^s | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + end) + + it('between windows', function() + command("split") + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo barf bar barf egg^s | + | + {2:[No Name] [+] }| + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {3:[No Name] [+] }| + | + ]]) + feed('<c-w>w') + + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {3:[No Name] [+] }| + foo {1:b} bar {1:b} eggs | + foo barf bar barf egg^s | + | + {2:[No Name] [+] }| + | + ]]) + end) + + it('in insert mode', function() + feed('i') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo barf bar barf egg^s | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + + feed('<up>') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo barf bar barf egg^s | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + end) + + it('between modes cocu=iv', function() + command('set cocu=iv') + feed('gg') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + feed('i') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + feed('v') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- VISUAL --} | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + end) + + it('between modes cocu=n', function() + command('set cocu=n') + feed('gg') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + feed('i') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + + feed('v') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + {4:-- VISUAL --} | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + + it('and open line', function() + feed('o') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + ^ | + | + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + end) + + it('and open line cocu=i', function() + command('set cocu=i') + feed('o') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + ^ | + | + {0:~ }| + {0:~ }| + {4:-- INSERT --} | + ]]) + end) + + describe('with incsearch', function() + before_each(function() + command('set incsearch hlsearch') + feed('2GA x<esc>3GA xy<esc>gg') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + + it('cocu=', function() + feed('/') + screen:expect([[ + foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + + feed('x') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo barf bar barf eggs {3:x} | + foo {1:b} bar {1:b} eggs {5:x}y | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /x^ | + ]]) + + feed('y') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo barf bar barf eggs {3:xy} | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /xy^ | + ]]) + + feed('<c-w>') + screen:expect([[ + foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + end) + + it('cocu=c', function() + command('set cocu=c') + + feed('/') + -- NB: we don't do this redraw. Probably best to still skip it, + -- to avoid annoying distraction from the cmdline + screen:expect([[ + foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + + feed('x') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs {3:x} | + foo {1:b} bar {1:b} eggs {5:x}y | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /x^ | + ]]) + + feed('y') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs {3:xy} | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /xy^ | + ]]) + + feed('<c-w>') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + + it('cocu=n', function() + command('set cocu=n') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + + feed('/') + -- NB: we don't do this redraw. Probably best to still skip it, + -- to avoid annoying distraction from the cmdline + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + + feed('x') + screen:expect([[ + foo {1:b} bar {1:b} eggs | + foo barf bar barf eggs {3:x} | + foo {1:b} bar {1:b} eggs {5:x}y | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /x^ | + ]]) + + feed('<c-w>') + screen:expect([[ + foo barf bar barf eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + /^ | + ]]) + + feed('<esc>') + screen:expect([[ + ^foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs x | + foo {1:b} bar {1:b} eggs xy | + foo {1:b} bar {1:b} eggs | + foo {1:b} bar {1:b} eggs | + | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + end) + end) end) |