diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-07 18:29:21 +0300 |
| commit | dcfe11a7588fcd42471159453810abc9b7720a57 (patch) | |
| tree | c32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/src/renderer/State.zig | |
| parent | 2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff) | |
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround.
expose the new selection formatter and hyperlink uri apis for follow-up rendering work.
add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/src/renderer/State.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/renderer/State.zig | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/vendor/libghostty-vt/src/renderer/State.zig b/vendor/libghostty-vt/src/renderer/State.zig index e882ddce..22cae8fe 100644 --- a/vendor/libghostty-vt/src/renderer/State.zig +++ b/vendor/libghostty-vt/src/renderer/State.zig @@ -112,7 +112,7 @@ pub const Preedit = struct { // If our preedit goes off the end of the screen, we adjust it so // that it shifts left. - const end = start + w; + const end = if (w > 0) start + (w - 1) else start; const start_offset = if (end > max) end - max else 0; return .{ .start = start -| start_offset, @@ -121,3 +121,41 @@ pub const Preedit = struct { }; } }; + +const test_hangul_ga: u21 = 0xAC00; // U+AC00 HANGUL SYLLABLE GA + +test "preedit range covers exact cell width" { + const testing = std.testing; + + { + const p: Preedit = .{ + .codepoints = &.{.{ .codepoint = 'a' }}, + }; + const range = p.range(2, 9); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 2), range.start); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 2), range.end); + try testing.expectEqual(@as(usize, 0), range.cp_offset); + } + + { + const p: Preedit = .{ + .codepoints = &.{.{ .codepoint = test_hangul_ga, .wide = true }}, + }; + const range = p.range(2, 9); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 2), range.start); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 3), range.end); + try testing.expectEqual(@as(usize, 0), range.cp_offset); + } +} + +test "preedit range shifts left at right edge" { + const testing = std.testing; + + const p: Preedit = .{ + .codepoints = &.{.{ .codepoint = test_hangul_ga, .wide = true }}, + }; + const range = p.range(9, 9); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 8), range.start); + try testing.expectEqual(@as(terminalpkg.size.CellCountInt, 9), range.end); + try testing.expectEqual(@as(usize, 0), range.cp_offset); +} |
