Skip to content

Commit

Permalink
fix (prompt_input) limit the miximum row offset for hint text in floa…
Browse files Browse the repository at this point in the history
…ting prompt windows to the height of the window. (#904)
  • Loading branch information
brewinski authored Nov 25, 2024
1 parent 29a645a commit 4c9dd65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/avante/prompt_input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down

0 comments on commit 4c9dd65

Please sign in to comment.