]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0103: 'breakindentopt' "min" not correct with 'signcolumn' v9.1.0103
authorzeertzjq <zeertzjq@outlook.com>
Mon, 12 Feb 2024 21:53:20 +0000 (22:53 +0100)
committerChristian Brabandt <cb@256bit.org>
Mon, 12 Feb 2024 21:53:20 +0000 (22:53 +0100)
Problem:  'breakindentopt' "min" works incorrectly with 'signcolumn'.
Solution: Use win_col_off() and win_col_off2().
          (zeertzjq)

closes: #14014

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/indent.c
src/testdir/test_breakindent.vim
src/testdir/test_diffmode.vim
src/version.c

index 34d31579bd89c5629ba1781f2c2ee7d39b74e9df..1087bad3eea9eff94e44d577debd476242793131 100644 (file)
@@ -935,9 +935,7 @@ get_breakindent_win(
     int                    bri = 0;
     // window width minus window margin space, i.e. what rests for text
     const int      eff_wwidth = wp->w_width
-                           - ((wp->w_p_nu || wp->w_p_rnu)
-                               && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
-                                               ? number_width(wp) + 1 : 0);
+                                         - win_col_off(wp) + win_col_off2(wp);
 
     // In list mode, if 'listchars' "tab" isn't set, a TAB is displayed as ^I.
     int no_ts = wp->w_p_list && wp->w_lcs_chars.tab1 == NUL;
index 9fde0f31ac6d50765f1a014d68e6e572ef1f2129..96d91c949ca078c22336988f2d46a9b30b217f08 100644 (file)
@@ -733,7 +733,7 @@ func Test_breakindent20_list()
        \ "shall make no law   ",
        \ ]
   call s:compare_lines(expect, lines)
-  " set minimum indent
+  " set minimum text width
   setl briopt=min:5
   redraw!
   let lines = s:screen_lines2(1, 6, 20)
@@ -1133,4 +1133,36 @@ func Test_breakindent_list_split()
   bwipe!
 endfunc
 
+func Test_breakindent_min_with_signcol()
+  call s:test_windows('setl briopt=min:15 signcolumn=yes')
+  redraw!
+  let expect = [
+        \ "      abcdefghijklmn",
+        \ "     opqrstuvwxyzABC",
+        \ "     DEFGHIJKLMNOP  "
+        \ ]
+  let lines = s:screen_lines(line('.'), 20)
+  call s:compare_lines(expect, lines)
+  setl briopt=min:17
+  redraw!
+  let expect = [
+        \ "      abcdefghijklmn",
+        \ "   opqrstuvwxyzABCDE",
+        \ "   FGHIJKLMNOP      "
+        \ ]
+  let lines = s:screen_lines(line('.'), 20)
+  call s:compare_lines(expect, lines)
+  setl briopt=min:19
+  redraw!
+  let expect = [
+        \ "      abcdefghijklmn",
+        \ "  opqrstuvwxyzABCDEF",
+        \ "  GHIJKLMNOP        "
+        \ ]
+  let lines = s:screen_lines(line('.'), 20)
+  call s:compare_lines(expect, lines)
+
+  call s:close_windows()
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 8e7d5ce312d71256795d5cc9b2e74a37c74f791f..bae94f6a87963aec1d5e60d6a633088db19604ca 100644 (file)
@@ -1133,7 +1133,7 @@ func Test_diff_breakindent_after_filler()
   CheckScreendump
 
   let lines =<< trim END
-    set laststatus=0 diffopt+=followwrap breakindent
+    set laststatus=0 diffopt+=followwrap breakindent breakindentopt=min:0
     call setline(1, ['a', '  ' .. repeat('c', 50)])
     vnew
     call setline(1, ['a', 'b', '  ' .. repeat('c', 50)])
index e20b4270a8f4ab3b654a7c7eb10cf67773388069..e28a326950ca9b646592fc57d1e8c1d1b555a0d1 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    103,
 /**/
     102,
 /**/