aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/expand.h
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-01-21 19:56:39 -0800
committerGravatar Kurtis Rader <krader@skepticism.us>2016-02-28 18:36:34 -0800
commitf2246dfb343bea19beb176fb2cc534f85513b2eb (patch)
treef95f0c4f4f48d445c1d561aa0986d2b98cdecec5 /src/expand.h
parentb41b96233616f26e52663c133f7a29d32b0e9142 (diff)
reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320 codepoints). This is still not ideal since fish shouldn't be using any Unicode private-use codepoints but it's a step in the right direction. This partially addresses issue #2684.
Diffstat (limited to 'src/expand.h')
-rw-r--r--src/expand.h90
1 files changed, 31 insertions, 59 deletions
diff --git a/src/expand.h b/src/expand.h
index 2c526358..731acd71 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -26,92 +26,64 @@
enum
{
- /** Flag specifying that cmdsubst expansion should be skipped */
+ // Flag specifying that cmdsubst expansion should be skipped.
EXPAND_SKIP_CMDSUBST = 1 << 0,
-
- /** Flag specifying that variable expansion should be skipped */
+ // Flag specifying that variable expansion should be skipped.
EXPAND_SKIP_VARIABLES = 1 << 1,
-
- /** Flag specifying that wildcard expansion should be skipped */
+ // Flag specifying that wildcard expansion should be skipped.
EXPAND_SKIP_WILDCARDS = 1 << 2,
-
- /**
- The expansion is being done for tab or auto completions. Returned completions may have the wildcard as a prefix instead of a match.
- */
+ // The expansion is being done for tab or auto completions. Returned
+ // completions may have the wildcard as a prefix instead of a match.
EXPAND_FOR_COMPLETIONS = 1 << 3,
-
- /** Only match files that are executable by the current user. Only applicable together with ACCEPT_INCOMPLETE. */
+ // Only match files that are executable by the current user. Only
+ // applicable together with ACCEPT_INCOMPLETE.
EXECUTABLES_ONLY = 1 << 4,
-
- /** Only match directories. Only applicable together with ACCEPT_INCOMPLETE. */
+ // Only match directories. Only applicable together with ACCEPT_INCOMPLETE.
DIRECTORIES_ONLY = 1 << 5,
-
- /** Don't generate descriptions */
+ // Don't generate descriptions.
EXPAND_NO_DESCRIPTIONS = 1 << 6,
-
- /** Don't expand jobs (but you can still expand processes). This is because job expansion is not thread safe. */
+ // Don't expand jobs (but you can still expand processes). This is because
+ // job expansion is not thread safe.
EXPAND_SKIP_JOBS = 1 << 7,
-
- /** Don't expand home directories */
+ // Don't expand home directories.
EXPAND_SKIP_HOME_DIRECTORIES = 1 << 8,
-
- /** Allow fuzzy matching */
+ // Allow fuzzy matching.
EXPAND_FUZZY_MATCH = 1 << 9,
-
- /** Disallow directory abbreviations like /u/l/b for /usr/local/bin. Only applicable if EXPAND_FUZZY_MATCH is set. */
+ // 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) */
+ // Do expansions specifically to support cd (CDPATH, etc).
EXPAND_SPECIAL_CD = 1 << 11
};
typedef int expand_flags_t;
-/**
- Use unencoded private-use keycodes for internal characters
-*/
-#define EXPAND_RESERVED 0xf000
-/**
- End of range reserved for expand
- */
-#define EXPAND_RESERVED_END 0xf000f
-
class completion_t;
enum
{
- /** Character represeting a home directory */
- HOME_DIRECTORY = EXPAND_RESERVED,
-
- /** Character represeting process expansion */
+ // Character representing a home directory.
+ HOME_DIRECTORY = EXPAND_RESERVED_BASE,
+ // Character representing process expansion.
PROCESS_EXPAND,
-
- /** Character representing variable expansion */
+ // Character representing variable expansion.
VARIABLE_EXPAND,
-
- /** Character rpresenting variable expansion into a single element*/
+ // Character representing variable expansion into a single element.
VARIABLE_EXPAND_SINGLE,
-
- /** Character representing the start of a bracket expansion */
+ // Character representing the start of a bracket expansion.
BRACKET_BEGIN,
-
- /** Character representing the end of a bracket expansion */
+ // Character representing the end of a bracket expansion.
BRACKET_END,
-
- /** Character representing separation between two bracket elements */
+ // Character representing separation between two bracket elements.
BRACKET_SEP,
- /**
- Separate subtokens in a token with this character.
- */
+ // Separate subtokens in a token with this character.
INTERNAL_SEPARATOR,
-
- /**
- Character representing an empty variable expansion.
- Only used transitively while expanding variables.
- */
+ // Character representing an empty variable expansion. Only used
+ // transitively while expanding variables.
VARIABLE_EXPAND_EMPTY,
-}
-;
-
+ // This is a special psuedo-char that is not used other than to mark the
+ // end of the the special characters so we can sanity check the enum range.
+ EXPAND_SENTINAL
+};
/** These are the possible return values for expand_string. Note how zero value is the only error. */
enum expand_error_t