From 9ee63da142121a57e5fe478ecb3aee822d5d003e Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Wed, 22 Jul 2026 15:23:55 +0000 Subject: [PATCH] Size unified mention popups to visible results (#34771) ## What changed - Size the unified mention popup from its filtered row count, while keeping a one-row minimum and the existing maximum. - Update composer snapshots to cover the compact layout when only one mention result is visible. GitOrigin-RevId: 7cd30a5c53c7e81cf7158a6b3dda3c09bd024f29 --- codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs | 3 ++- ...chat_composer__tests__default_unified_mention_popup.snap | 6 +++--- ...mention_popup_falls_back_from_bound_plugin_on_right.snap | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs b/codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs index 4626cebfd0..84c56b39a8 100644 --- a/codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs +++ b/codex-rs/tui/src/bottom_pane/mentions_v2/popup.rs @@ -76,7 +76,8 @@ impl Popup { } pub(crate) fn calculate_required_height(&self, _width: u16) -> u16 { - (MAX_POPUP_ROWS as u16).saturating_add(2) + let visible = self.rows().len().clamp(1, MAX_POPUP_ROWS); + (visible as u16).saturating_add(2) } fn clamp_selection(&mut self) { diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap index bf21e4ea61..ced677b639 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__default_unified_mention_popup.snap @@ -5,9 +5,9 @@ expression: terminal.backend() " " "› @sa " " " +" " +" " +" " "> Sample Plugin Plugin with skills and an MCP server Plugin" " " -" " -" " -" " " enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins " diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__unified_mention_popup_falls_back_from_bound_plugin_on_right.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__unified_mention_popup_falls_back_from_bound_plugin_on_right.snap index 6bd3a5ba46..35bff9abb2 100644 --- a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__unified_mention_popup_falls_back_from_bound_plugin_on_right.snap +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__chat_composer__tests__unified_mention_popup_falls_back_from_bound_plugin_on_right.snap @@ -5,9 +5,9 @@ expression: terminal.backend() " " "› @left @bound " " " +" " +" " +" " "> left Plugin used to test bound mention fallback. Plugin" " " -" " -" " -" " " enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins "