Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented May 28, 2025

The motivation behind this PR is to make it so a HistoryCell is more like a WidgetRef that knows how to render itself into a Rect so that it can be backed by something other than a Vec<Line>. Because a HistoryCell is intended to appear in a scrollable list, we want to ensure the stack of cells can be scrolled one Line at a time even if the HistoryCell is not backed by a Vec<Line> itself.

To this end, we introduce the CellWidget trait whose key method is:

fn render_window(&self, first_visible_line: usize, area: Rect, buf: &mut Buffer);

The first_visible_line param is what differs from WidgetRef::render_ref(), as a CellWidget needs to know the offset into its "full view" at which it should start rendering.

The bookkeeping in ConversationHistoryWidget has been updated accordingly to ensure each CellWidget in the history is rendered appropriately.

@bolinfest bolinfest merged commit ae1a83f into main May 28, 2025
9 checks passed
@bolinfest bolinfest deleted the pr1148 branch May 28, 2025 21:03
@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants