Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Size unified mention popups to visible results (#34771)

Eric Traut9ee63da14212
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"
" "
" "
" "
+"> 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"
" "
" "
" "
+"> left Plugin used to test bound mention fallback. Plugin"
" "
" enter insert · esc close · ←/→ switch search modes [All Results] Filesystem Only Plugins "