renderer: generalize the definition of "space"

This commit is contained in:
Yi Ming
2024-10-12 17:44:16 +08:00
parent c26d1cb28e
commit 0571c50d63

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) {