Summary
The TUI slash-command popup keeps its previous selection and scroll state when the typed slash-command filter changes. If the user first scrolls the full / command list, then types a prefix such as /s or /st, the filtered list can start from the stale scroll position and highlight the wrong command.
This is visible in Codex rust-v0.135.0.
Reproduction
- Start the TUI.
- Type
/ to open the slash-command popup.
- Press Down repeatedly until the popup scrolls away from the top of the command list.
- Type
s or st.
Expected behavior
Changing the filter text should reset the popup selection/viewport to the first filtered match. For example, /st should select /status.
Actual behavior
The popup preserves the old selected index and scroll position, then clamps that stale index into the new filtered result set. Depending on where the unfiltered list had been scrolled, /s can show only a lower match such as /subagents, and /st can highlight /stop instead of /status.
Likely cause
CommandPopup::on_composer_text_change() updates command_filter, then calls ScrollState::clamp_selection() and ensure_visible(). That preserves the previous selected index and scroll state across a new filter token instead of treating the filtered result set as a fresh list.
Relevant area:
codex-rs/tui/src/bottom_pane/command_popup.rs
CommandPopup::on_composer_text_change()
ScrollState::{clamp_selection, ensure_visible}
Proof-of-concept fix
I tested a small patch that resets the popup ScrollState only when the slash filter token changes, preserving normal arrow navigation when the filter is unchanged.
Public fork branch:
https://github.com/cauldron26/codex/tree/codex/fix-slash-command-filter-scroll
Commit:
cauldron26@d271558
Validation
cargo test -p codex-tui bottom_pane::command_popup::tests::changing_filter_resets_selection_after_scrolling --lib
cargo test -p codex-tui bottom_pane::command_popup::tests --lib
cargo fmt --package codex-tui
git diff --check
The focused command-popup test group passed locally.
Summary
The TUI slash-command popup keeps its previous selection and scroll state when the typed slash-command filter changes. If the user first scrolls the full
/command list, then types a prefix such as/sor/st, the filtered list can start from the stale scroll position and highlight the wrong command.This is visible in Codex
rust-v0.135.0.Reproduction
/to open the slash-command popup.sorst.Expected behavior
Changing the filter text should reset the popup selection/viewport to the first filtered match. For example,
/stshould select/status.Actual behavior
The popup preserves the old selected index and scroll position, then clamps that stale index into the new filtered result set. Depending on where the unfiltered list had been scrolled,
/scan show only a lower match such as/subagents, and/stcan highlight/stopinstead of/status.Likely cause
CommandPopup::on_composer_text_change()updatescommand_filter, then callsScrollState::clamp_selection()andensure_visible(). That preserves the previous selected index and scroll state across a new filter token instead of treating the filtered result set as a fresh list.Relevant area:
codex-rs/tui/src/bottom_pane/command_popup.rsCommandPopup::on_composer_text_change()ScrollState::{clamp_selection, ensure_visible}Proof-of-concept fix
I tested a small patch that resets the popup
ScrollStateonly when the slash filter token changes, preserving normal arrow navigation when the filter is unchanged.Public fork branch:
https://github.com/cauldron26/codex/tree/codex/fix-slash-command-filter-scroll
Commit:
cauldron26@d271558
Validation
The focused command-popup test group passed locally.