@@ -385,19 +385,36 @@ end
385
385
function Popup :update_layout (config )
386
386
config = config or {}
387
387
388
+ local old_row = self .win_config .row
389
+ local old_col = self .win_config .col
390
+
388
391
u .update_layout_config (self ._ , config )
389
392
390
393
self .border :_relayout ()
391
394
392
395
self ._ .layout_ready = true
393
396
394
397
if self .winid then
395
- -- upstream issue: https://github.com/neovim/neovim/issues/20370
396
- local win_config_style = self .win_config .style
397
- --- @diagnostic disable-next-line : assign-type-mismatch
398
- self .win_config .style = " "
399
- vim .api .nvim_win_set_config (self .winid , self .win_config )
400
- self .win_config .style = win_config_style
398
+ if
399
+ config .size ~= nil
400
+ and vim .tbl_count (config ) == 1
401
+ and old_row == self .win_config .row
402
+ and old_col == self .win_config .col
403
+ then
404
+ -- Only size got updated, so let's not reposition the popup
405
+ vim .api .nvim_win_set_config (self .winid , {
406
+ style = " " , -- https://github.com/neovim/neovim/issues/20370
407
+ width = self .win_config .width ,
408
+ height = self .win_config .height ,
409
+ })
410
+ else
411
+ -- upstream issue: https://github.com/neovim/neovim/issues/20370
412
+ local win_config_style = self .win_config .style
413
+ --- @diagnostic disable-next-line : assign-type-mismatch
414
+ self .win_config .style = " "
415
+ vim .api .nvim_win_set_config (self .winid , self .win_config )
416
+ self .win_config .style = win_config_style
417
+ end
401
418
end
402
419
end
403
420
0 commit comments