mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
Honor pager bindings for transcript page keys (#50396)
## Why Transcript scrolling hardcoded `PageUp` and `PageDown` to full-page movement, ignoring customized pager bindings. ## What changed Resolve unmodified `PageUp` and `PageDown` through the pager's scroll bindings so they can scroll by a full page, half a page, or one row, or remain unbound. Preserve the one-row overlap for full-page scrolling and leave pager typing shortcuts unhandled by the transcript. ## Testing Add a regression test and snapshot covering default, half-page, single-row, and unbound configurations. Verify that `PageDown` reverses `PageUp` scrolling and that `j` and `Ctrl+u` remain unhandled. GitOrigin-RevId: 945e99d7370f84f326ab71037be2924dddada32c
This commit is contained in:
committed by
copyberry
parent
f88a6efe43
commit
d61c7a824f
@@ -343,17 +343,24 @@ impl TranscriptView {
|
||||
) -> Option<ViewAction> {
|
||||
let jump = JumpTarget::from_key(key);
|
||||
match (key.code, key.modifiers) {
|
||||
(KeyCode::PageUp, KeyModifiers::NONE) => {
|
||||
self.scroll(
|
||||
cells,
|
||||
-(self.area.height.saturating_sub(/*rhs*/ 1).max(/*other*/ 1) as isize),
|
||||
);
|
||||
}
|
||||
(KeyCode::PageDown, KeyModifiers::NONE) => {
|
||||
self.scroll(
|
||||
cells,
|
||||
self.area.height.saturating_sub(/*rhs*/ 1).max(/*other*/ 1) as isize,
|
||||
);
|
||||
(KeyCode::PageUp | KeyCode::PageDown, KeyModifiers::NONE) => {
|
||||
// Share page-key configuration without taking the pager's typing shortcuts.
|
||||
// Full pages retain the main view's existing one-row overlap.
|
||||
let keymap = &self.disclosure.keymap.pager;
|
||||
let height = self.area.height.max(/*other*/ 1) as isize;
|
||||
let page = (height - 1).max(/*other*/ 1);
|
||||
let half = (height + 1) / 2;
|
||||
let delta = [
|
||||
(&keymap.scroll_up, -1),
|
||||
(&keymap.scroll_down, 1),
|
||||
(&keymap.page_up, -page),
|
||||
(&keymap.page_down, page),
|
||||
(&keymap.half_page_up, -half),
|
||||
(&keymap.half_page_down, half),
|
||||
]
|
||||
.into_iter()
|
||||
.find_map(|(bindings, delta)| bindings.is_pressed(key).then_some(delta))?;
|
||||
self.scroll(cells, delta);
|
||||
}
|
||||
(KeyCode::Esc, KeyModifiers::NONE) if self.can_return_to_latest() => {
|
||||
self.jump_to_latest();
|
||||
|
||||
Reference in New Issue
Block a user