We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2502d9d commit 065f251Copy full SHA for 065f251
crates/chat-cli/src/cli/chat/util/mod.rs
@@ -21,8 +21,8 @@ use super::ChatError;
21
use super::token_counter::TokenCounter;
22
23
/// Truncates text to a maximum display width.
24
-/// Takes into account the display width of characters, where CJK characters are counted as 2 units
25
-/// wide. Returns the truncated text without ellipsis.
+/// Dynamically calculate the display width of characters, where CJK characters are counted as 2
+/// units wide instead of 1.
26
pub fn truncate_safe_with_width(text: &str, max_width: usize) -> String {
27
let text_width = UnicodeWidthStr::width(text);
28
if text_width <= max_width {
0 commit comments