diff --git a/docs/UPSTREAM_TRIAGE.md b/docs/UPSTREAM_TRIAGE.md index 3618ca68..351153e8 100644 --- a/docs/UPSTREAM_TRIAGE.md +++ b/docs/UPSTREAM_TRIAGE.md @@ -126,6 +126,7 @@ Work an unread upstream report in this order: | [#1002](https://github.com/eza-community/eza/issues/1002), [#745](https://github.com/eza-community/eza/issues/745) | High stat overhead on empty directory glyph probing over FUSE/NFS. `LEZ_NO_EMPTY_DIR_ICON` avoids probing. | | [#1732](https://github.com/eza-community/eza/issues/1732) | `--size-digits=` (alias `--digits`) and `LEZ_SIZE_DIGITS` added to customize size column precision/digit count. | | [#728](https://github.com/eza-community/eza/issues/728), [#730](https://github.com/eza-community/eza/pull/730), [#1791](https://github.com/eza-community/eza/pull/1791) | Cohesive full-path quoting (`'/path/with spaces/file.txt'`) and configurable quote styling via `qu` code in `LEZ_COLORS` & `theme.yml`. | +| [#1940](https://github.com/eza-community/eza/issues/1940), [#1943](https://github.com/eza-community/eza/pull/1943) | Four `FILENAME_ICONS` entries (`.atom`, `.idea`, `.rvm`, `.zsh_sessions`) unreachable because names are directories. Moved to `DIRECTORY_ICONS`. | ### Reproduced but Still Open / By Design diff --git a/src/output/icons.rs b/src/output/icons.rs index c6bf71ec..c9d28c76 100644 --- a/src/output/icons.rs +++ b/src/output/icons.rs @@ -189,14 +189,18 @@ impl Icons { /// Mapping from full filenames to directory icon. This mapping should contain /// all the directories that have a custom icon. const DIRECTORY_ICONS: Map<&'static str, char> = phf_map! { + ".atom" => '\u{e764}', //  ".config" => Icons::FOLDER_CONFIG, //  ".exercism" => Icons::FOLDER_EXERCISM, //  ".git" => Icons::FOLDER_GIT, //  ".github" => Icons::FOLDER_GITHUB, //  + ".idea" => Icons::INTELLIJ, //  ".npm" => Icons::FOLDER_NPM, //  ".opam" => Icons::FOLDER_OCAML, //  + ".rvm" => Icons::LANG_RUBY, //  ".ssh" => Icons::FOLDER_KEY, // 󰢬 ".Trash" => Icons::FOLDER_TRASH, //  + ".zsh_sessions" => Icons::SHELL, // 󱆃 "build" => Icons::FOLDER_BUILD, // 󱧼 "config" => Icons::FOLDER_CONFIG, //  "Contacts" => Icons::FOLDER_CONTACTS, // 󰉌 @@ -236,7 +240,6 @@ const DIRECTORY_ICONS: Map<&'static str, char> = phf_map! { /// all the "dot" files that have a custom icon. const FILENAME_ICONS: Map<&'static str, char> = phf_map! { ".aliases" => Icons::SHELL, // 󱆃 - ".atom" => '\u{e764}', //  ".bashrc" => Icons::SHELL, // 󱆃 ".bash_aliases" => Icons::SHELL, // 󱆃 ".bash_history" => Icons::SHELL, // 󱆃 @@ -271,7 +274,6 @@ const FILENAME_ICONS: Map<&'static str, char> = phf_map! { ".gvimrc" => Icons::VIM, //  ".htaccess" => Icons::CONFIG, // 󱁻 ".htpasswd" => Icons::CONFIG, // 󱁻 - ".idea" => Icons::INTELLIJ, //  ".ideavimrc" => Icons::VIM, //  ".inputrc" => Icons::CONFIG, // 󱁻 ".kshrc" => Icons::SHELL, // 󱆃 @@ -299,7 +301,6 @@ const FILENAME_ICONS: Map<&'static str, char> = phf_map! { ".pylintrc" => Icons::CONFIG, // 󱁻 ".python_history" => Icons::LANG_PYTHON, //  ".rustfmt.toml" => Icons::LANG_RUST, //  - ".rvm" => Icons::LANG_RUBY, //  ".rvmrc" => Icons::LANG_RUBY, //  ".SRCINFO" => '\u{f303}', //  ".stowrc" => '\u{eef1}', //  @@ -317,7 +318,6 @@ const FILENAME_ICONS: Map<&'static str, char> = phf_map! { ".zshenv" => Icons::SHELL, // 󱆃 ".zshrc" => Icons::SHELL, // 󱆃 ".zsh_history" => Icons::SHELL, // 󱆃 - ".zsh_sessions" => Icons::SHELL, // 󱆃 "._DS_Store" => Icons::OS_APPLE, //  "_gvimrc" => Icons::VIM, //  "_vimrc" => Icons::VIM, //  @@ -1490,6 +1490,20 @@ mod test { assert_eq!(icon_for_name_ext("Layout.astro", Some("astro")), '\u{e6b3}'); } + #[test] + fn test_dot_directory_icons_upstream_1940() { + // Upstream #1940 / #1943: .atom, .idea, .rvm, .zsh_sessions are directories + assert_eq!(DIRECTORY_ICONS.get(".atom"), Some(&'\u{e764}')); + assert_eq!(DIRECTORY_ICONS.get(".idea"), Some(&Icons::INTELLIJ)); + assert_eq!(DIRECTORY_ICONS.get(".rvm"), Some(&Icons::LANG_RUBY)); + assert_eq!(DIRECTORY_ICONS.get(".zsh_sessions"), Some(&Icons::SHELL)); + + assert_eq!(FILENAME_ICONS.get(".atom"), None); + assert_eq!(FILENAME_ICONS.get(".idea"), None); + assert_eq!(FILENAME_ICONS.get(".rvm"), None); + assert_eq!(FILENAME_ICONS.get(".zsh_sessions"), None); + } + #[test] fn test_icon_for_name_ext_fallback() { assert_eq!( diff --git a/tests/icons_theme/dot_directory_icons.rs b/tests/icons_theme/dot_directory_icons.rs new file mode 100644 index 00000000..65fb23c1 --- /dev/null +++ b/tests/icons_theme/dot_directory_icons.rs @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2026 fxrdhan +// SPDX-License-Identifier: EUPL-1.2 + +//! Directory icons for dot-directories (upstream #1940 / #1943: `.atom`, +//! `.idea`, `.rvm`, `.zsh_sessions`), which were previously placed in +//! `FILENAME_ICONS` where directories never reached them. +//! This verifies each reaches its entry in lines and tree listings. + +use crate::common::{TempTestDir, lez_in, success_stdout}; + +#[test] +fn dot_directory_names_get_their_icons() { + let dir = TempTestDir::new("dot_directory_icons"); + dir.create_dir(".atom"); + dir.create_dir(".idea"); + dir.create_dir(".rvm"); + dir.create_dir(".zsh_sessions"); + + let lez = |args: &[&str]| success_stdout(lez_in(dir.path()).arg("--icons=always").args(args)); + assert_eq!( + lez(&["-1a"]), + "\u{e764} .atom\n\u{e7b5} .idea\n\u{e739} .rvm\n\u{f1183} .zsh_sessions\n" + ); + assert_eq!( + lez(&["-Ta"]), + "\u{e5ff} .\n\ + ├── \u{e764} .atom\n\ + ├── \u{e7b5} .idea\n\ + ├── \u{e739} .rvm\n\ + └── \u{f1183} .zsh_sessions\n" + ); +} diff --git a/tests/icons_theme_tests.rs b/tests/icons_theme_tests.rs index 2ec5fb89..c78cbe10 100644 --- a/tests/icons_theme_tests.rs +++ b/tests/icons_theme_tests.rs @@ -15,6 +15,8 @@ mod data_files; mod default_overrides; #[path = "icons_theme/dev_eclass_astro.rs"] mod dev_eclass_astro; +#[path = "icons_theme/dot_directory_icons.rs"] +mod dot_directory_icons; #[path = "icons_theme/empty_dirs.rs"] mod empty_dirs; #[path = "icons_theme/glob_precedence.rs"]