Early out when no arguments, store cursor position
This commit is contained in:
parent
164ca21b71
commit
a3caecbd6a
@ -179,8 +179,9 @@ function! argwrap#adjustCursor()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! argwrap#toggle()
|
function! argwrap#toggle()
|
||||||
call argwrap#adjustCursor()
|
let l:cursor = getpos('.')
|
||||||
|
|
||||||
|
call argwrap#adjustCursor()
|
||||||
let l:range = argwrap#findClosestRange()
|
let l:range = argwrap#findClosestRange()
|
||||||
if !argwrap#validateRange(l:range)
|
if !argwrap#validateRange(l:range)
|
||||||
return
|
return
|
||||||
@ -188,11 +189,16 @@ function! argwrap#toggle()
|
|||||||
|
|
||||||
let l:argText = argwrap#extractContainerArgText(l:range)
|
let l:argText = argwrap#extractContainerArgText(l:range)
|
||||||
let l:arguments = argwrap#extractContainerArgs(l:argText)
|
let l:arguments = argwrap#extractContainerArgs(l:argText)
|
||||||
let l:container = argwrap#extractContainer(l:range)
|
if len(l:arguments) == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:container = argwrap#extractContainer(l:range)
|
||||||
if l:range.lineStart == l:range.lineEnd
|
if l:range.lineStart == l:range.lineEnd
|
||||||
call argwrap#wrapContainer(l:range, l:container, l:arguments)
|
call argwrap#wrapContainer(l:range, l:container, l:arguments)
|
||||||
else
|
else
|
||||||
call argwrap#unwrapContainer(l:range, l:container, l:arguments)
|
call argwrap#unwrapContainer(l:range, l:container, l:arguments)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call setpos('.', l:cursor)
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user