From d6af2ebf8081ef3200782ad4e7d4e0b62ac0a5ef Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 4 Jul 2026 21:01:14 +0200 Subject: [PATCH] fix: remove trailing space after input icon and detect dir for `create --dir` The icon rendered next to input popups (cd/create/rename/shell) always had a trailing space baked into its text, making it inconsistent with the title which has none. Also, `create --dir` always showed the file icon while typing, since the icon lookup only distinguished file vs. dir by whether the typed value ends with a path separator, and the `create` input id didn't carry the `--dir` flag. Give it its own `create-dir` id so it always resolves to the directory icon, matching the action it actually performs. Co-Authored-By: Claude Sonnet 5 --- yazi-config/src/popup/input.rs | 2 +- yazi-fm/src/input/input.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/yazi-config/src/popup/input.rs b/yazi-config/src/popup/input.rs index 348e35e5..83045faa 100644 --- a/yazi-config/src/popup/input.rs +++ b/yazi-config/src/popup/input.rs @@ -58,7 +58,7 @@ impl Input { pub fn create(&self, dir: bool) -> InputOpt { InputOpt { - id: "create".to_owned(), + id: if dir { "create-dir" } else { "create" }.to_owned(), title: self.create_title[dir as usize].clone(), position: Position::new(self.create_origin, self.create_offset), ..Default::default() diff --git a/yazi-fm/src/input/input.rs b/yazi-fm/src/input/input.rs index 84962b41..5c71cc12 100644 --- a/yazi-fm/src/input/input.rs +++ b/yazi-fm/src/input/input.rs @@ -23,6 +23,7 @@ impl<'a> Input<'a> { let (path, mode): (&str, u16) = match input.id.as_str() { "cd" => (input.value(), if is_dir { 0o40755 } else { 0o100644 }), "create" => (input.value(), if is_dir { 0o40755 } else { 0o100644 }), + "create-dir" => (input.value(), 0o40755), "rename-file" => (input.value(), 0o100644), "rename-dir" => (input.value(), 0o40755), "shell" => ("icon.sh", 0o100644), @@ -53,7 +54,7 @@ impl Widget for Input<'_> { .title(Line::styled(&input.title, THEME.input.title.get())); if let Some(i) = self.icon() { - block = block.title_bottom(Line::raw(format!("{} ", i.text)).style(i.style).right_aligned()); + block = block.title_bottom(Line::raw(i.text).style(i.style).right_aligned()); } block.render(outer, buf);