From 4c9dd65600b4ca7a2680d67556b47cef94fa11dc Mon Sep 17 00:00:00 2001 From: Christopher Brewin Date: Mon, 25 Nov 2024 22:24:59 +1000 Subject: [PATCH] fix (prompt_input) limit the miximum row offset for hint text in floating prompt windows to the height of the window. (#904) --- lua/avante/prompt_input.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/avante/prompt_input.lua b/lua/avante/prompt_input.lua index 06b2f64..bd07178 100644 --- a/lua/avante/prompt_input.lua +++ b/lua/avante/prompt_input.lua @@ -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 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 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, width = width, height = 1, - row = buf_height, + row = math.min(buf_height, win_height), col = math.max(win_width - width, 0), style = "minimal", border = "none",