runtime(termdebug): improve the breakpoint sign label (#13525)

Commit: 
https://github.com/vim/vim/commit/2dd613f57bf17eb8ff050bcb5510eb0279f5c9ab
Author: Shane-XB-Qian <[email protected]>
Date:   Sun Nov 12 23:53:39 2023 +0800

    runtime(termdebug): improve the breakpoint sign label 
(https://github.com/vim/vim/issues/13525)
    
    // related https://github.com/vim/vim/issues/12589
    // that should be the last chat (I) with Bram, r.i.p
    
    Signed-off-by: shane.xb.qian <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 68528d3a5..3869bcdfb 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1588,9 +1588,9 @@ If there is no g:termdebug_config you can use: >
 
 Change default signs ~
                                                        *termdebug_signs*
-Termdebug uses the last two characters of the breakpoint ID in the
-signcolumn to represent breakpoints. For example, breakpoint ID 133
-will be displayed as `33`.
+Termdebug uses the hex number of the breakpoint ID in the signcolumn to
+represent breakpoints. if it is greater than "0xFF", then it will be displayed
+as "F+", due to we really only have two screen cells for the sign.
 
 If you want to customize the breakpoint signs: >
        let g:termdebug_config['sign'] = '>>'
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 6d8e483e2..e764c2353 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -1648,9 +1648,9 @@ func s:CreateBreakpoint(id, subid, enabled)
       let label = get(g:termdebug_config, 'sign', '')
     endif
     if label == ''
-      let label = substitute(nr, '\..*', '', '')
-      if strlen(label) > 2
-       let label = strpart(label, strlen(label) - 2)
+      let label = printf('%02X', a:id)
+      if a:id > 255
+        let label = 'F+'
       endif
     endif
     call sign_define('debugBreakpoint' .. nr,
diff --git a/src/testdir/test_termdebug.vim b/src/testdir/test_termdebug.vim
index 5f547c9a3..70e11873f 100644
--- a/src/testdir/test_termdebug.vim
+++ b/src/testdir/test_termdebug.vim
@@ -80,6 +80,32 @@ func Test_termdebug_basic()
         \  'priority': 110, 'group': 'TermDebug'}],
         \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
   Continue
+  call term_wait(gdb_buf)
+
+  let i = 2
+  while i <= 258
+    Break
+    call term_wait(gdb_buf)
+    if i == 2
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint2.0')[0].text, '02')})
+    endif
+    if i == 10
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint10.0')[0].text, '0A')})
+    endif
+    if i == 168
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint168.0')[0].text, 'A8')})
+    endif
+    if i == 255
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint255.0')[0].text, 'FF')})
+    endif
+    if i == 256
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint256.0')[0].text, 'F+')})
+    endif
+    if i == 258
+      call WaitForAssert({-> 
assert_equal(sign_getdefined('debugBreakpoint258.0')[0].text, 'F+')})
+    endif
+    let i += 1
+  endwhile
 
   let cn = 0
   " 60 is approx spaceBuffer * 3

-- 
-- 
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/E1r2CsW-003LvF-49%40256bit.org.

Raspunde prin e-mail lui