vim-patch:2dd613f57bf1 (#26009)

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

// related vim/vim#12589
// that should be the last chat (I) with Bram, r.i.p

2dd613f57b

Co-authored-by: Shane-XB-Qian <shane.qian@foxmail.com>
This commit is contained in:
zeertzjq 2023-11-13 05:44:30 +08:00 committed by GitHub
parent 4f8941c1a5
commit 74e23b3b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 6 deletions

View File

@ -537,9 +537,9 @@ If there is no g:termdebug_config you can use: >vim
Change default signs ~ Change default signs ~
*termdebug_signs* *termdebug_signs*
Termdebug uses the last two characters of the breakpoint ID in the Termdebug uses the hex number of the breakpoint ID in the signcolumn to
signcolumn to represent breakpoints. For example, breakpoint ID 133 represent breakpoints. if it is greater than "0xFF", then it will be displayed
will be displayed as `33`. as "F+", due to we really only have two screen cells for the sign.
If you want to customize the breakpoint signs: >vim If you want to customize the breakpoint signs: >vim
let g:termdebug_config['sign'] = '>>' let g:termdebug_config['sign'] = '>>'

View File

@ -1781,9 +1781,9 @@ func s:CreateBreakpoint(id, subid, enabled)
let label = get(g:termdebug_config, 'sign', '') let label = get(g:termdebug_config, 'sign', '')
endif endif
if label == '' if label == ''
let label = substitute(nr, '\..*', '', '') let label = printf('%02X', a:id)
if strlen(label) > 2 if a:id > 255
let label = strpart(label, strlen(label) - 2) let label = 'F+'
endif endif
endif endif
call sign_define('debugBreakpoint' .. nr, call sign_define('debugBreakpoint' .. nr,

View File

@ -81,6 +81,32 @@ func Test_termdebug_basic()
\ 'priority': 110, 'group': 'TermDebug'}], \ 'priority': 110, 'group': 'TermDebug'}],
\ sign_getplaced('', #{group: 'TermDebug'})[0].signs)}) \ sign_getplaced('', #{group: 'TermDebug'})[0].signs)})
Continue Continue
call Nterm_wait(gdb_buf)
let i = 2
while i <= 258
Break
call Nterm_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 let cn = 0
" 60 is approx spaceBuffer * 3 " 60 is approx spaceBuffer * 3