Migrate PUA constants out of wutil.h

These defines are only used inside the .cpp file. Place them in there
and switch to an enum.
This commit is contained in:
ridiculousfish 2022-09-24 15:26:53 -07:00
parent 23bf98e6bb
commit 9a3a67ba31
2 changed files with 9 additions and 7 deletions

View File

@ -516,6 +516,15 @@ ssize_t wwrite_to_fd(const wchar_t *input, size_t input_len, int fd) {
return success ? total_written : -1;
}
enum : wint_t {
PUA1_START = 0xE000,
PUA1_END = 0xF900,
PUA2_START = 0xF0000,
PUA2_END = 0xFFFFE,
PUA3_START = 0x100000,
PUA3_END = 0x10FFFE,
};
/// Return one if the code point is in a Unicode private use area.
static int fish_is_pua(wint_t wc) {
if (PUA1_START <= wc && wc < PUA1_END) return 1;

View File

@ -106,13 +106,6 @@ inline ssize_t wwrite_to_fd(const wcstring &s, int fd) {
return wwrite_to_fd(s.c_str(), s.size(), fd);
}
#define PUA1_START 0xE000
#define PUA1_END 0xF900
#define PUA2_START 0xF0000
#define PUA2_END 0xFFFFE
#define PUA3_START 0x100000
#define PUA3_END 0x10FFFE
// We need this because there are too many implementations that don't return the proper answer for
// some code points. See issue #3050.
#ifndef FISH_NO_ISW_WRAPPERS