Added handling of home dir shortcut

This commit is contained in:
Joshua Barretto 2025-09-22 14:02:01 +01:00
parent 95c894f825
commit 0b484e8592
3 changed files with 6 additions and 2 deletions

2
Cargo.lock generated
View file

@ -649,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "zte2"
name = "zte"
version = "0.2.0"
dependencies = [
"chumsky",

View file

@ -1,5 +1,5 @@
[package]
name = "zte2"
name = "zte"
version = "0.2.0"
edition = "2024"

View file

@ -386,6 +386,10 @@ impl Element<()> for Opener {
}
Ok(Resp::handled(None))
}
Some(Action::Char('/')) if path_str.ends_with("~") && std::env::home_dir().is_some() /*let Some(home_dir) = std::env::home_dir()*/ => {
self.set_string(&format!("{}/", std::env::home_dir().unwrap().display()));
Ok(Resp::handled(None))
}
_ => match self.options.handle(state, event).map(Resp::into_ended) {
// Selecting a directory enters the directory
Ok(Some(file)) if matches!(file.kind, FileKind::Dir) => {