Skip to content

Commit 85aa9bb

Browse files
committed
fim: restore trailing empty line removal on split
The old s:fim_render() stripped trailing empty strings from the split content lines. This was lost in the refactor, causing extra empty lines on accept and incorrect cursor positioning (cursor at column 1 of an empty trailing line instead of the last meaningful line). Assisted-by: llama.cpp:local pi
1 parent 7a4b820 commit 85aa9bb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

autoload/llama.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,12 @@ function! s:fim_try_hint(pos_x, pos_y)
10801080
if l:fuzzy_offset >= 0 && len(l:content) > l:fuzzy_offset
10811081
let l:content = l:content[l:fuzzy_offset + 1:]
10821082
endif
1083-
call add(l:completions, split(l:content, "\n", 1))
1083+
let l:lines = split(l:content, "\n", 1)
1084+
" remove trailing empty lines
1085+
while len(l:lines) > 0 && l:lines[-1] == ""
1086+
call remove(l:lines, -1)
1087+
endwhile
1088+
call add(l:completions, l:lines)
10841089
endfor
10851090

10861091
" store fuzzy info so cycling applies the same trimming

0 commit comments

Comments
 (0)