patch 9.1.1532: termdebug: not enough ways to configure breakpoints
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: #17694
Signed-off-by: Dimitry Ishenko <dimitry.ishenko@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 1d502ab..2ca2d4b 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 9.1. Last change: 2025 Feb 22
+*terminal.txt* For Vim version 9.1. Last change: 2025 Jul 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1711,6 +1711,9 @@
If you want to customize the breakpoint signs to show `>>` in the signcolumn: >
let g:termdebug_config['sign'] = '>>'
+You can also specify individual signs for the first several breakpoints: >
+ 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: >
let g:termdebug_config['sign_decimal'] = 1
If the variable g:termdebug_config does not yet exist, you can use: >
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 9fbf3b7..40fb952 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -4,7 +4,7 @@
# Author: Bram Moolenaar
# Copyright: Vim license applies, see ":help license"
-# Last Change: 2024 Nov 19
+# Last Change: 2025 Jul 08
# Converted to Vim9: Ubaldo Tiberi <ubaldo.tiberi@gmail.com>
# WORK IN PROGRESS - The basics works stable, more to come
@@ -1917,14 +1917,21 @@
hiName = "debugBreakpoint"
endif
var label = ''
- if exists('g:termdebug_config') && has_key(g:termdebug_config, 'sign')
- label = g:termdebug_config['sign']
- elseif exists('g:termdebug_config') && has_key(g:termdebug_config, 'sign_decimal')
- label = printf('%02d', id)
- if id > 99
- label = '9+'
+ if exists('g:termdebug_config')
+ if has_key(g:termdebug_config, 'signs')
+ label = get(g:termdebug_config.signs, id - 1, '')
endif
- else
+ if label == '' && has_key(g:termdebug_config, 'sign')
+ label = g:termdebug_config['sign']
+ endif
+ if label == '' && has_key(g:termdebug_config, 'sign_decimal')
+ label = printf('%02d', id)
+ if id > 99
+ label = '9+'
+ endif
+ endif
+ endif
+ if label == ''
label = printf('%02X', id)
if id > 255
label = 'F+'