To: vim_dev@googlegroups.com Subject: Patch 8.2.4501 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4501 Problem: With 'showbreak' set and after the end of the line the cursor may be displayed in the wrong position. Solution: Do not apply 'showbreak' after the end of the line. (closes #9884) Files: src/charset.c, src/testdir/test_breakindent.vim, src/testdir/dumps/Test_cursor_position_with_showbreak.dump *** ../vim-8.2.4500/src/charset.c 2022-02-19 11:19:29.821776577 +0000 --- src/charset.c 2022-03-03 19:51:55.370125798 +0000 *************** *** 1037,1045 **** * May have to add something for 'breakindent' and/or 'showbreak' * string at start of line. * Set *headp to the size of what we add. */ added = 0; ! sbr = get_showbreak_value(wp); if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0) { colnr_T sbrlen = 0; --- 1037,1046 ---- * May have to add something for 'breakindent' and/or 'showbreak' * string at start of line. * Set *headp to the size of what we add. + * Do not use 'showbreak' at the NUL after the text. */ added = 0; ! sbr = c == NUL ? empty_option : get_showbreak_value(wp); if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0) { colnr_T sbrlen = 0; *** ../vim-8.2.4500/src/testdir/test_breakindent.vim 2022-01-15 18:31:37.720587407 +0000 --- src/testdir/test_breakindent.vim 2022-03-03 19:48:43.346448245 +0000 *************** *** 8,13 **** --- 8,14 ---- CheckOption breakindent source view_util.vim + source screendump.vim let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" *************** *** 849,854 **** --- 850,876 ---- %bw! endfunc + func Test_cursor_position_with_showbreak() + CheckScreendump + + let lines =<< trim END + vim9script + &signcolumn = 'yes' + &showbreak = '+ ' + var leftcol: number = win_getid()->getwininfo()->get(0, {})->get('textoff') + repeat('x', &columns - leftcol - 1)->setline(1) + 'second line'->setline(2) + END + call writefile(lines, 'XscriptShowbreak') + let buf = RunVimInTerminal('-S XscriptShowbreak', #{rows: 6}) + + call term_sendkeys(buf, "AX") + call VerifyScreenDump(buf, 'Test_cursor_position_with_showbreak', {}) + + call StopVimInTerminal(buf) + call delete('XscriptShowbreak') + endfunc + func Test_no_spurious_match() let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50)) call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls') *** ../vim-8.2.4500/src/testdir/dumps/Test_cursor_position_with_showbreak.dump 2022-03-03 20:03:33.941102958 +0000 --- src/testdir/dumps/Test_cursor_position_with_showbreak.dump 2022-03-03 19:49:09.326402857 +0000 *************** *** 0 **** --- 1,6 ---- + | +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@71|X + > +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0|e|c|o|n|d| |l|i|n|e| @61 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|1|,|7|4| @9|A|l@1| *** ../vim-8.2.4500/src/version.c 2022-03-03 17:05:17.527121052 +0000 --- src/version.c 2022-03-03 19:42:06.539242407 +0000 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 4501, /**/ -- hundred-and-one symptoms of being an internet addict: 153. You find yourself staring at your "inbox" waiting for new e-mail to arrive. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///