fix: perform utf-8 sanitazation on buffer insert_chars

This commit is contained in:
CJ van den Berg 2025-01-15 11:52:24 +01:00
parent 9d6b760f03
commit 400af298d7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -781,11 +781,14 @@ const Node = union(enum) {
self_: *const Node,
line_: usize,
col_: usize,
s: []const u8,
chars: []const u8,
allocator: Allocator,
metrics_: Metrics,
) !struct { usize, usize, Root } {
var self = self_;
var s = chars;
if (!std.unicode.utf8ValidateSlice(chars))
s = try unicode.utf8_sanitize(allocator, chars);
const Ctx = struct {
allocator: Allocator,
col: usize,