Tidy up MouseFilter
This commit is contained in:
parent
e5e13ffcdd
commit
31e44548d3
1 changed files with 23 additions and 19 deletions
|
|
@ -171,15 +171,20 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
|
|||
augroup END
|
||||
|
||||
else
|
||||
" assume we are inside vim
|
||||
func! MouseFilter(winid, key)
|
||||
if index(["\<leftmouse>", "\<2-leftmouse>"], a:key) < 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let handled = 0
|
||||
if index(["\<leftmouse>", "\<2-leftmouse>"], a:key) >= 0
|
||||
let mouse_coords = getmousepos()
|
||||
|
||||
" close the popup if mouse is clicked outside the window
|
||||
if mouse_coords['winid'] != a:winid
|
||||
call vimspector#internal#balloon#Close()
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
|
||||
" place the cursor according to the click
|
||||
call win_execute(a:winid, ":call cursor(".mouse_coords['line'].", ".mouse_coords['column'].")")
|
||||
|
||||
|
|
@ -190,8 +195,7 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
|
|||
call py3eval("_vimspector_session.ExpandVariable(".line('.', a:winid).")")
|
||||
let handled = 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return handled
|
||||
endfunc
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue