Skip to content

Commit 8f9c9d5

Browse files
committed
fix: handling unicode characters in action output
1 parent d6dc217 commit 8f9c9d5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/agent/task/tasklet.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ impl Action for TaskletAction {
201201
println!(
202202
"\n{}\n",
203203
if out.len() > self.max_shown_output {
204-
let ascii = &out[0..self.max_shown_output];
204+
let end = out
205+
.char_indices()
206+
.map(|(i, _)| i)
207+
.nth(self.max_shown_output)
208+
.unwrap();
209+
let ascii = &out[0..end];
205210
format!("{}\n{}", ascii, "<truncated>".yellow())
206211
} else {
207212
out.to_string()

0 commit comments

Comments
 (0)