Skip to content

Commit

Permalink
experimental: make view follow cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
lvimuser committed Aug 10, 2023
1 parent 44cb697 commit 7569056
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lua/cmp/view/custom_entries_view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ custom_entries_view.open = function(self, offset, entries)
height = math.min(height, #self.entries)

local pos = api.get_screen_cursor()
local cursor_before_line = api.get_cursor_before_line()
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] - 1

local border_info = window.get_border_info({ style = completion })
local border_offset_row = border_info.top + border_info.bottom
Expand Down

0 comments on commit 7569056

Please sign in to comment.