Support setting from the balloon

This commit is contained in:
Ben Jackson 2021-02-24 17:23:30 +00:00
commit c2082cffae
3 changed files with 12 additions and 9 deletions

View file

@ -124,8 +124,6 @@ function! vimspector#internal#balloon#MouseFilter( winid, key ) abort
" expand the variable if we got double click
if a:key ==? "\<2-leftmouse>"
" forward line number to python, since vim does not allow us to focus
" the correct window
call py3eval( '_vimspector_session.ExpandVariable('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
@ -138,13 +136,17 @@ endfunction
function! vimspector#internal#balloon#CursorFilter( winid, key ) abort
if a:key ==? "\<CR>"
" forward line number to python, since vim does not allow us to focus
" the correct window
call py3eval( '_vimspector_session.ExpandVariable('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
\ . ')' )
return 1
elseif a:key ==? "\<C-CR>"
call py3eval( '_vimspector_session.SetVariableValue('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
\ . ')' )
return 1
elseif index( [ "\<LeftMouse>", "\<2-LeftMouse>" ], a:key ) >= 0
return vimspector#internal#balloon#MouseFilter( a:winid, a:key )
endif
@ -293,6 +295,8 @@ function! s:CreateNeovimTooltip( body ) abort
nnoremap <silent> <buffer> <CR>
\ <cmd>call vimspector#ExpandVariable()<CR>
nnoremap <silent> <buffer> <C-CR>
\ <cmd>call vimspector#SetVariableValue()<CR>
nnoremap <silent> <buffer> <Esc>
\ <cmd>quit<CR>
nnoremap <silent> <buffer> <2-LeftMouse>