@@ -4,21 +4,38 @@ local console = util.console
44local cmdline_start_cmdpos = 0
55local old_cmdline = " "
66local pum_noselect = vim .g .easycomplete_pum_noselect
7- local lazyredraw = vim .o .lazyredraw
87local this = {}
98
109function 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 )
1412end
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+
1626function 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
2239end
2340
2441function 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 ()
217232end
218233
219234function 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 ( )
346361end
347362
348363function this .get_path_cmp_items ()
0 commit comments