Merge pull request #2434 from ofseed/en-space

renderer: generalize the definition of "space"
This commit is contained in:
Mitchell Hashimoto
2024-10-12 09:37:15 -07:00
committed by GitHub

View File

@ -101,7 +101,7 @@ pub fn fgMode(
break :next_cp next_cell.codepoint();
};
if (next_cp == 0 or
next_cp == ' ' or
isSpace(next_cp) or
isPowerline(next_cp))
{
break :text .normal;
@ -113,6 +113,17 @@ pub fn fgMode(
};
}
// Some general spaces, others intentionally kept
// to force the font to render as a fixed width.
fn isSpace(char: u21) bool {
return switch (char) {
0x0020, // SPACE
0x2002, // EN SPACE
=> true,
else => false,
};
}
// Returns true if the codepoint is a part of the Powerline range.
fn isPowerline(char: u21) bool {
return switch (char) {