Skip to content

Commit

Permalink
Merge branch 'master' into borderless
Browse files Browse the repository at this point in the history
  • Loading branch information
woelper authored Feb 11, 2024
2 parents 39b82ea + e58b068 commit d2ae0d7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,19 @@ pub fn info_ui(ctx: &Context, state: &mut OculanteState, gfx: &mut Graphics) {

if let Some(path) = &state.current_path {
// make sure we truncate filenames
let max_chars = 20;
let max_chars = 18;
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
let skip_symbol = if file_name.chars().count() > max_chars {".."} else {""};

ui.label_i(&format!("{} File", IMAGE_SQUARE));
ui.label(
let path_label = egui::Label::new(
RichText::new(format!(
"{skip_symbol}{}",
file_name.chars().rev().take(max_chars).collect::<String>().chars().rev().collect::<String>()
))
// .monospace(),
)
).truncate(true);

ui.add(path_label)
.on_hover_text(format!("{}", path.display()));
ui.end_row();
}
Expand Down

0 comments on commit d2ae0d7

Please sign in to comment.