wrap user message

This commit is contained in:
Jeremy Rose
2025-08-04 15:44:12 -07:00
parent 2576fadc74
commit 318c78ca3c

View File

@@ -29,6 +29,7 @@ use std::collections::HashMap;
use std::io::Cursor;
use std::path::PathBuf;
use std::time::Duration;
use textwrap::Options;
use tracing::error;
pub(crate) struct CommandOutput {
@@ -223,7 +224,15 @@ impl HistoryCell {
pub(crate) fn new_user_prompt(message: String) -> Self {
let mut lines: Vec<Line<'static>> = Vec::new();
lines.push(Line::from("user".cyan().bold()));
lines.extend(message.lines().map(|l| Line::from(l.to_string())));
let width = 80;
lines.extend(
textwrap::wrap(
&message,
Options::new(width).wrap_algorithm(textwrap::WrapAlgorithm::FirstFit),
)
.iter()
.map(|l| Line::from(l.to_string())),
);
lines.push(Line::from(""));
HistoryCell::UserPrompt {