@@ -38,8 +38,14 @@ local function get_winbar_height(windows)
3838 return 0
3939end
4040
41+ local dynamic_height_enabled = config .ui .input .min_height ~= config .ui .input .max_height
42+
43+ --- @return integer
4144local function calculate_height (windows )
4245 local total_height = vim .api .nvim_get_option_value (' lines' , {})
46+ if not dynamic_height_enabled then
47+ return math.floor (total_height * config .ui .input .min_height )
48+ end
4349 local min_height = math.max (1 , math.floor (total_height * config .ui .input .min_height ))
4450 local max_height = math.max (min_height , math.floor (total_height * config .ui .input .max_height ))
4551 local content_height = get_content_height (windows ) + get_winbar_height (windows )
@@ -274,7 +280,6 @@ function M.setup(windows)
274280 if config .ui .position ~= ' current' then
275281 set_win_option (' winfixbuf' , true , windows )
276282 end
277- set_win_option (' winfixheight' , true , windows )
278283 set_win_option (' winfixwidth' , true , windows )
279284
280285 M .update_dimensions (windows )
@@ -295,18 +300,21 @@ function M.update_dimensions(windows)
295300end
296301
297302function M .schedule_resize (windows )
303+ if not dynamic_height_enabled then
304+ return
305+ end
298306 windows = windows or state .windows
299307 if not M .mounted (windows ) or M ._resize_scheduled then
300308 return
301309 end
302310
303311 M ._resize_scheduled = true
304- vim .schedule (function ()
312+ vim .defer_fn (function ()
305313 M ._resize_scheduled = false
306314 if M .mounted (windows ) then
307315 M .update_dimensions (windows )
308316 end
309- end )
317+ end , 1000 / 60 ) -- debounce to 60 FPS
310318end
311319
312320function M .refresh_placeholder (windows , input_lines )
0 commit comments