patch 9.1.1378: sign without text overwrites number option

Commit: 
https://github.com/vim/vim/commit/1b186833c1cabeb4da3c855596b9161ff982bcfc
Author: glepnir <glephun...@gmail.com>
Date:   Sat May 10 14:59:08 2025 +0200

    patch 9.1.1378: sign without text overwrites number option
    
    Problem:  When 'signcolumn' is set to `number` but a line has a sign
              without text, the line number disappears (finite-state-machine)
    Solution: Verify that a sign actually contains text before rendering the
              line number (glepnir)
    
    fixes: #17169
    closes: #17282
    
    Signed-off-by: glepnir <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/drawline.c b/src/drawline.c
index a14dd9062..57ee9a5fd 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -388,7 +388,8 @@ handle_lnum_col(
        // If 'signcolumn' is set to 'number' and a sign is present
        // in 'lnum', then display the sign instead of the line
        // number.
-       if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') && sign_present)
+       if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') && sign_present
+               && wlv->sattr.sat_text != NULL)
            get_sign_display_info(TRUE, wp, wlv);
        else
 #endif
diff --git a/src/testdir/dumps/Test_sign_number_without_signtext.dump 
b/src/testdir/dumps/Test_sign_number_without_signtext.dump
new file mode 100644
index 000000000..0cf55bdb9
--- /dev/null
+++ b/src/testdir/dumps/Test_sign_number_without_signtext.dump
@@ -0,0 +1,5 @@
+| +0#ffffff16#ff404010|>@1| >a+0#0000000#ffffff0| @69
+| +0#ffffff16#ff404010@1|2| |b+0#0000000#ffffff0| @69
+| +0#af5f00255&@1|3| |c+0#0000000&| @69
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim
index 8304298f6..e66e6fa01 100644
--- a/src/testdir/test_signs.vim
+++ b/src/testdir/test_signs.vim
@@ -2103,4 +2103,23 @@ func Test_sign_null_list()
   eval test_null_list()->sign_unplacelist()
 endfunc
 
+func Test_sign_number_without_signtext()
+  CheckScreendump
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      set number signcolumn=number
+      call setline(1, ['a', 'b', 'c'])
+      sign define SignA text=>> texthl=Search numhl=Error
+      sign define SignB numhl=Error
+      sign place 1 line=1 name=SignA buffer=1
+      sign place 2 line=2 name=SignB  buffer=1
+  END
+  call writefile(lines, 'XtestSigncolumnNumber', 'D')
+  let buf = RunVimInTerminal('-S XtestSigncolumnNumber', {'rows': 5})
+  call VerifyScreenDump(buf, 'Test_sign_number_without_signtext', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index aa7f46180..c84709e50 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1378,
 /**/
     1377,
 /**/

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uDk2h-001zcN-3R%40256bit.org.

Raspunde prin e-mail lui