summaryrefslogtreecommitdiffstats
path: root/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-03 20:47:21 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-03 20:47:21 +0100
commit71137fed4d77e985d49ca32c79f030512767b8ce (patch)
tree0b81e0745769bd0b5428baa8d03080ab026d74c7 /runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
parent069dafc1ded60d9ee0fee4bcecce78ac8a235d87 (diff)
patch 8.0.1562: the terminal debugger can't set a breakpoint with the mousev8.0.1562
Problem: The terminal debugger can't set a breakpoint with the mouse. Solution: Add popup menu entries.
Diffstat (limited to 'runtime/pack/dist/opt/termdebug/plugin/termdebug.vim')
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim68
1 files changed, 52 insertions, 16 deletions
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 84ac0de424..add0de9817 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -201,7 +201,7 @@ endfunc
" Install commands in the current window to control the debugger.
func s:InstallCommands()
command Break call s:SetBreakpoint()
- command Delete call s:DeleteBreakpoint()
+ command Clear call s:ClearBreakpoint()
command Step call s:SendCommand('-exec-step')
command Over call s:SendCommand('-exec-next')
command Finish call s:SendCommand('-exec-finish')
@@ -212,24 +212,42 @@ func s:InstallCommands()
command -range -nargs=* Evaluate call s:Evaluate(<range>, <q-args>)
command Gdb call win_gotoid(s:gdbwin)
command Program call win_gotoid(s:ptywin)
+ command Winbar call s:InstallWinbar()
" TODO: can the K mapping be restored?
nnoremap K :Evaluate<CR>
if has('menu') && &mouse != ''
- nnoremenu WinBar.Step :Step<CR>
- nnoremenu WinBar.Next :Over<CR>
- nnoremenu WinBar.Finish :Finish<CR>
- nnoremenu WinBar.Cont :Continue<CR>
- nnoremenu WinBar.Stop :Stop<CR>
- nnoremenu WinBar.Eval :Evaluate<CR>
+ call s:InstallWinbar()
+
+ if !exists('g:termdebug_popup') || g:termdebug_popup != 0
+ let s:saved_mousemodel = &mousemodel
+ let &mousemodel = 'popup_setpos'
+ an 1.200 PopUp.-SEP3- <Nop>
+ an 1.210 PopUp.Set\ breakpoint :Break<CR>
+ an 1.220 PopUp.Clear\ breakpoint :Clear<CR>
+ an 1.230 PopUp.Evaluate :Evaluate<CR>
+ endif
endif
endfunc
+let s:winbar_winids = []
+
+" Install the window toolbar in the current window.
+func s:InstallWinbar()
+ nnoremenu WinBar.Step :Step<CR>
+ nnoremenu WinBar.Next :Over<CR>
+ nnoremenu WinBar.Finish :Finish<CR>
+ nnoremenu WinBar.Cont :Continue<CR>
+ nnoremenu WinBar.Stop :Stop<CR>
+ nnoremenu WinBar.Eval :Evaluate<CR>
+ call add(s:winbar_winids, win_getid(winnr()))
+endfunc
+
" Delete installed debugger commands in the current window.
func s:DeleteCommands()
delcommand Break
- delcommand Delete
+ delcommand Clear
delcommand Step
delcommand Over
delcommand Finish
@@ -240,16 +258,34 @@ func s:DeleteCommands()
delcommand Evaluate
delcommand Gdb
delcommand Program
+ delcommand Winbar
nunmap K
if has('menu')
- aunmenu WinBar.Step
- aunmenu WinBar.Next
- aunmenu WinBar.Finish
- aunmenu WinBar.Cont
- aunmenu WinBar.Stop
- aunmenu WinBar.Eval
+ " Remove the WinBar entries from all windows where it was added.
+ let curwinid = win_getid(winnr())
+ for winid in s:winbar_winids
+ if win_gotoid(winid)
+ aunmenu WinBar.Step
+ aunmenu WinBar.Next
+ aunmenu WinBar.Finish
+ aunmenu WinBar.Cont
+ aunmenu WinBar.Stop
+ aunmenu WinBar.Eval
+ endif
+ endfor
+ call win_gotoid(curwinid)
+ let s:winbar_winids = []
+
+ if exists('s:saved_mousemodel')
+ let &mousemodel = s:saved_mousemodel
+ unlet s:saved_mousemodel
+ aunmenu PopUp.-SEP3-
+ aunmenu PopUp.Set\ breakpoint
+ aunmenu PopUp.Clear\ breakpoint
+ aunmenu PopUp.Evaluate
+ endif
endif
exe 'sign unplace ' . s:pc_id
@@ -278,8 +314,8 @@ func s:SetBreakpoint()
endif
endfunc
-" :Delete - Delete a breakpoint at the cursor position.
-func s:DeleteBreakpoint()
+" :Clear - Delete a breakpoint at the cursor position.
+func s:ClearBreakpoint()
let fname = fnameescape(expand('%:p'))
let lnum = line('.')
for [key, val] in items(s:breakpoints)