To: vim_dev@googlegroups.com Subject: Patch 8.1.2303 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2303 Problem: Cursor in wrong position after horizontal scroll. Solution: Set w_valid_leftcol. (closes #5214, closes #5224) Files: src/move.c, src/testdir/test_matchadd_conceal.vim *** ../vim-8.1.2302/src/move.c 2019-11-10 01:32:06.013009118 +0100 --- src/move.c 2019-11-16 14:13:27.133046484 +0100 *************** *** 1175,1180 **** --- 1175,1183 ---- redraw_later(SOME_VALID); #endif + // now w_leftcol is valid, avoid check_cursor_moved() thinking otherwise + curwin->w_valid_leftcol = curwin->w_leftcol; + curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL; } *** ../vim-8.1.2302/src/testdir/test_matchadd_conceal.vim 2019-11-12 20:49:12.173234318 +0100 --- src/testdir/test_matchadd_conceal.vim 2019-11-16 14:10:08.389592819 +0100 *************** *** 316,318 **** --- 316,346 ---- call StopVimInTerminal(buf) call delete('Xcolesearch') endfunc + + func Test_cursor_column_in_concealed_line_after_leftcol_change() + CheckRunVimInTerminal + + " Test for issue #5214 fix. + let lines =<< trim END + 0put = 'ab' .. repeat('-', &columns) .. 'c' + call matchadd('Conceal', '-') + set nowrap ss=0 cole=3 cocu=n + END + call writefile(lines, 'Xcurs-columns') + let buf = RunVimInTerminal('-S Xcurs-columns', {}) + + " Go to the end of the line (3 columns beyond the end of the screen). + " Horizontal scroll would center the cursor in the screen line, but conceal + " makes it go to screen column 1. + call term_sendkeys(buf, "$") + call term_wait(buf) + + " Are the concealed parts of the current line really hidden? + call assert_equal('c', term_getline(buf, '.')) + + " BugFix check: Is the window's cursor column properly updated for conceal? + call assert_equal(1, term_getcursor(buf)[1]) + + call StopVimInTerminal(buf) + call delete('Xcurs-columns') + endfunc *** ../vim-8.1.2302/src/version.c 2019-11-16 13:50:18.781646730 +0100 --- src/version.c 2019-11-16 14:16:15.708477436 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2303, /**/ -- In order for something to become clean, something else must become dirty; but you can get everything dirty without getting anything clean. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///