Skip to content

Commit 57370c7

Browse files
committed
fix(tui): compute user spans from final inserted lines
1 parent 42f66a5 commit 57370c7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codex-rs/tui/src/app.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,17 @@ impl App {
184184
}
185185
AppEvent::InsertHistoryCell(cell) => {
186186
let mut cell_transcript = cell.transcript_lines();
187+
let mut prepend_line_count = 0;
187188
if !cell.is_stream_continuation() && !self.transcript_lines.is_empty() {
188189
cell_transcript.insert(0, Line::from(""));
190+
prepend_line_count += 1;
189191
}
190192
if let Some(Overlay::Transcript(t)) = &mut self.overlay {
191193
t.insert_lines(cell_transcript.clone());
192194
tui.frame_requester().schedule_frame();
193195
}
194196
// Compute absolute indices before extending transcript
195-
let start = self.transcript_lines.len();
197+
let start = self.transcript_lines.len() + prepend_line_count;
196198
if let Some(span) = cell.message_span()
197199
&& matches!(cell.kind(), crate::history_cell::MessageKind::User)
198200
{

0 commit comments

Comments
 (0)