Fix proc textobj cornercases
This commit is contained in:
parent
8b9b41db88
commit
0739d1a147
1 changed files with 7 additions and 3 deletions
|
|
@ -222,6 +222,11 @@ endfunction
|
||||||
|
|
||||||
function! util#SelectNimProc(inner)
|
function! util#SelectNimProc(inner)
|
||||||
let curline = nextnonblank(line("."))
|
let curline = nextnonblank(line("."))
|
||||||
|
if curline == 0
|
||||||
|
let curline = prevnonblank(line("."))
|
||||||
|
endif
|
||||||
|
|
||||||
|
let curindent = indent(curline)
|
||||||
let lastline = line("$")
|
let lastline = line("$")
|
||||||
let sl = curline
|
let sl = curline
|
||||||
|
|
||||||
|
|
@ -230,14 +235,13 @@ function! util#SelectNimProc(inner)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
while sl > 0
|
while sl > 0
|
||||||
if s:IsProcStart(sl) && (curline == sl || indent(sl) < indent(curline))
|
if s:IsProcStart(sl) && (curindent == -1 || curline == sl || indent(sl) < curindent)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
let sl -= 1
|
let sl -= 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
if !s:IsProcStart(sl)
|
if !s:IsProcStart(sl)
|
||||||
normal <Esc>
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -245,7 +249,7 @@ function! util#SelectNimProc(inner)
|
||||||
normal! 0V
|
normal! 0V
|
||||||
let el = sl + 1
|
let el = sl + 1
|
||||||
|
|
||||||
while getline(el) =~ "^\\s*$" || indent(el) > indent(sl)
|
while el < line("$") - 1 && (getline(el) =~ "^\\s*$" || indent(el) > indent(sl))
|
||||||
let el += 1
|
let el += 1
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue