From 4e77a83067b0526eab9629ad12b619d4b45545f7 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy <mmstickman@gmail.com> Date: Mon, 9 Oct 2017 17:20:25 -0400 Subject: [PATCH] Fix for #549 Closes #549 --- src/shell/binary.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/shell/binary.rs b/src/shell/binary.rs index f2e43c1b..88f09efd 100644 --- a/src/shell/binary.rs +++ b/src/shell/binary.rs @@ -328,14 +328,18 @@ impl<'a> Binary for Shell<'a> { if let Ok(command) = self.terminate_quotes(command) { let cmd = command.trim(); self.on_command(cmd); - match self.variables.tilde_expansion(cmd, &self.directory_stack) { - Some(ref cmd) if Path::new(cmd).is_dir() & !cmd.ends_with('/') => { + + if cmd.starts_with('~') { + if let Some(ref cmd) = self.variables.tilde_expansion(cmd, &self.directory_stack) { self.save_command_in_history(&[cmd, "/"].concat()); + continue } - None if Path::new(cmd).is_dir() & !cmd.ends_with('/') => { - self.save_command_in_history(&[cmd, "/"].concat()); - } - _ => self.save_command_in_history(cmd), + } + + if Path::new(cmd).is_dir() & !cmd.ends_with('/') { + self.save_command_in_history(&[cmd, "/"].concat()); + } else { + self.save_command_in_history(cmd); } } else { self.flow_control.level = 0; -- GitLab