Skip to content

Commit c7dbbed

Browse files
committed
bugfix
1 parent 626d3cb commit c7dbbed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/easycomplete/cmdline.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,12 @@ end
551551
-- 根据某个正则表达式是否匹配,来调用既定的get_cmp_items,并执行complete()
552552
function this.cmp_regex_handler(get_cmp_items, word)
553553
local should_redraw = false
554+
-- 光标所在行的 tab 的数量会影响 pum 的位置,感觉应该是 nvim 的bug
554555
local start_col = vim.fn.getcmdpos()
555556
- this.calculate_sign_and_linenr_width()
556557
- #word
557558
- this.window_offset_horizontal()
559+
- this.tabs_number() * (vim.bo.tabstop - 1)
558560
cmdline_start_cmdpos = vim.fn.getcmdpos() - #word
559561
local ok, menu_items = pcall(get_cmp_items)
560562
if not ok then
@@ -566,8 +568,6 @@ function this.cmp_regex_handler(get_cmp_items, word)
566568
this.pum_close()
567569
else
568570
should_redraw = true
569-
-- 光标所在行的 tab 的数量会影响 pum 的位置,感觉应该是 nvim 的bug
570-
start_col = start_col - this.tabs_number() * (vim.bo.tabstop - 1)
571571
this.pum_complete(start_col, this.normalize_list(menu_items, word))
572572
end
573573
return should_redraw

0 commit comments

Comments
 (0)