]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2151: 'breakindent' is not drawn after diff filler lines v9.0.2151
authorzeertzjq <zeertzjq@outlook.com>
Tue, 5 Dec 2023 14:47:09 +0000 (15:47 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 5 Dec 2023 14:49:47 +0000 (15:49 +0100)
Problem:  'breakindent' is not drawn after diff filler lines.
Solution: Correct check for whether 'breakindent' should be drawn.

closes: #13624

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/drawline.c
src/testdir/dumps/Test_diff_breakindent_after_filler.dump [new file with mode: 0644]
src/testdir/test_diffmode.vim
src/version.c

index 6909e0f1fdcaac6244d8a3ff759a3c967ab3f1ec..9f385f033a68f7b5ed5e704c0fd0dd149c5c5f57 100644 (file)
@@ -498,10 +498,11 @@ handle_breakindent(win_T *wp, winlinevars_T *wlv)
     {
        wlv->draw_state = WL_BRI;
        // if wlv->need_showbreak is set, breakindent also applies
-       if (wp->w_p_bri && (wlv->row != wlv->startrow || wlv->need_showbreak)
+       if (wp->w_p_bri && (wlv->row > wlv->startrow
 # ifdef FEAT_DIFF
-               && wlv->filler_lines == 0
+                   + wlv->filler_lines
 # endif
+                   || wlv->need_showbreak)
 # ifdef FEAT_PROP_POPUP
                && !wlv->dont_use_showbreak
 # endif
diff --git a/src/testdir/dumps/Test_diff_breakindent_after_filler.dump b/src/testdir/dumps/Test_diff_breakindent_after_filler.dump
new file mode 100644 (file)
index 0000000..d9c4873
--- /dev/null
@@ -0,0 +1,8 @@
+| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0| @18||+1&&| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0| @18
+| +0#0000e05#a8a8a8255@1|b+0#0000000#5fd7ff255| @18||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@19
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@17||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@17
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@17||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@17
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@13| @3||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@1|c@12>c| @3
+|~+0#4040ff13&| @20||+1#0000000&|~+0#4040ff13&| @20
+|~| @20||+1#0000000&|~+0#4040ff13&| @20
+| +0#0000000&@26|2|,|5|2|-|5|6| @6|A|l@1| 
index e05d91601352ad39a1a74b4ade29813f47a91586..930fd7b83726d29244ee358858e4ab70dc8f069b 100644 (file)
@@ -1097,18 +1097,19 @@ endfunc
 func Test_diff_with_cursorline_breakindent()
   CheckScreendump
 
-  call writefile([
-       \ 'hi CursorLine ctermbg=red ctermfg=white',
-       \ 'set noequalalways wrap diffopt=followwrap cursorline breakindent',
-       \ '50vnew',
-       \ 'call setline(1, ["  ","  ","  ","  "])',
-       \ 'exe "norm 20Afoo\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abar\<Esc>"',
-       \ 'vnew',
-       \ 'call setline(1, ["  ","  ","  ","  "])',
-       \ 'exe "norm 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"',
-       \ 'windo diffthis',
-       \ '2wincmd w',
-       \ ], 'Xtest_diff_cursorline_breakindent', 'D')
+  let lines =<< trim END
+    hi CursorLine ctermbg=red ctermfg=white
+    set noequalalways wrap diffopt=followwrap cursorline breakindent
+    50vnew
+    call setline(1, ['  ', '  ', '  ', '  '])
+    exe "norm! 20Afoo\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abar\<Esc>"
+    vnew
+    call setline(1, ['  ', '  ', '  ', '  '])
+    exe "norm! 20Abee\<Esc>j20Afoo\<Esc>j20Afoo\<Esc>j20Abaz\<Esc>"
+    windo diffthis
+    2wincmd w
+  END
+  call writefile(lines, 'Xtest_diff_cursorline_breakindent', 'D')
   let buf = RunVimInTerminal('-S Xtest_diff_cursorline_breakindent', {})
 
   call term_sendkeys(buf, "gg0")
@@ -1124,6 +1125,25 @@ func Test_diff_with_cursorline_breakindent()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_diff_breakindent_after_filler()
+  CheckScreendump
+
+  let lines =<< trim END
+    set laststatus=0 diffopt+=followwrap breakindent
+    call setline(1, ['a', '  ' .. repeat('c', 50)])
+    vnew
+    call setline(1, ['a', 'b', '  ' .. repeat('c', 50)])
+    windo diffthis
+    norm! G$
+  END
+  call writefile(lines, 'Xtest_diff_breakindent_after_filler', 'D')
+  let buf = RunVimInTerminal('-S Xtest_diff_breakindent_after_filler', #{rows: 8, cols: 45})
+  call VerifyScreenDump(buf, 'Test_diff_breakindent_after_filler', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_diff_with_syntax()
   CheckScreendump
 
index 16d13b9fe065759238f937cc4581991e11d9fddb..20245cd5a13d514a0f2a0fa8b84b439513ba4e3f 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2151,
 /**/
     2150,
 /**/