diff --git a/src/app.rs b/src/app.rs index 9979722c..658f4fe7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1491,7 +1491,18 @@ impl App { } fn change_directory(mut self, dir: &str) -> Result { - if PathBuf::from(dir).is_dir() { + let path = PathBuf::from(dir); + if let Some(ft) = path.symlink_metadata().ok().map(|m| m.file_type()) { + if ft.is_dir() { + self.pwd = dir.to_owned(); + self.history = self.history.push(self.pwd.clone()); + self.msg_out.push_back(MsgOut::Refresh); + } else if ft.is_symlink() { + if let Ok(s) = path.canonicalize() { + self = self.focus_path(&s.to_string_lossy().to_string())?; + } + } + } else if path.is_dir() { self.pwd = dir.to_owned(); self.history = self.history.push(self.pwd.clone()); self.msg_out.push_back(MsgOut::Refresh); diff --git a/src/config.yml b/src/config.yml index f1404d6b..6fef7423 100644 --- a/src/config.yml +++ b/src/config.yml @@ -59,7 +59,7 @@ general: bits: 0 sub_modifier: bits: 0 - - format: '{{humansize size}}' + - format: '{{#unless isDir}}{{humansize size}}{{/unless}}' - format: '{{#if isSymlink}}{{{symlink.mimeEssence}}}{{else}}{{{mimeEssence}}}{{/if}}' style: fg: null