1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-11 13:00:41 +03:00

Merge remote-tracking branch 'arachsys/unsigned-char'

This commit is contained in:
Maxime Coste 2023-12-12 21:19:52 +11:00
commit 5ed2433b9f
2 changed files with 4 additions and 4 deletions

View File

@ -20,7 +20,7 @@ String to_json(StringView str)
for (auto it = str.begin(), end = str.end(); it != end; )
{
auto next = std::find_if(it, end, [](char c) {
return c == '\\' or c == '"' or (c >= 0 and c <= 0x1F);
return c == '\\' or c == '"' or (unsigned char) c <= 0x1F;
});
res += StringView{it, next};
@ -28,7 +28,7 @@ String to_json(StringView str)
break;
char buf[7] = {'\\', *next, 0};
if (*next >= 0 and *next <= 0x1F)
if ((unsigned char) *next <= 0x1F)
format_to(buf, "\\u{:04}", hex(*next));
res += buf;

View File

@ -30,8 +30,8 @@ static String fix_atom_text(StringView str)
auto pos = str.begin();
for (auto it = str.begin(), end = str.end(); it != end; ++it)
{
char c = *it;
if (c >= 0 and c <= 0x1F)
unsigned char c = *it;
if (c <= 0x1F)
{
res += StringView{pos, it};
res += String{Codepoint{(uint32_t)(0x2400 + c)}};