diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 3e33e7ace4..465923fce5 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1453,6 +1453,24 @@ describe('CursorColumn highlight', function() ]]) end) + -- oldtest: Test_cursorcolumn_virtualedit() + it('is correct with operator on empty line and virtualedit', function() + exec([[ + set virtualedit=all + set cursorcolumn + call setline(1, ['', '', '']) + call cursor(3, 1) + ]]) + screen:expect([[ + {21: } |*2 + ^ | + {1:~ }|*4 + | + ]]) + feed('') + screen:expect_unchanged() + end) + -- oldtest: Test_cursorcolumn_callback() it('is updated if cursor is moved from timer', function() exec([[ diff --git a/test/old/testdir/test_highlight.vim b/test/old/testdir/test_highlight.vim index b236ee5b9a..023b387eb9 100644 --- a/test/old/testdir/test_highlight.vim +++ b/test/old/testdir/test_highlight.vim @@ -658,7 +658,7 @@ func Test_cursorcolumn_insert_on_tab() set cursorcolumn call cursor(2, 2) END - call writefile(lines, 'Xcuc_insert_on_tab') + call writefile(lines, 'Xcuc_insert_on_tab', 'D') let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8}) call TermWait(buf) @@ -677,7 +677,30 @@ func Test_cursorcolumn_insert_on_tab() call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {}) call StopVimInTerminal(buf) - call delete('Xcuc_insert_on_tab') +endfunc + +" The column highlighted with 'cursorcolumn' must be the column of the cursor, +" also after a command that moved the cursor into virtual space and back. +func Test_cursorcolumn_virtualedit() + CheckScreendump + + let lines =<< trim END + set virtualedit=all + set cursorcolumn + call setline(1, ['', '', '']) + call cursor(3, 1) + END + call writefile(lines, 'Xcuc_virtualedit', 'D') + + let buf = RunVimInTerminal('-S Xcuc_virtualedit', #{rows: 8}) + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_cursorcolumn_virtualedit_1', {}) + + call term_sendkeys(buf, "\") + call TermWait(buf) + call VerifyScreenDump(buf, 'Test_cursorcolumn_virtualedit_1', {}) + + call StopVimInTerminal(buf) endfunc func Test_cursorcolumn_callback()