From 89df2cb22384f6a0f48695b3b8adbcd069e87036 Mon Sep 17 00:00:00 2001 From: gravndal Date: Sun, 24 Jul 2022 05:19:21 +0200 Subject: [PATCH] Fix native_entries_view.info width and col calculations (#1075) The dictionary returned by `pum_getpos()` uses `scrollbar` not `scrollable` to indicate whether the scrollbar is visible or not. In addition, the padding on the left side of the popup menu isn't included in the output of `pum_getpos()`, meaning that both `col` and `width` (as understood by nvim-cmp) are off by one when the cursor isn't at column `0`. These two issues were causing the documentation window and popup menu to overlap. --- lua/cmp/view/native_entries_view.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/cmp/view/native_entries_view.lua b/lua/cmp/view/native_entries_view.lua index d8b0b1b..0f5fc00 100644 --- a/lua/cmp/view/native_entries_view.lua +++ b/lua/cmp/view/native_entries_view.lua @@ -101,10 +101,10 @@ native_entries_view.info = function(self) if self:visible() then local info = vim.fn.pum_getpos() return { - width = info.width + (info.scrollable and 1 or 0), + width = info.width + (info.scrollbar and 1 or 0) + (info.col == 0 and 0 or 1), height = info.height, row = info.row, - col = info.col, + col = info.col == 0 and 0 or info.col - 1, } end end