aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-03-28 05:10:15 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-03-28 06:15:26 +0800
commitab02b28b4e14ecd22facab9377ea71aff2ffdfdb (patch)
tree8c8c262404a9888c3acebd48272d0f31840a07a6
parent4baeb96c1bb66c845b4bc58482df4e601485eec3 (diff)
downloadrneovim-ab02b28b4e14ecd22facab9377ea71aff2ffdfdb.tar.gz
rneovim-ab02b28b4e14ecd22facab9377ea71aff2ffdfdb.tar.bz2
rneovim-ab02b28b4e14ecd22facab9377ea71aff2ffdfdb.zip
vim-patch:8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Problem: 'cursorline' not always updated with 'cursorlineopt' is "screenline". Solution: Call check_redraw_cursorline() more often. (closes vim/vim#10013) https://github.com/vim/vim/commit/bf269ed0b0bd8414eea7bea17465b2738a9a2b55 Code was reverted in patch 8.2.4638, so this just ports the test.
-rw-r--r--src/nvim/testdir/test_cursorline.vim21
-rw-r--r--test/functional/ui/highlight_spec.lua59
2 files changed, 70 insertions, 10 deletions
diff --git a/src/nvim/testdir/test_cursorline.vim b/src/nvim/testdir/test_cursorline.vim
index bf049ec779..7e97df6027 100644
--- a/src/nvim/testdir/test_cursorline.vim
+++ b/src/nvim/testdir/test_cursorline.vim
@@ -293,5 +293,26 @@ func Test_cursorline_callback()
call delete('Xcul_timer')
endfunc
+func Test_cursorline_screenline_update()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, repeat('xyz ', 30))
+ set cursorline cursorlineopt=screenline
+ inoremap <F2> <Cmd>call cursor(1, 1)<CR>
+ END
+ call writefile(lines, 'Xcul_screenline')
+
+ let buf = RunVimInTerminal('-S Xcul_screenline', #{rows: 8})
+ call term_sendkeys(buf, "A")
+ call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {})
+ call term_sendkeys(buf, "\<F2>")
+ call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {})
+ call term_sendkeys(buf, "\<Esc>")
+
+ call StopVimInTerminal(buf)
+ call delete('Xcul_screenline')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 2053901857..bf52d9f9b4 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -937,17 +937,18 @@ describe('CursorLine and CursorLineNr highlights', function()
[2] = {foreground = Screen.colors.Yellow};
[3] = {foreground = Screen.colors.Red, background = Screen.colors.Green};
[4] = {foreground = Screen.colors.Green, background = Screen.colors.Red};
+ [5] = {bold = true}, -- ModeMsg
})
screen:attach()
- feed_command('set wrap cursorline cursorlineopt=screenline')
- feed_command('set showbreak=>>>')
- feed_command('highlight clear NonText')
- feed_command('highlight clear CursorLine')
- feed_command('highlight NonText guifg=Yellow gui=NONE')
- feed_command('highlight LineNr guifg=Red guibg=Green gui=NONE')
- feed_command('highlight CursorLine guifg=Black guibg=White gui=NONE')
- feed_command('highlight CursorLineNr guifg=Green guibg=Red gui=NONE')
+ command('set wrap cursorline cursorlineopt=screenline')
+ command('set showbreak=>>>')
+ command('highlight clear NonText')
+ command('highlight clear CursorLine')
+ command('highlight NonText guifg=Yellow gui=NONE')
+ command('highlight LineNr guifg=Red guibg=Green gui=NONE')
+ command('highlight CursorLine guifg=Black guibg=White gui=NONE')
+ command('highlight CursorLineNr guifg=Green guibg=Red gui=NONE')
feed('30iø<esc>o<esc>30ia<esc>')
@@ -977,7 +978,7 @@ describe('CursorLine and CursorLineNr highlights', function()
]])
-- CursorLineNr should not apply to line number when 'cursorlineopt' does not contain "number"
- feed_command('set relativenumber numberwidth=2')
+ command('set relativenumber numberwidth=2')
screen:expect([[
{3:0 }{1:øøøøøøøøøøøø^øøøøøø}|
{3: }{2:>>>}øøøøøøøøøøøø |
@@ -987,7 +988,7 @@ describe('CursorLine and CursorLineNr highlights', function()
]])
-- CursorLineNr should apply to line number when 'cursorlineopt' contains "number"
- feed_command('set cursorlineopt+=number')
+ command('set cursorlineopt+=number')
screen:expect([[
{4:0 }{1:øøøøøøøøøøøø^øøøøøø}|
{3: }{2:>>>}øøøøøøøøøøøø |
@@ -1019,6 +1020,44 @@ describe('CursorLine and CursorLineNr highlights', function()
{3: }{2:>>>}{1:aaaaaaaaa^aaa }|
|
]])
+
+ -- updated in Insert mode
+ feed('I')
+ screen:expect([[
+ {3:1 }øøøøøøøøøøøøøøøøøø|
+ {3: }{2:>>>}øøøøøøøøøøøø |
+ {4:0 }{1:^aaaaaaaaaaaaaaaaaa}|
+ {3: }{2:>>>}aaaaaaaaaaaa |
+ {5:-- INSERT --} |
+ ]])
+
+ feed('<Esc>gg')
+ screen:expect([[
+ {4:0 }{1:^øøøøøøøøøøøøøøøøøø}|
+ {3: }{2:>>>}øøøøøøøøøøøø |
+ {3:1 }aaaaaaaaaaaaaaaaaa|
+ {3: }{2:>>>}aaaaaaaaaaaa |
+ |
+ ]])
+
+ command('inoremap <F2> <Cmd>call cursor(1, 1)<CR>')
+ feed('A')
+ screen:expect([[
+ {4:0 }øøøøøøøøøøøøøøøøøø|
+ {3: }{2:>>>}{1:øøøøøøøøøøøø^ }|
+ {3:1 }aaaaaaaaaaaaaaaaaa|
+ {3: }{2:>>>}aaaaaaaaaaaa |
+ {5:-- INSERT --} |
+ ]])
+
+ feed('<F2>')
+ screen:expect([[
+ {4:0 }{1:^øøøøøøøøøøøøøøøøøø}|
+ {3: }{2:>>>}øøøøøøøøøøøø |
+ {3:1 }aaaaaaaaaaaaaaaaaa|
+ {3: }{2:>>>}aaaaaaaaaaaa |
+ {5:-- INSERT --} |
+ ]])
end)
it('always updated. vim-patch:8.1.0849', function()