···738738 try std.testing.expectEqualStrings("-latte", input.buf.secondHalf());
739739}
740740741741+test "non-ASCII punctuation treated as word chars" {
742742+ var input = TextField.init(std.testing.allocator);
743743+ defer input.deinit();
744744+ // Em dash (U+2014, 3 bytes: E2 80 94) has bytes >= 0x80, so all bytes are
745745+ // classified as word chars. The entire string is one continuous "word" — the
746746+ // em dash does NOT act as a separator. This is a known limitation of the
747747+ // byte-based classifier.
748748+ try input.insertSliceAtCursor("hello\xe2\x80\x94world");
749749+ input.moveBackwardWordwise();
750750+ try std.testing.expectEqualStrings("", input.buf.firstHalf());
751751+}
752752+741753test "deleteWordBefore with non-ASCII text" {
742754 var input = TextField.init(std.testing.allocator);
743755 defer input.deinit();
+13
src/widgets/TextInput.zig
···595595 try std.testing.expectEqualStrings("-latte", input.buf.secondHalf());
596596}
597597598598+test "non-ASCII punctuation treated as word chars" {
599599+ var input = TextInput.init(std.testing.allocator);
600600+ defer input.deinit();
601601+ // Em dash (U+2014, 3 bytes: E2 80 94) has bytes >= 0x80, so all bytes are
602602+ // classified as word chars. The entire string is one continuous "word" — the
603603+ // em dash does NOT act as a separator. This is a known limitation of the
604604+ // byte-based classifier; proper Unicode category classification would be
605605+ // needed to treat non-ASCII punctuation as separators.
606606+ try input.insertSliceAtCursor("hello\xe2\x80\x94world");
607607+ input.moveBackwardWordwise();
608608+ try std.testing.expectEqualStrings("", input.buf.firstHalf());
609609+}
610610+598611test "deleteWordBefore with non-ASCII text" {
599612 var input = TextInput.init(std.testing.allocator);
600613 defer input.deinit();