aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/drawline.c5
-rw-r--r--src/nvim/testdir/test_listlbr.vim24
2 files changed, 25 insertions, 4 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 8f7928e1c9..e9ff299d68 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -1691,12 +1691,9 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
} else if (foldinfo.fi_lines > 0) {
// skip writing the buffer line itself
c = NUL;
- XFREE_CLEAR(p_extra_free);
} else {
int c0;
- XFREE_CLEAR(p_extra_free);
-
// Get a character from the line itself.
c0 = c = (uint8_t)(*ptr);
mb_c = c;
@@ -2170,7 +2167,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
c = (n_extra == 0 && wp->w_p_lcs_chars.tab3)
? wp->w_p_lcs_chars.tab3
: wp->w_p_lcs_chars.tab1;
- if (wp->w_p_lbr && p_extra != NULL) {
+ if (wp->w_p_lbr && p_extra != NULL && *p_extra != NUL) {
c_extra = NUL; // using p_extra from above
} else {
c_extra = wp->w_p_lcs_chars.tab2;
diff --git a/src/nvim/testdir/test_listlbr.vim b/src/nvim/testdir/test_listlbr.vim
index 1cbdba5d76..a746779e73 100644
--- a/src/nvim/testdir/test_listlbr.vim
+++ b/src/nvim/testdir/test_listlbr.vim
@@ -73,6 +73,30 @@ func Test_linebreak_with_nolist()
call s:close_windows()
endfunc
+func Test_linebreak_with_list_and_number()
+ call s:test_windows('setl list listchars+=tab:>-')
+ call setline(1, ["abcdefg\thijklmnopqrstu", "v"])
+ let lines = s:screen_lines([1, 4], winwidth(0))
+ let expect_nonumber = [
+\ "abcdefg>------------",
+\ "hijklmnopqrstu$ ",
+\ "v$ ",
+\ "~ ",
+\ ]
+ call s:compare_lines(expect_nonumber, lines)
+
+ setl number
+ let lines = s:screen_lines([1, 4], winwidth(0))
+ let expect_number = [
+\ " 1 abcdefg>--------",
+\ " hijklmnopqrstu$ ",
+\ " 2 v$ ",
+\ "~ ",
+\ ]
+ call s:compare_lines(expect_number, lines)
+ call s:close_windows()
+endfunc
+
func Test_should_break()
call s:test_windows('setl sbr=+ nolist')
call setline(1, "1\t" . repeat('a', winwidth(0)-2))