From 2de40ccf49df737ee33430f5952fd7cf539fec31 Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Mon, 15 Nov 2021 14:26:50 +0900 Subject: [PATCH] Fix #520 --- lua/cmp/view/custom_entries_view.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/cmp/view/custom_entries_view.lua b/lua/cmp/view/custom_entries_view.lua index 56dd1b0..3370ae7 100644 --- a/lua/cmp/view/custom_entries_view.lua +++ b/lua/cmp/view/custom_entries_view.lua @@ -137,11 +137,11 @@ custom_entries_view.open = function(self, offset, entries) height = height == 0 and #self.entries or height height = math.min(height, #self.entries) - if (vim.o.lines - pos[1]) <= 8 and pos[1] - 8 > 0 then - height = math.min(height, pos[1] - 1) + if (vim.o.lines - pos[1]) <= height and pos[1] - height > 0 then pos[1] = pos[1] - height - 1 - else - height = math.min(height, vim.o.lines - pos[1]) + end + if (vim.o.columns - pos[2]) <= width and pos[2] - width > 0 then + pos[2] = vim.o.columns - width + 1 end if width < 1 or height < 1 then