07d3d200
main: use explicit viewportEql instead of std.meta.eql
a73x 2026-04-19 07:13
Commit message
src/main.zig
| Old | New | ||
|---|---|---|---|
| @@ -515,7 +515,7 @@ fn runTerminal(alloc: std.mem.Allocator) !void { | |||
| 515 | and keyboard.has_focus; | 515 | and keyboard.has_focus; |
| 516 | 516 | ||
| 517 | const cursor_identity_changed = | 517 | const cursor_identity_changed = |
| 518 | !std.meta.eql(current_cursor.viewport, previous_cursor.viewport) | 518 | !viewportEql(current_cursor.viewport, previous_cursor.viewport) |
| 519 | or current_cursor.visual_style != previous_cursor.visual_style | 519 | or current_cursor.visual_style != previous_cursor.visual_style |
| 520 | or current_cursor.visible != previous_cursor.visible | 520 | or current_cursor.visible != previous_cursor.visible |
| 521 | or current_cursor.blinking != previous_cursor.blinking; | 521 | or current_cursor.blinking != previous_cursor.blinking; |
| @@ -903,6 +903,17 @@ fn reconfigureBlink( | |||
| 903 | return .{ .state = state, .cursor_rebuild = false }; | 903 | return .{ .state = state, .cursor_rebuild = false }; |
| 904 | } | 904 | } |
| 905 | 905 | ||
| 906 | // Field-wise equality for ?Viewport. Explicit (vs std.meta.eql) so that | ||
| 907 | // adding a new Viewport field in ghostty_vt becomes a compile error here | ||
| 908 | // instead of a silent correctness drift. | ||
| 909 | fn viewportEql(a: anytype, b: anytype) bool { | ||
| 910 | if (a == null and b == null) return true; | ||
| 911 | if (a == null or b == null) return false; | ||
| 912 | return a.?.x == b.?.x | ||
| 913 | and a.?.y == b.?.y | ||
| 914 | and a.?.wide_tail == b.?.wide_tail; | ||
| 915 | } | ||
| 916 | |||
| 906 | fn shouldDrawCursor( | 917 | fn shouldDrawCursor( |
| 907 | visible: bool, | 918 | visible: bool, |
| 908 | viewport_present: bool, | 919 | viewport_present: bool, |