aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/highlight.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-02 16:46:57 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-02 16:47:39 -0800
commit60a477a30365c90a0f4de34527914b14de31a953 (patch)
tree2dbc5a18beaa5e5e742852abe10e3cc20125e7f4 /src/highlight.cpp
parentf8da754884e5c7d4a8fe16829c771fb66b32c38b (diff)
Don't crash when autosuggesting cd'ing into a directory with ~
Fixes #2696
Diffstat (limited to 'src/highlight.cpp')
-rw-r--r--src/highlight.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/highlight.cpp b/src/highlight.cpp
index 17ed7e97..9ed94e08 100644
--- a/src/highlight.cpp
+++ b/src/highlight.cpp
@@ -65,7 +65,7 @@ static const wchar_t * const highlight_var[] =
};
-/* If the given path looks like it's relative to the working directory, then prepend that working directory. */
+/* If the given path looks like it's relative to the working directory, then prepend that working directory. This operates on unescaped paths only (so a ~ means a literal ~) */
static wcstring apply_working_directory(const wcstring &path, const wcstring &working_directory)
{
if (path.empty() || working_directory.empty())
@@ -76,7 +76,7 @@ static wcstring apply_working_directory(const wcstring &path, const wcstring &wo
switch (path.at(0))
{
case L'/':
- case L'~':
+ case HOME_DIRECTORY:
prepend_wd = false;
break;
default:
@@ -1218,7 +1218,7 @@ void highlighter_t::color_redirection(const parse_node_t &redirection_node)
}
else
{
- /* Ok, we successfully expanded our target. Now verify that it works with this redirection. We will probably need it as a path (but not in the case of fd redirections */
+ /* Ok, we successfully expanded our target. Now verify that it works with this redirection. We will probably need it as a path (but not in the case of fd redirections). Note that the target is now unescaped. */
const wcstring target_path = apply_working_directory(target, this->working_directory);
switch (redirect_type)
{