mirror of
https://github.com/openai/codex.git
synced 2026-11-13 22:47:20 +00:00
feat(tui2): transcript scrollbar (auto-hide + drag) (#8728)
## Summary - Add a transcript scrollbar in `tui2` using `tui-scrollbar`. - Reserve 2 columns on the right (1 empty gap + 1 scrollbar track) and plumb the reduced width through wrapping/selection/copy so rendering and interactions match. - Auto-hide the scrollbar when the transcript is pinned to the bottom (columns remain reserved). - Add mouse click/drag support for the scrollbar, with pointer-capture so drags don’t fall through into transcript selection. - Skip scrollbar hit-testing when auto-hidden to avoid an invisible interactive region. ## Notes - Styling is theme-aware: in light themes the thumb is darker than the track; in dark themes it reads as an “indented” element without going full-white. - Pre-Ratatui 0.30 (ratatui-core split) requires a small scratch-buffer bridge; this should simplify once we move to Ratatui 0.30. ## Testing - `just fmt` - `just fix -p codex-tui2 --allow-no-vcs` - `cargo test -p codex-tui2`
This commit is contained in:
1 parent
468ee8a75c
commit
8f10d3bf05
8 files changed
+921
-9
No files matched your search
@@ -17,8 +17,10 @@ use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::history_cell::HistoryCell;
|
||||
use crate::transcript_scrollbar::split_transcript_area;
|
||||
use crate::transcript_selection::TranscriptSelection;
|
||||
use crate::tui;
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
/// User-visible feedback shown briefly after a copy attempt.
|
||||
///
|
||||
@@ -162,10 +164,18 @@ pub(crate) fn copy_transcript_selection(
|
||||
return CopySelectionOutcome::NoSelection;
|
||||
}
|
||||
|
||||
let transcript_full_area = Rect {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width,
|
||||
height: transcript_height,
|
||||
};
|
||||
let (transcript_area, _) = split_transcript_area(transcript_full_area);
|
||||
|
||||
let Some(text) = crate::transcript_copy::selection_to_copy_text_for_cells(
|
||||
transcript_cells,
|
||||
transcript_selection,
|
||||
width,
|
||||
transcript_area.width,
|
||||
) else {
|
||||
return CopySelectionOutcome::NoSelection;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user