diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-24 22:14:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-24 22:14:57 +0800 |
commit | 57fda7688b815f1d99e645d371a06332948ac197 (patch) | |
tree | 2a697fb985a68037540c2123d841319f1cc42079 | |
parent | c2d696f0094fe50bf6256d56314f82a7724a2b4e (diff) | |
download | rneovim-57fda7688b815f1d99e645d371a06332948ac197.tar.gz rneovim-57fda7688b815f1d99e645d371a06332948ac197.tar.bz2 rneovim-57fda7688b815f1d99e645d371a06332948ac197.zip |
vim-patch:9.0.1659: Termdebug: default highlight cleared if changing colorscheme (#24139)
Problem: Termdebug: default highlight cleared when changing colorscheme.
Solution: Use a ColorScheme autocommand. (Christian Brabandt, closes vim/vim#12566,
closes vim/vim#12555)
https://github.com/vim/vim/commit/279de0cd1f58ea520826a3dd1c5562a71157b23b
Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r-- | runtime/pack/dist/opt/termdebug/plugin/termdebug.vim | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 43c3d7541f..7140c275e6 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -2,7 +2,7 @@ " " Author: Bram Moolenaar " Copyright: Vim license applies, see ":help license" -" Last Change: 2022 Nov 10 +" Last Change: 2023 Jun 24 " " WORK IN PROGRESS - The basics works stable, more to come " Note: In general you need at least GDB 7.12 because this provides the @@ -87,6 +87,8 @@ func s:Breakpoint2SignNumber(id, subid) return s:break_id + a:id * 1000 + a:subid endfunction +" Define or adjust the default highlighting, using background "new". +" When the 'background' option is set then "old" has the old value. func s:Highlight(init, old, new) let default = a:init ? 'default ' : '' if a:new ==# 'light' && a:old !=# 'light' @@ -96,9 +98,21 @@ 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 +" Define the default highlighting, using the current 'background' value. +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 + +" Setup an autocommand to redefine the default highlight when the colorscheme +" is changed. +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() @@ -1664,5 +1678,8 @@ func s:BufUnloaded() endfor endfunc +call s:InitHighlight() +call s:InitAutocmd() + let &cpo = s:keepcpo unlet s:keepcpo |