Projects STRLCPY deduplicator Commits a6511f2c
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    Cargo.lock
    skipped 315 lines
    316 316   
    317 317  [[package]]
    318 318  name = "deduplicator"
    319  -version = "0.0.8"
     319 +version = "0.0.9"
    320 320  dependencies = [
    321 321   "anyhow",
    322 322   "chrono",
    skipped 11 lines
    334 334   "thiserror",
    335 335   "tokio",
    336 336   "tui",
     337 + "unicode-segmentation",
    337 338  ]
    338 339   
    339 340  [[package]]
    skipped 883 lines
  • ■ ■ ■ ■ ■
    Cargo.toml
    1 1  [package]
    2 2  name = "deduplicator"
    3  -version = "0.0.8"
     3 +version = "0.0.9"
    4 4  edition = "2021"
    5 5  description = "find,filter,delete Duplicates"
    6 6  license = "MIT"
    skipped 18 lines
    25 25  thiserror = "1.0.38"
    26 26  tokio = { version = "1.23.0", features = ["full"] }
    27 27  tui = "0.19.0"
     28 +unicode-segmentation = "1.10.0"
    28 29   
  • ■ ■ ■ ■ ■ ■
    src/output.rs
    skipped 11 lines
    12 12  use crate::database::File;
    13 13  use crate::params::Params;
    14 14  use prettytable::{format, row, Cell, Row, Table};
     15 +use unicode_segmentation::UnicodeSegmentation;
    15 16   
    16 17  fn format_path(path: &str, opts: &Params) -> Result<String> {
    17 18   let display_path = path.replace(&opts.get_directory()?, "");
    18  - let text_vec = display_path.chars().collect::<Vec<_>>();
    19 19   
    20  - let display_range = if text_vec.len() > 32 {
    21  - text_vec[(display_path.len() - 32)..]
    22  - .iter()
    23  - .collect::<String>()
     20 + let display_range = if display_path.chars().count() > 32 {
     21 + display_path
     22 + .graphemes(true)
     23 + .collect::<Vec<&str>>()
     24 + .into_iter()
     25 + .rev()
     26 + .take(32)
     27 + .rev()
     28 + .collect()
    24 29   } else {
    25 30   display_path
    26 31   };
    skipped 140 lines
Please wait...
Page is in error, reload to recover