mirror of
https://github.com/nushell/nushell.git
synced 2025-04-14 08:18:17 +02:00
1. Added mode to the status bar right most corner 2. Added a command name with a status when run ref #8582 cc: @fdncred
17 lines
330 B
Rust
17 lines
330 B
Rust
use nu_table::string_truncate;
|
|
|
|
pub use nu_table::string_width;
|
|
|
|
pub fn truncate_str(text: &mut String, width: usize) {
|
|
if width == 0 {
|
|
text.clear();
|
|
} else {
|
|
if string_width(text) < width {
|
|
return;
|
|
}
|
|
|
|
*text = string_truncate(text, width - 1);
|
|
text.push('…');
|
|
}
|
|
}
|