Skip to content

Commit

Permalink
termdebug: install a colorscheme autocommand
Browse files Browse the repository at this point in the history
When changing the colorscheme, the default highlighting groups used by
the termplugin debugPC, debugBreakpoint and debugBreakpointDisabled may
become cleared.

So install a colorscheme autocommand, to reset those highlighting groups
to their default values.

Fixes: vim#12555
  • Loading branch information
chrisbra committed Jun 20, 2023
1 parent 7f29122 commit 03392ed
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,18 @@ func s:Highlight(init, old, new)
endif
endfunc

call s:Highlight(1, '', &background)
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
func s:InitHighlight()
call s:Highlight(1, '', &background)
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
endfunc

func s:InitAutocmd()
augroup TermDebug
autocmd!
autocmd colorscheme * call s:InitHighlight()
augroup END
endfunc

" Get the command to execute the debugger as a list, defaults to ["gdb"].
func s:GetCommand()
Expand Down Expand Up @@ -1522,5 +1531,8 @@ func s:BufUnloaded()
endfor
endfunc

call s:InitHighlight()
call s:InitAutocmd()

let &cpo = s:keepcpo
unlet s:keepcpo

0 comments on commit 03392ed

Please sign in to comment.