fix (prompt_input) limit the miximum row offset for hint text in floating prompt windows to the height of the window. (#904)

This commit is contained in:
Christopher Brewin 2024-11-25 22:24:59 +10:00 committed by GitHub
parent 29a645a39e
commit 4c9dd65600
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,6 +157,7 @@ function PromptInput:show_shortcuts_hints()
if not self.winid or not api.nvim_win_is_valid(self.winid) then return end if not self.winid or not api.nvim_win_is_valid(self.winid) then return end
local win_width = api.nvim_win_get_width(self.winid) local win_width = api.nvim_win_get_width(self.winid)
local win_height = api.nvim_win_get_height(self.winid)
local buf_height = api.nvim_buf_line_count(self.bufnr) local buf_height = api.nvim_buf_line_count(self.bufnr)
local hint_text = (vim.fn.mode() ~= "i" and Config.mappings.submit.normal or Config.mappings.submit.insert) local hint_text = (vim.fn.mode() ~= "i" and Config.mappings.submit.normal or Config.mappings.submit.insert)
@ -180,7 +181,7 @@ function PromptInput:show_shortcuts_hints()
win = self.winid, win = self.winid,
width = width, width = width,
height = 1, height = 1,
row = buf_height, row = math.min(buf_height, win_height),
col = math.max(win_width - width, 0), col = math.max(win_width - width, 0),
style = "minimal", style = "minimal",
border = "none", border = "none",