diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/plines.c | 4 | ||||
| -rw-r--r-- | src/nvim/testdir/test_breakindent.vim | 22 | 
2 files changed, 24 insertions, 2 deletions
| diff --git a/src/nvim/plines.c b/src/nvim/plines.c index 42218ac847..bed15f9e36 100644 --- a/src/nvim/plines.c +++ b/src/nvim/plines.c @@ -444,9 +444,9 @@ int win_lbr_chartabsize(chartabsize_T *cts, int *headp)    // 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; - -  char *const sbr = (char *)get_showbreak_value(wp); +  char *const sbr = c == NUL ? empty_option : (char *)get_showbreak_value(wp);    if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && vcol != 0) {      colnr_T sbrlen = 0;      int numberwidth = win_col_off(wp); diff --git a/src/nvim/testdir/test_breakindent.vim b/src/nvim/testdir/test_breakindent.vim index 8bbac2d237..934dca4793 100644 --- a/src/nvim/testdir/test_breakindent.vim +++ b/src/nvim/testdir/test_breakindent.vim @@ -8,6 +8,7 @@ source check.vim  CheckOption breakindent  source view_util.vim +source screendump.vim  let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" @@ -889,6 +890,27 @@ func Test_window_resize_with_linebreak()    %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') | 
