diff options
| author | sigoden <sigoden@gmail.com> | 2024-02-25 20:09:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-25 20:09:40 +0800 |
| commit | c773e8d2e1e737fdda2f7bfe8e97c0411a1ba172 (patch) | |
| tree | 2ca04eae4752e368814d9f5d7c38c3617ba7fbb5 /src/config/input.rs | |
| parent | a3fbf71c1c1a1bba27d8a546e63ae54605e1fadc (diff) | |
| download | aichat-c773e8d2e1e737fdda2f7bfe8e97c0411a1ba172.tar.gz | |
refactor: improve saving messages (#322)
Diffstat (limited to 'src/config/input.rs')
| -rw-r--r-- | src/config/input.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/config/input.rs b/src/config/input.rs index 6fa1b1c..cb3cdf2 100644 --- a/src/config/input.rs +++ b/src/config/input.rs @@ -80,7 +80,12 @@ impl Input { } pub fn summary(&self) -> String { - let text = &self.text; + let text: String = self + .text + .trim() + .chars() + .map(|c| if c.is_control() { ' ' } else { c }) + .collect(); if text.width_cjk() > 70 { let mut sum_width = 0; let mut chars = vec![]; @@ -94,7 +99,7 @@ impl Input { } chars.into_iter().collect() } else { - text.clone() + text } } |
