nu-explore 0.112.2

Nushell table pager
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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('');
    }
}