Skip to content

Commit 009795d

Browse files
committed
bugfix for #372
1 parent ac80568 commit 009795d

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

autoload/easycomplete/pum.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ function! s:bgcolor(group)
195195
return easycomplete#ui#GetBgColor(a:group)
196196
endfunction
197197

198+
function! easycomplete#pum#winid()
199+
return s:pum_window
200+
endfunction
201+
202+
function! easycomplete#pum#bufid()
203+
return s:pum_buffer
204+
endfunction
205+
198206
function! s:OpenPum(startcol, lines)
199207
call s:InitBuffer(a:lines)
200208
let buffer_size = s:GetBufSize(a:lines)

lua/easycomplete/cmdline.lua

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,38 @@ local console = util.console
44
local cmdline_start_cmdpos = 0
55
local old_cmdline = ""
66
local pum_noselect = vim.g.easycomplete_pum_noselect
7-
local lazyredraw = vim.o.lazyredraw
87
local this = {}
98

109
function this.pum_complete(start_col, menu_items)
1110
vim.g.easycomplete_pum_noselect = 1
12-
vim.cmd("setlocal nolazyredraw")
1311
vim.fn["easycomplete#pum#complete"](start_col, menu_items)
1412
end
1513

14+
function this.pum_redraw()
15+
if vim.fn.has('nvim-0.10') then
16+
local pum_bufid = this.pum_bufid()
17+
vim.api.nvim__redraw({
18+
buf = pum_bufid,
19+
flush = true
20+
})
21+
else
22+
vim.cmd("redraw")
23+
end
24+
end
25+
1626
function this.pum_close()
1727
vim.fn["easycomplete#pum#close"]()
1828
vim.g.easycomplete_pum_noselect = pum_noselect
19-
if lazyredraw == true then
20-
vim.cmd("setlocal lazyredraw")
21-
end
29+
end
30+
31+
function this.pum_bufid()
32+
local pum_bufid = vim.fn['easycomplete#pum#bufid']()
33+
return pum_bufid
34+
end
35+
36+
function this.pum_winid()
37+
local pum_winid = vim.fn['easycomplete#pum#winid']()
38+
return pum_winid
2239
end
2340

2441
function this.get_typing_word()
@@ -211,9 +228,7 @@ function this.cmdline_handler(keys, key_str)
211228
this.do_complete()
212229
end
213230
old_cmdline = cmdline
214-
vim.cmd("redraw")
215-
-- vim.defer_fn(function()
216-
-- end, 10)
231+
this.pum_redraw()
217232
end
218233

219234
function this.cr_handler()
@@ -342,7 +357,7 @@ function this.do_path_complete()
342357
this.cmp_regex_handler(function()
343358
return this.get_path_cmp_items()
344359
end, this.get_typing_word())
345-
vim.cmd("redraw")
360+
this.pum_redraw()
346361
end
347362

348363
function this.get_path_cmp_items()

0 commit comments

Comments
 (0)