fix(vim): text inserted position error when completion ends with empty line. (#346)
parent
d89d5aeef2
commit
3052ad4450
|
|
@ -410,13 +410,14 @@ function! tabby#Show()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let lines = split(choice.text, "\n")
|
let lines = split(choice.text, "\n")
|
||||||
" split will not give an empty line if text starts with "\n" or ends with "\n"
|
" split will not give an empty line if text starts with "\n"
|
||||||
if choice.text[0] == "\n"
|
if choice.text[0] == "\n"
|
||||||
call insert(lines, '')
|
call insert(lines, '')
|
||||||
endif
|
endif
|
||||||
if choice.text[-1] == "\n"
|
" ignore trailing empty lines
|
||||||
call add(lines, '')
|
while len(lines) > 0 && (lines[-1] == '')
|
||||||
endif
|
call remove(lines, -1)
|
||||||
|
endwhile
|
||||||
call tabby#virtual_text#Show(lines)
|
call tabby#virtual_text#Show(lines)
|
||||||
let s:shown_lines = lines
|
let s:shown_lines = lines
|
||||||
call s:PostEvent('view')
|
call s:PostEvent('view')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue