To: vim_dev@googlegroups.com Subject: Patch 8.2.2903 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2903 Problem: Cursor position wrong on wrapped line with 'signcolumn'. Solution: Don't add space for showbreak twice. (Christian Brabandt, closes #8262) Files: src/drawline.c, src/testdir/test_display.vim *** ../vim-8.2.2902/src/drawline.c 2021-04-21 15:11:18.153623383 +0200 --- src/drawline.c 2021-05-29 17:49:38.074183381 +0200 *************** *** 1981,1986 **** --- 1981,1992 ---- // TODO: is passing p for start of the line OK? n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; + + // We have just drawn the showbreak value, no need to add + // space for it again + if (vcol == vcol_sbr) + n_extra -= MB_CHARLEN(get_showbreak_value(wp)); + if (c == TAB && n_extra + col > wp->w_width) # ifdef FEAT_VARTABS n_extra = tabstop_padding(vcol, wp->w_buffer->b_p_ts, *** ../vim-8.2.2902/src/testdir/test_display.vim 2021-03-22 17:30:44.113578603 +0100 --- src/testdir/test_display.vim 2021-05-29 17:49:01.786279222 +0200 *************** *** 334,337 **** --- 334,354 ---- set fillchars& fdc& foldmethod& foldenable& endfunc + func Test_display_linebreak_breakat() + new + vert resize 25 + let _breakat = &breakat + setl signcolumn=yes linebreak breakat=) showbreak=+\ + call setline(1, repeat('x', winwidth(0) - 2) .. ')abc') + let lines = ScreenLines([1, 2], 25) + let expected = [ + \ ' xxxxxxxxxxxxxxxxxxxxxxx', + \ ' + )abc ' + \ ] + call assert_equal(expected, lines) + %bw! + let &breakat=_breakat + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.2902/src/version.c 2021-05-29 17:29:29.697467482 +0200 --- src/version.c 2021-05-29 17:51:19.005917578 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2903, /**/ -- Two cows are standing together in a field. One asks the other: "So what do you think about this Mad Cow Disease?" The other replies: "That doesn't concern me. I'm a helicopter." /// 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 ///