fix(custom_entries_view): offset is also the number of bytes (#1288)

This commit is contained in:
NAKAI Tsuyoshi
2022-11-10 09:26:26 +09:00
committed by GitHub
parent bdfadc1238
commit 16ec8c6b12

View File

@@ -153,9 +153,8 @@ custom_entries_view.open = function(self, offset, entries)
height = math.min(height, #self.entries) height = math.min(height, #self.entries)
local pos = api.get_screen_cursor() local pos = api.get_screen_cursor()
local cursor = api.get_cursor()
local cursor_before_line = api.get_cursor_before_line() local cursor_before_line = api.get_cursor_before_line()
local delta = vim.fn.strdisplaywidth(cursor_before_line:sub(-cursor[2])) + 1 - self.offset local delta = vim.fn.strdisplaywidth(cursor_before_line:sub(self.offset))
local row, col = pos[1], pos[2] - delta - 1 local row, col = pos[1], pos[2] - delta - 1
local border_info = window.get_border_info({ style = completion }) local border_info = window.get_border_info({ style = completion })