Make \x the same as \X

Up to now, in normal locales \x was essentially the same as \X, except
that it errored if given a value > 0x7f.

That's kind of annoying and useless.

A subtle change is that `\xHH` now represents the character (if any)
encoded by the byte value "HH", so even for values <= 0x7f if that's
not the same as the ASCII value we would diverge.

I do not believe anyone has ever run fish on a system where that
distinction matters. It isn't a thing for UTF-8, it isn't a thing for
ASCII, it isn't a thing for UTF-16, it isn't a thing for any extended
ASCII scheme - ISO8859-X, it isn't a thing for SHIFT-JIS.

I am reasonably certain we are making that same assumption in other
places.

Fixes #1352
This commit is contained in:
Fabian Boehm
2022-09-29 19:27:18 +02:00
parent 85d4834b35
commit 52dcfe11af
5 changed files with 12 additions and 26 deletions

View File

@@ -604,10 +604,7 @@ static void color_string_internal(const wcstring &buffstr, highlight_spec_t base
in_pos++;
break;
}
case L'x': {
in_pos++;
break;
}
case L'x':
case L'X': {
max_val = BYTE_MAX;
in_pos++;