diff --git a/src/popup_menu/mod.rs b/src/popup_menu/mod.rs index 34d05d8..9fda9f3 100644 --- a/src/popup_menu/mod.rs +++ b/src/popup_menu/mod.rs @@ -407,6 +407,13 @@ impl PopupMenu { (x as f64, y as f64, w as f64, h as f64) ); + // Double check that we're not sending it bogus coordinates, nvim will get very + // upset if we do + if w <= 0.0 || h <= 0.0 { + debug!("popupmenu bounds are bogus ({w}x{h}), ignoring"); + return; + } + if x < 0.0 { w += x; x = 0.0;