mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-08 19:06:36 +00:00
font/shaper: split runs at selection boundaries
This commit is contained in:
@@ -847,8 +847,9 @@ pub fn rebuildCells(
|
||||
defer y += 1;
|
||||
|
||||
// Our selection value is only non-null if this selection happens
|
||||
// to contain this row. If the selection changes for any reason,
|
||||
// then we invalidate the cache.
|
||||
// to contain this row. This selection value will be set to only be
|
||||
// the selection that contains this row. This way, if the selection
|
||||
// changes but not for this line, we don't invalidate the cache.
|
||||
const selection = sel: {
|
||||
if (term_selection) |sel| {
|
||||
const screen_point = (terminal.point.Viewport{
|
||||
@@ -856,8 +857,10 @@ pub fn rebuildCells(
|
||||
.y = y,
|
||||
}).toScreen(screen);
|
||||
|
||||
// If we are selected, we our colors are just inverted fg/bg
|
||||
if (sel.containsRow(screen_point)) break :sel sel;
|
||||
// If we are selected, we our colors are just inverted fg/bg.
|
||||
if (sel.containedRow(screen, screen_point)) |row_sel| {
|
||||
break :sel row_sel;
|
||||
}
|
||||
}
|
||||
|
||||
break :sel null;
|
||||
@@ -901,7 +904,7 @@ pub fn rebuildCells(
|
||||
const start = self.cells.items.len;
|
||||
|
||||
// Split our row into runs and shape each one.
|
||||
var iter = self.font_shaper.runIterator(self.font_group, row);
|
||||
var iter = self.font_shaper.runIterator(self.font_group, row, selection);
|
||||
while (try iter.next(self.alloc)) |run| {
|
||||
for (try self.font_shaper.shape(run)) |shaper_cell| {
|
||||
if (self.updateCell(
|
||||
|
Reference in New Issue
Block a user