fpv 0.1.12

A minimal, keyboard-first TUI file previewer with syntax highlighting
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub const METADATA_FALLBACK: &str = "-";

pub fn truncate_for_status(input: &str, max_chars: usize) -> String {
    if max_chars == 0 {
        return String::new();
    }
    let chars: Vec<char> = input.chars().collect();
    if chars.len() <= max_chars {
        return input.to_string();
    }
    if max_chars == 1 {
        return "".to_string();
    }
    let keep = max_chars - 1;
    let head: String = chars.into_iter().take(keep).collect();
    format!("{head}")
}