comparison runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @ 32655:79e36ed83ca1 v9.0.1659

patch 9.0.1659: Termdebug: default highlight cleared if changing colorscheme Commit: https://github.com/vim/vim/commit/279de0cd1f58ea520826a3dd1c5562a71157b23b Author: Christian Brabandt <cb@256bit.org> Date: Sat Jun 24 14:20:36 2023 +0100 patch 9.0.1659: Termdebug: default highlight cleared if changing colorscheme Problem: Termdebug: default highlight cleared when changing colorscheme. Solution: Use a ColorScheme autocommand. (Christian Brabandt, closes https://github.com/vim/vim/issues/12566, closes #12555)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jun 2023 15:30:03 +0200
parents b2e8663e6dcc
children 118a098718d8
comparison
equal deleted inserted replaced
32654:b1a7c029e485 32655:79e36ed83ca1
1 " Debugger plugin using gdb. 1 " Debugger plugin using gdb.
2 " 2 "
3 " Author: Bram Moolenaar 3 " Author: Bram Moolenaar
4 " Copyright: Vim license applies, see ":help license" 4 " Copyright: Vim license applies, see ":help license"
5 " Last Change: 2022 Nov 10 5 " Last Change: 2023 Jun 24
6 " 6 "
7 " WORK IN PROGRESS - The basics works stable, more to come 7 " WORK IN PROGRESS - The basics works stable, more to come
8 " Note: In general you need at least GDB 7.12 because this provides the 8 " Note: In general you need at least GDB 7.12 because this provides the
9 " frame= response in MI thread-selected events we need to sync stack to file. 9 " frame= response in MI thread-selected events we need to sync stack to file.
10 " The one included with "old" MingW is too old (7.6.1), you may upgrade it or 10 " The one included with "old" MingW is too old (7.6.1), you may upgrade it or
79 " The main breakpoint has a zero subid. 79 " The main breakpoint has a zero subid.
80 func s:Breakpoint2SignNumber(id, subid) 80 func s:Breakpoint2SignNumber(id, subid)
81 return s:break_id + a:id * 1000 + a:subid 81 return s:break_id + a:id * 1000 + a:subid
82 endfunction 82 endfunction
83 83
84 " Define or adjust the default highlighting, using background "new".
85 " When the 'background' option is set then "old" has the old value.
84 func s:Highlight(init, old, new) 86 func s:Highlight(init, old, new)
85 let default = a:init ? 'default ' : '' 87 let default = a:init ? 'default ' : ''
86 if a:new ==# 'light' && a:old !=# 'light' 88 if a:new ==# 'light' && a:old !=# 'light'
87 exe "hi " . default . "debugPC term=reverse ctermbg=lightblue guibg=lightblue" 89 exe "hi " . default . "debugPC term=reverse ctermbg=lightblue guibg=lightblue"
88 elseif a:new ==# 'dark' && a:old !=# 'dark' 90 elseif a:new ==# 'dark' && a:old !=# 'dark'
89 exe "hi " . default . "debugPC term=reverse ctermbg=darkblue guibg=darkblue" 91 exe "hi " . default . "debugPC term=reverse ctermbg=darkblue guibg=darkblue"
90 endif 92 endif
91 endfunc 93 endfunc
92 94
93 call s:Highlight(1, '', &background) 95 " Define the default highlighting, using the current 'background' value.
94 hi default debugBreakpoint term=reverse ctermbg=red guibg=red 96 func s:InitHighlight()
95 hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray 97 call s:Highlight(1, '', &background)
98 hi default debugBreakpoint term=reverse ctermbg=red guibg=red
99 hi default debugBreakpointDisabled term=reverse ctermbg=gray guibg=gray
100 endfunc
101
102 " Setup an autocommand to redefine the default highlight when the colorscheme
103 " is changed.
104 func s:InitAutocmd()
105 augroup TermDebug
106 autocmd!
107 autocmd ColorScheme * call s:InitHighlight()
108 augroup END
109 endfunc
96 110
97 " Get the command to execute the debugger as a list, defaults to ["gdb"]. 111 " Get the command to execute the debugger as a list, defaults to ["gdb"].
98 func s:GetCommand() 112 func s:GetCommand()
99 if exists('g:termdebug_config') 113 if exists('g:termdebug_config')
100 let cmd = get(g:termdebug_config, 'command', 'gdb') 114 let cmd = get(g:termdebug_config, 'command', 'gdb')
1520 endif 1534 endif
1521 endfor 1535 endfor
1522 endfor 1536 endfor
1523 endfunc 1537 endfunc
1524 1538
1539 call s:InitHighlight()
1540 call s:InitAutocmd()
1541
1525 let &cpo = s:keepcpo 1542 let &cpo = s:keepcpo
1526 unlet s:keepcpo 1543 unlet s:keepcpo