vim-patch:9.1.1532: termdebug: not enough ways to configure breakpoints (#34851)

Problem:  termdebug: not enough ways to configure breakpoints
Solution: add the termdebug_config['signs'] config setting, rework the
          termdebug test cases (Dimitry Ishenko)

Allow to configure custom breakpoint signs so one can do something like
this:

```vim
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5', '>6', '>7', '>8', '>9']
let g:termdebug_config['sign'] = '>>'
```

where the first 9 breakpoints will have their own signs and the rest
will be the same (>>).

While at it, rework the test for the termdebug plugin:

- Added test for g:termdebug_config['signs'].
- Added test for g:termdebug_config['sign'].
- Moved test for g:termdebug_config['sign_decimal'] into
  Test_termdebug_basic()

closes: vim/vim#17694

c4bca1de0b

Co-authored-by: Dimitry Ishenko <dimitry.ishenko@gmail.com>
This commit is contained in:
zeertzjq
2025-07-09 06:38:58 +08:00
committed by GitHub
parent 435f03ee10
commit db7c2acbc6
3 changed files with 51 additions and 69 deletions

View File

@ -657,6 +657,9 @@ than 99 will be displayed as "9+".
If you want to customize the breakpoint signs to show `>>` in the signcolumn: >vim
let g:termdebug_config['sign'] = '>>'
You can also specify individual signs for the first several breakpoints: >vim
let g:termdebug_config['signs'] = ['>1', '>2', '>3', '>4', '>5', '>6', '>7', '>8', '>9']
let g:termdebug_config['sign'] = '>>'
If you would like to use decimal (base 10) breakpoint signs: >vim
let g:termdebug_config['sign_decimal'] = 1
If the variable g:termdebug_config does not yet exist, you can use: >vim

View File

@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
" Last Change: 2023 Nov 02
" Last Change: 2025 Jul 08
"
" WORK IN PROGRESS - The basics works stable, more to come
" Note: In general you need at least GDB 7.12 because this provides the
@ -1688,14 +1688,21 @@ func s:CreateBreakpoint(id, subid, enabled)
else
let hiName = "debugBreakpoint"
endif
let label = ''
if exists('g:termdebug_config') && has_key(g:termdebug_config, 'sign')
let label = g:termdebug_config['sign']
elseif exists('g:termdebug_config') && has_key(g:termdebug_config, 'sign_decimal')
let label = printf('%02d', a:id)
if a:id > 99
let label = ''
if exists('g:termdebug_config')
if has_key(g:termdebug_config, 'signs')
let label = get(g:termdebug_config.signs, a:id - 1, '')
endif
endif
if label == '' && has_key(g:termdebug_config, 'sign')
let label = g:termdebug_config['sign']
endif
if label == '' && has_key(g:termdebug_config, 'sign_decimal')
let label = printf('%02d', a:id)
if a:id > 99
let label = '9+'
endif
endif
endif
if label == ''
let label = printf('%02X', a:id)
if a:id > 255