From ae0de7bce46e99d334dff6a1aff1c6370c765d87 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 29 Aug 2023 13:44:40 -0700 Subject: [PATCH] renderer: split ligature around cursor even if cursor is flashing Fixes #356 --- src/renderer/Metal.zig | 7 ++++++- src/renderer/OpenGL.zig | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index e1fb7b37d..129473439 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1148,6 +1148,11 @@ fn rebuildCells( screen.viewportIsBottom() and y == screen.cursor.y; + // True if we want to do font shaping around the cursor. We want to + // do font shaping as long as the cursor is enabled. + const shape_cursor = screen.viewportIsBottom() and + y == screen.cursor.y; + // If this is the row with our cursor, then we may have to modify // the cell with the cursor. const start_i: usize = self.cells.items.len; @@ -1183,7 +1188,7 @@ fn rebuildCells( self.font_group, row, row_selection, - if (cursor_row) screen.cursor.x else null, + if (shape_cursor) screen.cursor.x else null, ); while (try iter.next(self.alloc)) |run| { for (try self.font_shaper.shape(run)) |shaper_cell| { diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index a05e4c287..99b957a56 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -902,6 +902,11 @@ pub fn rebuildCells( screen.viewportIsBottom() and y == screen.cursor.y; + // True if we want to do font shaping around the cursor. We want to + // do font shaping as long as the cursor is enabled. + const shape_cursor = screen.viewportIsBottom() and + y == screen.cursor.y; + // If this is the row with our cursor, then we may have to modify // the cell with the cursor. const start_i: usize = self.cells.items.len; @@ -940,7 +945,7 @@ pub fn rebuildCells( self.font_group, row, selection, - if (cursor_row) screen.cursor.x else null, + if (shape_cursor) screen.cursor.x else null, ); while (try iter.next(self.alloc)) |run| { for (try self.font_shaper.shape(run)) |shaper_cell| {