restore markdown formatting
This commit is contained in:
parent
8971e6841b
commit
dcf9dadb1c
1 changed files with 30 additions and 4 deletions
|
|
@ -279,6 +279,24 @@ impl PaneState {
|
||||||
self.push_line_with_marker(line, color, Marker::None);
|
self.push_line_with_marker(line, color, Marker::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn append_text(&mut self, text: &str) {
|
||||||
|
let clean = strip_ansi(text);
|
||||||
|
if self.use_markdown {
|
||||||
|
self.md_buffer.push_str(&clean);
|
||||||
|
} else {
|
||||||
|
for ch in clean.chars() {
|
||||||
|
if ch == '\n' {
|
||||||
|
let line = std::mem::take(&mut self.current_line);
|
||||||
|
self.lines.push(Line::styled(line, Style::default().fg(self.current_color)));
|
||||||
|
self.markers.push(Marker::None);
|
||||||
|
self.evict();
|
||||||
|
} else {
|
||||||
|
self.current_line.push(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn push_line_with_marker(&mut self, line: String, color: Color, marker: Marker) {
|
fn push_line_with_marker(&mut self, line: String, color: Color, marker: Marker) {
|
||||||
self.flush_pending();
|
self.flush_pending();
|
||||||
self.lines.push(Line::styled(strip_ansi(&line), Style::default().fg(color)));
|
self.lines.push(Line::styled(strip_ansi(&line), Style::default().fg(color)));
|
||||||
|
|
@ -482,10 +500,18 @@ impl InteractScreen {
|
||||||
for entry in entries.iter().skip(start) {
|
for entry in entries.iter().skip(start) {
|
||||||
for (target, text, marker) in Self::route_entry(entry) {
|
for (target, text, marker) in Self::route_entry(entry) {
|
||||||
match target {
|
match target {
|
||||||
PaneTarget::Conversation =>
|
PaneTarget::Conversation => {
|
||||||
self.conversation.push_line_with_marker(text, Color::Cyan, marker),
|
self.conversation.current_color = Color::Cyan;
|
||||||
PaneTarget::ConversationAssistant =>
|
self.conversation.append_text(&text);
|
||||||
self.conversation.push_line_with_marker(text, Color::Reset, marker),
|
self.conversation.pending_marker = marker;
|
||||||
|
self.conversation.flush_pending();
|
||||||
|
},
|
||||||
|
PaneTarget::ConversationAssistant => {
|
||||||
|
self.conversation.current_color = Color::Reset;
|
||||||
|
self.conversation.append_text(&text);
|
||||||
|
self.conversation.pending_marker = marker;
|
||||||
|
self.conversation.flush_pending();
|
||||||
|
},
|
||||||
PaneTarget::Tools =>
|
PaneTarget::Tools =>
|
||||||
self.tools.push_line(text, Color::Yellow),
|
self.tools.push_line(text, Color::Yellow),
|
||||||
PaneTarget::ToolResult => {
|
PaneTarget::ToolResult => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue