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.
This commit is contained in:
Kurtis Rader
2016-01-21 19:56:39 -08:00
parent b41b962336
commit f2246dfb34
10 changed files with 184 additions and 186 deletions

View File

@@ -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));
}
/**