mirror of
https://github.com/openai/codex.git
synced 2026-11-22 07:13:50 +00:00
Fix skills picker scrolling in tui app server (#16109)
Fixes #16091. The app-server TUI was truncating the filtered mention candidate list to `MAX_POPUP_ROWS`, so the `$` skills picker only exposed the first 8 matches. That made it look like many skills were missing and prevented keyboard navigation beyond the first page, even though direct `$skill-name` insertion still worked. Testing: I manually verified the regression and confirmed the fix.
This commit is contained in:
1 parent
f7ef9599ed
commit
46b653e73c
2 files changed
+65
-3
No files matched your search
@@ -180,7 +180,6 @@ impl SkillPopup {
|
||||
})
|
||||
});
|
||||
|
||||
out.truncate(MAX_POPUP_ROWS);
|
||||
out
|
||||
}
|
||||
}
|
||||
@@ -235,6 +234,8 @@ fn skill_popup_hint_line() -> Line<'static> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
fn mention_item(index: usize) -> MentionItem {
|
||||
MentionItem {
|
||||
@@ -249,7 +250,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filtered_mentions_are_capped_to_max_popup_rows() {
|
||||
fn filtered_mentions_preserve_results_beyond_popup_height() {
|
||||
let popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||
|
||||
let filtered_names: Vec<String> = popup
|
||||
@@ -260,7 +261,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
filtered_names,
|
||||
(0..MAX_POPUP_ROWS)
|
||||
(0..(MAX_POPUP_ROWS + 2))
|
||||
.map(|idx| format!("Mention {idx:02}"))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
@@ -269,4 +270,22 @@ mod tests {
|
||||
(MAX_POPUP_ROWS as u16) + 2
|
||||
);
|
||||
}
|
||||
|
||||
fn render_popup(popup: &SkillPopup, width: u16) -> String {
|
||||
let area = Rect::new(0, 0, width, popup.calculate_required_height(width));
|
||||
let mut buf = Buffer::empty(area);
|
||||
popup.render_ref(area, &mut buf);
|
||||
format!("{buf:?}")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scrolling_mentions_shifts_rendered_window_snapshot() {
|
||||
let mut popup = SkillPopup::new((0..(MAX_POPUP_ROWS + 2)).map(mention_item).collect());
|
||||
|
||||
for _ in 0..=MAX_POPUP_ROWS {
|
||||
popup.move_down();
|
||||
}
|
||||
|
||||
insta::assert_snapshot!("skill_popup_scrolled", render_popup(&popup, /*width*/ 72));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user