Skip to content

Commit 512f0fa

Browse files
authored
Merge pull request #19 from ellie/ellie/resize
feat: resize the viewport on resize
2 parents 68540b4 + 54df88d commit 512f0fa

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/app.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,11 @@ impl App {
580580
self.input.set_content(&completed);
581581
}
582582
},
583-
Action::Resize(_w, _h) => {
584-
// TODO trigger redraw with new dimensions
585-
return ActionResult::NoOp;
583+
Action::Resize(w, _h) => {
584+
// Update chat view width for text wrapping
585+
self.chat.set_width(w);
586+
// Re-render and draw with new dimensions
587+
self.chat.render(&mut self.terminal);
586588
},
587589
}
588590

src/ui/chat.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ impl ChatView {
113113
self.transcript.add_turn(role, block)
114114
}
115115

116+
/// Update the terminal width (e.g., on resize)
117+
pub fn set_width(&mut self, width: u16) {
118+
self.width = width;
119+
}
120+
116121
/// Replace the transcript and reset view state (used after compaction rotation)
117122
/// Renders the new transcript fully to scrollback
118123
pub fn reset_transcript(

0 commit comments

Comments
 (0)