Merge pull request #1114 from vancluever/vancluever-powerline-no-constrain

renderer: don't constrain Powerline glyphs
This commit is contained in:
Mitchell Hashimoto
2023-12-17 07:47:38 -08:00
committed by GitHub

View File

@ -45,6 +45,12 @@ pub fn fgMode(
break :text .normal; break :text .normal;
} }
// We exempt the Powerline range from this since they exhibit
// box-drawing behavior and should not be constrained.
if (isPowerline(cell.char)) {
break :text .normal;
}
// If we are at the end of the screen its definitely constrained // If we are at the end of the screen its definitely constrained
if (x == screen.cols - 1) break :text .constrained; if (x == screen.cols - 1) break :text .constrained;
@ -69,3 +75,11 @@ pub fn fgMode(
}, },
}; };
} }
// Returns true if the codepoint is a part of the Powerline range.
fn isPowerline(char: u32) bool {
return switch (char) {
0xE0B0...0xE0C8, 0xE0CA, 0xE0CC...0xE0D2, 0xE0D4 => true,
else => false,
};
}