diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-12 20:49:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-12 20:49:15 +0100 |
commit | cbee635eee3007db97646ddb9f211a1d4966eb2a (patch) | |
tree | 93384534e8cc5e6bcaa416213cf2fd2fd7ce8ea6 /src/testdir | |
parent | cc184cfb09161b3bbc7d5d8859a18e812367d19c (diff) | |
download | vim-git-cbee635eee3007db97646ddb9f211a1d4966eb2a.tar.gz |
patch 8.1.2294: cursor pos wrong with concealing and search causes a scrollv8.1.2294
Problem: Cursor position wrong when characters are concealed and asearch
causes a scroll.
Solution: Fix the cursor column in a concealed line after window scroll.
(closes #5215, closes #5012)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_matchadd_conceal.vim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/testdir/test_matchadd_conceal.vim b/src/testdir/test_matchadd_conceal.vim index 6684378f6..83eadce5a 100644 --- a/src/testdir/test_matchadd_conceal.vim +++ b/src/testdir/test_matchadd_conceal.vim @@ -8,6 +8,8 @@ if !has('gui_running') && has('unix') endif source shared.vim +source term_util.vim +source view_util.vim func Test_simple_matchadd() new @@ -277,3 +279,40 @@ func Test_matchadd_and_syn_conceal() call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) call assert_equal(screenattr(1, 11) , screenattr(1, 32)) endfunc + +func Test_cursor_column_in_concealed_line_after_window_scroll() + CheckRunVimInTerminal + + " Test for issue #5012 fix. + " For a concealed line with cursor, there should be no window's cursor + " position invalidation during win_update() after scrolling attempt that is + " not successful and no real topline change happens. The invalidation would + " cause a window's cursor position recalc outside of win_line() where it's + " not possible to take conceal into account. + let lines =<< trim END + 3split + let m = matchadd('Conceal', '=') + setl conceallevel=2 concealcursor=nc + normal gg + "==expr== + END + call writefile(lines, 'Xcolesearch') + let buf = RunVimInTerminal('Xcolesearch', {}) + + " Jump to something that is beyond the bottom of the window, + " so there's a scroll down. + call term_sendkeys(buf, ":so %\<CR>") + call term_sendkeys(buf, "/expr\<CR>") + call term_wait(buf) + + " Are the concealed parts of the current line really hidden? + let cursor_row = term_scrape(buf, '.')->map({_, e -> e.chars})->join('') + call assert_equal('"expr', cursor_row) + + " BugFix check: Is the window's cursor column properly updated for hidden + " parts of the current line? + call assert_equal(2, term_getcursor(buf)[1]) + + call StopVimInTerminal(buf) + call delete('Xcolesearch') +endfunc |