fix: crash if pos_to_width is given an out of range value
Possible with bad lsp diagnostics for example.
This commit is contained in:
parent
c0a9be21f5
commit
587b707069
1 changed files with 4 additions and 1 deletions
|
@ -175,7 +175,10 @@ pub const Leaf = struct {
|
|||
} else {
|
||||
const bytes = metrics.egc_length(metrics, buf, &cols, abs_col);
|
||||
buf = buf[bytes..];
|
||||
pos.* -= bytes;
|
||||
if (pos.* >= bytes)
|
||||
pos.* -= bytes
|
||||
else
|
||||
pos.* = 0;
|
||||
}
|
||||
col += @intCast(cols);
|
||||
abs_col += @intCast(cols);
|
||||
|
|
Loading…
Add table
Reference in a new issue