fixing styling inside vim files

This commit is contained in:
dsych 2021-01-10 15:37:17 -05:00 • committed by Ben Jackson
commit 4466fce20b
2 changed files with 20 additions and 20 deletions

View file

@ -523,7 +523,7 @@ function! vimspector#OnBufferCreated( file_name ) abort
py3 _vimspector_session.RefreshSigns( vim.eval( 'a:file_name' ) ) py3 _vimspector_session.RefreshSigns( vim.eval( 'a:file_name' ) )
endfunction endfunction
function! vimspector#ShowTooltipForSelection() range function! vimspector#ShowTooltipForSelection() range abort
let [start, end] = [[line("'<"), col("'<") - 1], [line("'>"), col("'>")]] let [start, end] = [[line("'<"), col("'<") - 1], [line("'>"), col("'>")]]
" restor cursor position, since command mode puts it to the begining of the " restor cursor position, since command mode puts it to the begining of the
" current line when invoked from visual mode " current line when invoked from visual mode
@ -549,7 +549,7 @@ function! vimspector#ShowTooltipForSelection() range
endfunction endfunction
function! vimspector#ShowTooltip(...) abort function! vimspector#ShowTooltip(...) abort
let str = "<cexpr>" let str = '<cexpr>'
if a:0 > 0 if a:0 > 0
let str = a:1 let str = a:1

View file

@ -65,16 +65,16 @@ function! vimspector#internal#balloon#CloseCallback( ... ) abort
return py3eval('_vimspector_session._CleanUpTooltip()') return py3eval('_vimspector_session._CleanUpTooltip()')
endfunction endfunction
function! vimspector#internal#balloon#nvim_generate_border(width, height) function! vimspector#internal#balloon#nvim_generate_border(width, height) abort
let top = "╭" . repeat("─",a:width + 2) . "╮" let top = '╭' . repeat('─',a:width + 2) . '╮'
let mid = "│" . repeat(" ",a:width + 2) . "│" let mid = '│' . repeat(' ',a:width + 2) . '│'
let bot = "╰" . repeat("─",a:width + 2) . "╯" let bot = '╰' . repeat('─',a:width + 2) . '╯'
let lines = [top] + repeat([mid], a:height) + [bot] let lines = [top] + repeat([mid], a:height) + [bot]
return lines return lines
endfunction endfunction
function! vimspector#internal#balloon#nvim_resize_tooltip() function! vimspector#internal#balloon#nvim_resize_tooltip() abort
if !has('nvim') || s:float_win <= 0 || s:nvim_related_win <= 0 if !has('nvim') || s:float_win <= 0 || s:nvim_related_win <= 0
return return
endif endif
@ -107,7 +107,7 @@ function! vimspector#internal#balloon#nvim_resize_tooltip()
endfunction endfunction
function! vimspector#internal#balloon#CreateTooltip(is_hover, ...) function! vimspector#internal#balloon#CreateTooltip(is_hover, ...) abort
let body = [] let body = []
if a:0 > 0 if a:0 > 0
let body = a:1 let body = a:1
@ -168,7 +168,7 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
augroup END augroup END
else else
func! MouseFilter(winid, key) func! MouseFilter(winid, key) abort
if index(["\<leftmouse>", "\<2-leftmouse>"], a:key) < 0 if index(["\<leftmouse>", "\<2-leftmouse>"], a:key) < 0
return 0 return 0
endif endif
@ -183,24 +183,24 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
endif endif
" place the cursor according to the click " place the cursor according to the click
call win_execute(a:winid, ":call cursor(".mouse_coords['line'].", ".mouse_coords['column'].")") call win_execute(a:winid, ':call cursor('.mouse_coords['line'].', '.mouse_coords['column'].')')
" expand the variable if we got double click " expand the variable if we got double click
if a:key == "\<2-leftmouse>" if a:key ==? "\<2-leftmouse>"
" forward line number to python, since vim does not allow us to focus " forward line number to python, since vim does not allow us to focus
" the correct window " the correct window
call py3eval("_vimspector_session.ExpandVariable(".line('.', a:winid).")") call py3eval('_vimspector_session.ExpandVariable('.line('.', a:winid).')')
let handled = 1 let handled = 1
endif endif
return handled return handled
endfunc endfunc
func! CursorFilter(winid, key) func! CursorFilter(winid, key) abort
if a:key == "\<CR>" if a:key ==? "\<CR>"
" forward line number to python, since vim does not allow us to focus " forward line number to python, since vim does not allow us to focus
" the correct window " the correct window
call py3eval("_vimspector_session.ExpandVariable(".line('.', a:winid).")") call py3eval('_vimspector_session.ExpandVariable('.line('.', a:winid).')')
return 1 return 1
elseif index( [ "\<LeftMouse>", "\<2-LeftMouse>" ], a:key ) >= 0 elseif index( [ "\<LeftMouse>", "\<2-LeftMouse>" ], a:key ) >= 0
return MouseFilter( a:winid, a:key ) return MouseFilter( a:winid, a:key )
@ -215,7 +215,7 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
let config = { let config = {
\ 'wrap': 0, \ 'wrap': 0,
\ 'filtermode': "n", \ 'filtermode': 'n',
\ 'maxwidth': s:max_width, \ 'maxwidth': s:max_width,
\ 'maxheight': s:max_height, \ 'maxheight': s:max_height,
\ 'minwidth': s:min_width, \ 'minwidth': s:min_width,
@ -229,17 +229,17 @@ function! vimspector#internal#balloon#CreateTooltip(is_hover, ...)
\ 'callback': 'vimspector#internal#balloon#CloseCallback' \ 'callback': 'vimspector#internal#balloon#CloseCallback'
\ } \ }
if &ambiwidth ==# 'single' && &encoding == 'utf-8' if &ambiwidth ==# 'single' && &encoding ==? 'utf-8'
let config['borderchars'] = [ '─', '│', '─', '│', '╭', '╮', '┛', '╰' ] let config['borderchars'] = [ '─', '│', '─', '│', '╭', '╮', '┛', '╰' ]
endif endif
if a:is_hover if a:is_hover
let config['filter'] = "MouseFilter" let config['filter'] = 'MouseFilter'
let config['mousemoved'] = [0, 0, 0] let config['mousemoved'] = [0, 0, 0]
let s:float_win = popup_beval(body, config) let s:float_win = popup_beval(body, config)
else else
let config['filter'] = "CursorFilter" let config['filter'] = 'CursorFilter'
let config['moved'] = "any" let config['moved'] = 'any'
let config['cursorline'] = 1 let config['cursorline'] = 1
let s:float_win = popup_atcursor(body, config) let s:float_win = popup_atcursor(body, config)
endif endif