aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/expand.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-04-07 15:24:52 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-04-07 20:15:32 -0700
commite395a0eb6927f298fcc7d0764ed27605941f34c0 (patch)
tree9f8bda281145b800128c246fbf84952a0dc8a191 /src/expand.h
parent36691df6fe4667645b71b550ce5eea90762ac23a (diff)
Migrate PATH-completion logic from complete.cpp to expand.cpp
Prior to this fix, when completing a command that doesn't have a /, we would prepend each component of PATH and then expand the whole thing. So any special characters in the PATH would be interpreted when performing tab completion. With this fix, we pull the PATH resolution out of complete.cpp and migrate it to expand.cpp. This unifies nicely with the CDPATH resolution already in that file. This requires introducing a new expand flag EXPAND_SPECIAL_FOR_COMMAND, which is analogous to EXPAND_SPECIAL_CD (which is renamed to EXPAND_SPECIAL_FOR_CD). This flag tells expand to resolve paths against PATH instead of the working directory. Fixes #952
Diffstat (limited to 'src/expand.h')
-rw-r--r--src/expand.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/expand.h b/src/expand.h
index 6ae91cca..fafbcd2a 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -52,8 +52,12 @@ enum
// Disallow directory abbreviations like /u/l/b for /usr/local/bin. Only
// applicable if EXPAND_FUZZY_MATCH is set.
EXPAND_NO_FUZZY_DIRECTORIES = 1 << 10,
- // Do expansions specifically to support cd (CDPATH, etc).
- EXPAND_SPECIAL_CD = 1 << 11
+ // Do expansions specifically to support cd
+ // This means using CDPATH as a list of potential working directories
+ EXPAND_SPECIAL_FOR_CD = 1 << 11,
+ // Do expansions specifically to support external command completions.
+ // This means using PATH as a list of potential working directories
+ EXPAND_SPECIAL_FOR_COMMAND = 1 << 12
};
typedef int expand_flags_t;