patch 9.0.1813: linebreak incorrect drawn with breakindent

Commit: 
https://github.com/vim/vim/commit/1d3e0e8f3110a7807431eae056914ccea57b057b
Author: zeertzjq <[email protected]>
Date:   Mon Aug 28 21:20:16 2023 +0200

    patch 9.0.1813: linebreak incorrect drawn with breakindent
    
    Problem: 'linebreak' is incorrectly drawn after 'breakindent'.
    Solution: Don't include 'breakindent' size when already after it.
    
    closes: #12937
    closes: #12940
    
    Signed-off-by: Christian Brabandt <[email protected]>
    Co-authored-by: zeertzjq <[email protected]>

diff --git a/src/charset.c b/src/charset.c
index 1c7f7d791..03ef3fd1c 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1319,6 +1319,9 @@ win_lbr_chartabsize(
        vcol -= wp->w_virtcol_first_char;
 #endif
        colnr_T wcol = vcol + col_off_prev;
+       colnr_T max_head_vcol = cts->cts_max_head_vcol;
+       int     added = 0;
+
        // cells taken by 'showbreak'/'breakindent' before current char
        int     head_prev = 0;
        if (wcol >= wp->w_width)
@@ -1332,23 +1335,18 @@ win_lbr_chartabsize(
            if (wp->w_p_bri)
                head_prev += get_breakindent_win(wp, line);
            if (wcol < head_prev)
-               wcol = head_prev;
-           wcol += col_off_prev;
-       }
-
-       if ((vcol > 0 && wcol == col_off_prev + head_prev)
-                                                 || wcol + size > wp->w_width)
-       {
-           int added = 0;
-           colnr_T max_head_vcol = cts->cts_max_head_vcol;
-
-           if (vcol > 0 && wcol == col_off_prev + head_prev)
            {
+               head_prev -= wcol;
+               wcol += head_prev;
                added += head_prev;
                if (max_head_vcol <= 0 || vcol < max_head_vcol)
                    head += head_prev;
            }
+           wcol += col_off_prev;
+       }
 
+       if (wcol + size > wp->w_width)
+       {
            // cells taken by 'showbreak'/'breakindent' halfway current char
            int head_mid = 0;
            if (*sbr != NUL)
@@ -1384,9 +1382,9 @@ win_lbr_chartabsize(
                }
 #endif
            }
-
-           size += added;
        }
+
+       size += added;
     }
     if (headp != NULL)
        *headp = head;
diff --git a/src/drawline.c b/src/drawline.c
index 5b5fbf238..63bc96c4d 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2887,14 +2887,6 @@ win_line(
                    wlv.n_extra = win_lbr_chartabsize(&cts, NULL) - 1;
                    clear_chartabsize_arg(&cts);
 
-                   // We have just drawn the showbreak value, no need to add
-                   // space for it again.
-                   if (wlv.vcol == wlv.vcol_sbr)
-                   {
-                       wlv.n_extra -= MB_CHARLEN(get_showbreak_value(wp));
-                       if (wlv.n_extra < 0)
-                           wlv.n_extra = 0;
-                   }
                    if (on_last_col && c != TAB)
                        // Do not continue search/match highlighting over the
                        // line break, but for TABs the highlighting should
diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim
index f817a8502..55764ba16 100644
--- a/src/testdir/test_display.vim
+++ b/src/testdir/test_display.vim
@@ -410,12 +410,19 @@ func Test_display_linebreak_breakat()
   new
   vert resize 25
   let _breakat = &breakat
-  setl signcolumn=yes linebreak breakat=) showbreak=+\ 
+  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                 '
+          \ '  ++)abc                 ',
+          \ ]
+  call assert_equal(expected, lines)
+  setl breakindent breakindentopt=shift:2
+  let lines = ScreenLines([1, 2], 25)
+  let expected = [
+          \ '  xxxxxxxxxxxxxxxxxxxxxxx',
+          \ '    ++)abc               ',
           \ ]
   call assert_equal(expected, lines)
   %bw!
diff --git a/src/version.c b/src/version.c
index 46f2676a1..7b8683e7c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1813,
 /**/
     1812,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qahw8-00516d-QX%40256bit.org.

Raspunde prin e-mail lui