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 <noreply@anthropic.com>
This commit is contained in:
greg 2026-07-04 21:01:14 +02:00
parent 6e0aaee822
commit d6af2ebf80
2 changed files with 3 additions and 2 deletions

View file

@ -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()

View file

@ -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);