mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
0b9ef93da5
As discussed on https://github.com/openai/codex/commit/699ec5a87f09796d17c0202cd92a1dd4d8b4f3f5#commitcomment-156776835, to properly support scrolling long content in Ratatui for a sequence of cells, we need to: * take the `Vec<Line>` for each cell * using the wrapping logic we want to use at render time, compute the _effective line count_ using `Paragraph::line_count()` (see `wrapped_line_count_for_cell()` in this PR) * sum up the effective line count to compute the height of the area being scrolled * given a `scroll_position: usize`, index into the list of "effective lines" and accumulate the appropriate `Vec<Line>` for the cells that should be displayed * take that `Vec<Line>` to create a `Paragraph` and use the same line-wrapping policy that was used in `wrapped_line_count_for_cell()` * display the resulting `Paragraph` and use the accounting to display a scrollbar with the appropriate thumb size and offset without having to render the `Vec<Line>` for the full history With this change, lines wrap as I expect and everything appears to redraw correctly as I resize my terminal!
0b9ef93da5
ยท
2025-05-14 16:51:41 -07:00
History