comparison src/testdir/test_matchadd_conceal.vim @ 18601:e4b03b369c41 v8.1.2294

patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll Commit: https://github.com/vim/vim/commit/cbee635eee3007db97646ddb9f211a1d4966eb2a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 12 20:49:15 2019 +0100 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll 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)
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Nov 2019 21:00:03 +0100
parents 8e9e9124c7a2
children a9bfdc5ea1ec
comparison
equal deleted inserted replaced
18600:f3a97183ab01 18601:e4b03b369c41
6 if !has('gui_running') && has('unix') 6 if !has('gui_running') && has('unix')
7 set term=ansi 7 set term=ansi
8 endif 8 endif
9 9
10 source shared.vim 10 source shared.vim
11 source term_util.vim
12 source view_util.vim
11 13
12 func Test_simple_matchadd() 14 func Test_simple_matchadd()
13 new 15 new
14 16
15 1put='# This is a Test' 17 1put='# This is a Test'
275 call assert_equal(expect, Screenline(1)) 277 call assert_equal(expect, Screenline(1))
276 call assert_notequal(screenattr(1, 10) , screenattr(1, 11)) 278 call assert_notequal(screenattr(1, 10) , screenattr(1, 11))
277 call assert_notequal(screenattr(1, 11) , screenattr(1, 12)) 279 call assert_notequal(screenattr(1, 11) , screenattr(1, 12))
278 call assert_equal(screenattr(1, 11) , screenattr(1, 32)) 280 call assert_equal(screenattr(1, 11) , screenattr(1, 32))
279 endfunc 281 endfunc
282
283 func Test_cursor_column_in_concealed_line_after_window_scroll()
284 CheckRunVimInTerminal
285
286 " Test for issue #5012 fix.
287 " For a concealed line with cursor, there should be no window's cursor
288 " position invalidation during win_update() after scrolling attempt that is
289 " not successful and no real topline change happens. The invalidation would
290 " cause a window's cursor position recalc outside of win_line() where it's
291 " not possible to take conceal into account.
292 let lines =<< trim END
293 3split
294 let m = matchadd('Conceal', '=')
295 setl conceallevel=2 concealcursor=nc
296 normal gg
297 "==expr==
298 END
299 call writefile(lines, 'Xcolesearch')
300 let buf = RunVimInTerminal('Xcolesearch', {})
301
302 " Jump to something that is beyond the bottom of the window,
303 " so there's a scroll down.
304 call term_sendkeys(buf, ":so %\<CR>")
305 call term_sendkeys(buf, "/expr\<CR>")
306 call term_wait(buf)
307
308 " Are the concealed parts of the current line really hidden?
309 let cursor_row = term_scrape(buf, '.')->map({_, e -> e.chars})->join('')
310 call assert_equal('"expr', cursor_row)
311
312 " BugFix check: Is the window's cursor column properly updated for hidden
313 " parts of the current line?
314 call assert_equal(2, term_getcursor(buf)[1])
315
316 call StopVimInTerminal(buf)
317 call delete('Xcolesearch')
318 endfunc