Skip to content

Commit f07f9e7

Browse files
committed
patch 8.1.0081: the terminal debugger doesn't adjust to changed 'background'
Problem: The terminal debugger doesn't adjust to changed 'background'. Solution: Add an OptionSet autocommand. (Christian Brabandt)
1 parent de1a831 commit f07f9e7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

runtime/pack/dist/opt/termdebug/plugin/termdebug.vim

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ let s:pc_id = 12
7070
let s:break_id = 13 " breakpoint number is added to this
7171
let s:stopped = 1
7272

73-
if &background == 'light'
74-
hi default debugPC term=reverse ctermbg=lightblue guibg=lightblue
75-
else
76-
hi default debugPC term=reverse ctermbg=darkblue guibg=darkblue
77-
endif
73+
func s:Highlight(init, old, new)
74+
let default = a:init ? 'default ' : ''
75+
if a:new ==# 'light' && a:old !=# 'light'
76+
exe "hi " . default . "debugPC term=reverse ctermbg=lightblue guibg=lightblue"
77+
elseif a:new ==# 'dark' && a:old !=# 'dark'
78+
exe "hi " . default . "debugPC term=reverse ctermbg=darkblue guibg=darkblue"
79+
endif
80+
endfunc
81+
82+
call s:Highlight(1, '', &background)
7883
hi default debugBreakpoint term=reverse ctermbg=red guibg=red
7984

8085
func s:StartDebug(bang, ...)
@@ -347,6 +352,7 @@ func s:StartDebugCommon(dict)
347352
augroup TermDebug
348353
au BufRead * call s:BufRead()
349354
au BufUnload * call s:BufUnloaded()
355+
au OptionSet background call s:Highlight(0, v:option_old, v:option_new)
350356
augroup END
351357

352358
" Run the command if the bang attribute was given and got to the debug
@@ -887,4 +893,3 @@ func s:BufUnloaded()
887893
endif
888894
endfor
889895
endfunc
890-

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
81,
764766
/**/
765767
80,
766768
/**/

0 commit comments

Comments
 (0)