fix: perform utf-8 sanitazation on buffer insert_chars
This commit is contained in:
parent
9d6b760f03
commit
400af298d7
1 changed files with 4 additions and 1 deletions
|
@ -781,11 +781,14 @@ const Node = union(enum) {
|
||||||
self_: *const Node,
|
self_: *const Node,
|
||||||
line_: usize,
|
line_: usize,
|
||||||
col_: usize,
|
col_: usize,
|
||||||
s: []const u8,
|
chars: []const u8,
|
||||||
allocator: Allocator,
|
allocator: Allocator,
|
||||||
metrics_: Metrics,
|
metrics_: Metrics,
|
||||||
) !struct { usize, usize, Root } {
|
) !struct { usize, usize, Root } {
|
||||||
var self = self_;
|
var self = self_;
|
||||||
|
var s = chars;
|
||||||
|
if (!std.unicode.utf8ValidateSlice(chars))
|
||||||
|
s = try unicode.utf8_sanitize(allocator, chars);
|
||||||
const Ctx = struct {
|
const Ctx = struct {
|
||||||
allocator: Allocator,
|
allocator: Allocator,
|
||||||
col: usize,
|
col: usize,
|
||||||
|
|
Loading…
Add table
Reference in a new issue