On Do, 14 Jun 2018, Bram Moolenaar wrote:
> This shows the breakpoint number above the breakpoint sign.
> I wonder how it's doing that. Possibly with another sign?
> Do you know where the plugin can be found?
Bram, here are two patches. Patch 1 uses the breakpoint number as sign
label. Patch two, adjusts the highlighting for the DebugPC whenever the
'background' option changes. (It happens often, that Vim does not
detect my background correctly and uses 'ligth'). However I only notice
because the line of the debugPC sign is not readable.
Best,
Christian
--
Nichts ewiges kann das Glück uns geben,
denn flüchtiger Traum ist Menschenleben,
und selbst die Trüme sind ein Traum.
-- Pedro Calder¢n de la Barca
--
--
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].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index cc892bbc6..271ab1e49 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -33,15 +33,20 @@ if !exists('termdebugger')
let termdebugger = 'gdb'
endif
+func s:Highlight(init, old, new)
+ let default = a:init ? 'default' : ''
+ if a:new ==# 'light' && a:old !=# 'light'
+ exe "hi" default "debugPC term=reverse ctermbg=lightblue guibg=lightblue"
+ elseif a:new ==# 'dark' && a:old !=# 'dark'
+ exe "hi" default "debugPC term=reverse ctermbg=darkblue guibg=darkblue"
+ endif
+endfunc
+
let s:pc_id = 12
let s:break_id = 13
let s:stopped = 1
-if &background == 'light'
- hi default debugPC term=reverse ctermbg=lightblue guibg=lightblue
-else
- hi default debugPC term=reverse ctermbg=darkblue guibg=darkblue
-endif
+call s:Highlight(1, '', &background)
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
func s:StartDebug(bang, ...)
@@ -191,6 +196,7 @@ func s:StartDebug_internal(dict)
augroup TermDebug
au BufRead * call s:BufRead()
au BufUnload * call s:BufUnloaded()
+ au OptionSet background call s:Highlight(0, v:option_old, v:option_new)
augroup END
" Run the command if the bang attribute was given
@@ -623,4 +629,3 @@ func s:BufUnloaded()
endif
endfor
endfunc
-
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index f2f0f0944..cc892bbc6 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -170,15 +170,6 @@ func s:StartDebug_internal(dict)
" Disable pagination, it causes everything to stop at the gdb
" "Type <return> to continue" prompt.
call s:SendCommand('-gdb-set pagination off')
-
- " Sign used to highlight the line where the program has stopped.
- " There can be only one.
- sign define debugPC linehl=debugPC
-
- " Sign used to indicate a breakpoint.
- " Can be used multiple times.
- sign define debugBreakpoint text=>> texthl=debugBreakpoint
-
" Install debugger commands in the text window.
call win_gotoid(s:startwin)
call s:InstallCommands()
@@ -534,6 +525,37 @@ func s:HandleCursor(msg)
call win_gotoid(wid)
endfunc
+func s:CreateBreakpoint(name)
+ if !exists("s:BreakpointSigns")
+ let s:BreakpointSigns = []
+ endif
+ if index(s:BreakpointSigns, 'debugPC') == -1
+ call s:SignDefine('debugPC')
+ call add(s:BreakpointSigns, 'debugPC')
+ endif
+ if index(s:BreakpointSigns, a:name) == -1
+ call s:SignDefine(a:name)
+ call add(s:BreakpointSigns, a:name)
+ endif
+endfunc
+
+func s:SignDefine(name)
+ " Name: debugPC:
+ " Sign used to highlight the line where the program has stopped.
+ " There can be only one.
+ if a:name is# 'debugPC'
+ sign define debugPC linehl=debugPC
+ endif
+
+ " Digit: debugBreakpoint\d\d
+ " Sign used to indicate a breakpoint for number digit
+ " Can be used multiple times.
+ if a:name =~ '^\d\+$'
+ exe "sign define debugBreakpoint". a:name "text=".a:name "texthl=debugBreakpoint"
+ endif
+endfunc
+
+
" Handle setting a breakpoint
" Will update the sign that shows the breakpoint
func s:HandleNewBreakpoint(msg)
@@ -541,6 +563,7 @@ func s:HandleNewBreakpoint(msg)
if nr == 0
return
endif
+ call s:CreateBreakpoint(nr)
if has_key(s:breakpoints, nr)
let entry = s:breakpoints[nr]
@@ -560,7 +583,7 @@ func s:HandleNewBreakpoint(msg)
endfunc
func s:PlaceSign(nr, entry)
- exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint file=' . a:entry['fname']
+ exe 'sign place ' . (s:break_id + a:nr) . ' line=' . a:entry['lnum'] . ' name=debugBreakpoint'. a:nr. ' file=' . a:entry['fname']
let a:entry['placed'] = 1
endfunc