Mercurial > vim
changeset 24729:03492b62d79a v8.2.2903
patch 8.2.2903: cursor position wrong on wrapped line with 'signcolumn'
Commit: https://github.com/vim/vim/commit/a06e345af5b8261c072c95b0446e67cfda439848
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 29 17:56:37 2021 +0200
patch 8.2.2903: cursor position wrong on wrapped line with 'signcolumn'
Problem: Cursor position wrong on wrapped line with 'signcolumn'.
Solution: Don't add space for showbreak twice. (Christian Brabandt,
closes #8262)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 May 2021 18:00:03 +0200 |
parents | 8cd32b8e1b3c |
children | 0cc7f1a2af5c |
files | src/drawline.c src/testdir/test_display.vim src/version.c |
diffstat | 3 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/drawline.c +++ b/src/drawline.c @@ -1981,6 +1981,12 @@ win_line( // 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,
--- a/src/testdir/test_display.vim +++ b/src/testdir/test_display.vim @@ -334,4 +334,21 @@ func Test_fold_fillchars() 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