From 6790f0a853ec20b98ee7feef59b4f267ca0d6f86 Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Sun, 10 Oct 2021 23:49:24 +0900 Subject: [PATCH] Fix #320 --- lua/cmp/view/custom_entries_view.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/cmp/view/custom_entries_view.lua b/lua/cmp/view/custom_entries_view.lua index 54f68da..4b70a9d 100644 --- a/lua/cmp/view/custom_entries_view.lua +++ b/lua/cmp/view/custom_entries_view.lua @@ -128,15 +128,15 @@ custom_entries_view.open = function(self, offset, entries) width = width + self.column_width.menu + 1 local cursor = vim.api.nvim_win_get_cursor(0) - local row = vim.fn.screenpos('.', cursor[1], cursor[2] + 1).row + local pos = vim.fn.screenpos('.', cursor[1], cursor[2] + 1) local height = vim.api.nvim_get_option('pumheight') height = height == 0 and #self.entries or height height = math.min(height, #self.entries) - if (vim.o.lines - row) <= 8 and row - 8 > 0 then - height = math.min(height, row - 1) - row = row - height - 1 + if (vim.o.lines - pos.row) <= 8 and pos.row - 8 > 0 then + height = math.min(height, pos.row - 1) + pos.row = pos.row - height - 1 else - height = math.min(height, vim.o.lines - row) + height = math.min(height, vim.o.lines - pos.row) end if width < 1 or height < 1 then @@ -148,8 +148,8 @@ custom_entries_view.open = function(self, offset, entries) self.entries_win:open({ relative = 'editor', style = 'minimal', - row = row, - col = vim.fn.screencol() - 1 - delta - 1, + row = pos.row, + col = pos.col - 1 - delta - 1, width = width, height = height, zindex = 1001,