Skip to content

Commit

Permalink
Fix lua completions having off-by-one error in neovim 0.9+ (gelguy#187)
Browse files Browse the repository at this point in the history
A private method vim._expand_pat (which should not be used) has
changed the behavior, which causes an off-by-one error in completion.

As a temporary workaround, we manually offset the match position.
  • Loading branch information
wookayin committed Apr 28, 2023
1 parent 679f348 commit 9929e10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autoload/wilder/cmdline.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@ function! s:get_lua_completion(ctx, res, fuzzy) abort
let l:arg_pos = len(a:res.arg)
else
let [l:candidates, l:arg_pos] = luaeval('{vim._expand_pat("^" .. _A[1])}', [a:res.arg])
if has('nvim-0.9.0') && l:arg_pos > 0
let l:arg_pos = l:arg_pos - 1 " see wilder.nvim#187, neovim#23363
endif

if a:fuzzy
let l:last_char = a:res.arg[-1 :]
Expand Down

1 comment on commit 9929e10

@luozhiya
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.