Skip to content

Commit d23555a

Browse files
committed
fix(tui): trim leading whitespace from chat message content
API stream tokens may include leading newlines, causing a blank line between the role label and content. Trim before iterating lines.
1 parent 18041f9 commit d23555a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • crates/oxide-code/src/tui/components

crates/oxide-code/src/tui/components/chat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl ChatView {
136136
]));
137137

138138
// Content lines (immediately after label, no blank line).
139-
for line in msg.content.lines() {
139+
for line in msg.content.trim().lines() {
140140
lines.push(Line::from(vec![
141141
Span::raw(" "),
142142
Span::styled(line, self.theme.text()),
@@ -153,7 +153,7 @@ impl ChatView {
153153
Span::raw(" "),
154154
Span::styled("⟡ Assistant", self.theme.secondary()),
155155
]));
156-
for line in self.streaming_buffer.lines() {
156+
for line in self.streaming_buffer.trim().lines() {
157157
lines.push(Line::from(vec![
158158
Span::raw(" "),
159159
Span::styled(line, self.theme.text()),

0 commit comments

Comments
 (0)