mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-22 11:46:11 +03:00
Merge pull request #1382 from mitchellh/pua-scaling
renderer: consider powerline box glyphs whitespace for PUA scaling
This commit is contained in:
@ -58,8 +58,14 @@ pub fn fgMode(
|
|||||||
|
|
||||||
// If we have a previous cell and it was PUA then we need to
|
// If we have a previous cell and it was PUA then we need to
|
||||||
// also constrain. This is so that multiple PUA glyphs align.
|
// also constrain. This is so that multiple PUA glyphs align.
|
||||||
if (x > 0) {
|
// As an exception, we ignore powerline glyphs since they are
|
||||||
|
// used for box drawing and we consider them whitespace.
|
||||||
|
if (x > 0) prev: {
|
||||||
const prev_cell = screen.getCell(.active, y, x - 1);
|
const prev_cell = screen.getCell(.active, y, x - 1);
|
||||||
|
|
||||||
|
// Powerline is whitespace
|
||||||
|
if (isPowerline(prev_cell.char)) break :prev;
|
||||||
|
|
||||||
if (ziglyph.general_category.isPrivateUse(@intCast(prev_cell.char))) {
|
if (ziglyph.general_category.isPrivateUse(@intCast(prev_cell.char))) {
|
||||||
break :text .constrained;
|
break :text .constrained;
|
||||||
}
|
}
|
||||||
@ -68,7 +74,10 @@ pub fn fgMode(
|
|||||||
// If the next cell is empty, then we allow it to use the
|
// If the next cell is empty, then we allow it to use the
|
||||||
// full glyph size.
|
// full glyph size.
|
||||||
const next_cell = screen.getCell(.active, y, x + 1);
|
const next_cell = screen.getCell(.active, y, x + 1);
|
||||||
if (next_cell.char == 0 or next_cell.char == ' ') {
|
if (next_cell.char == 0 or
|
||||||
|
next_cell.char == ' ' or
|
||||||
|
isPowerline(next_cell.char))
|
||||||
|
{
|
||||||
break :text .normal;
|
break :text .normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user