diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-01-21 19:56:39 -0800 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-02-28 18:36:34 -0800 |
commit | f2246dfb343bea19beb176fb2cc534f85513b2eb (patch) | |
tree | f95f0c4f4f48d445c1d561aa0986d2b98cdecec5 /src/reader.cpp | |
parent | b41b96233616f26e52663c133f7a29d32b0e9142 (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/reader.cpp')
-rw-r--r-- | src/reader.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/reader.cpp b/src/reader.cpp index 3998e5a0..a7e8ec7e 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2964,16 +2964,20 @@ static int can_read(int fd) return select(fd + 1, &fds, 0, 0, &can_read_timeout) == 1; } -/** - Test if the specified character is in the private use area that - fish uses to store internal characters - - Note: Allow U+F8FF because that's the Apple symbol, which is in the - OS X US keyboard layout. -*/ +// Test if the specified character is in a range that fish uses interally to +// store special tokens. +// +// NOTE: This is used when tokenizing the input. It is also used when reading +// input, before tokenization, to replace such chars with REPLACEMENT_WCHAR if +// they're not part of a quoted string. We don't want external input to be able +// to feed reserved characters into our lexer/parser or code evaluator. +// +// TODO: Actually implement the replacement as documented above. static int wchar_private(wchar_t c) { - return ((c >= 0xe000) && (c < 0xf8ff)); + return ((c >= RESERVED_CHAR_BASE && c < RESERVED_CHAR_END) || + (c >= ENCODE_DIRECT_BASE && c < ENCODE_DIRECT_END) || + (c >= INPUT_COMMON_BASE && c < INPUT_COMMON_END)); } /** |