fix: move cursor to the beginning of an egc in Cursor.clamp_to_buffer

closes #317
This commit is contained in:
CJ van den Berg 2025-11-03 16:25:22 +01:00
parent f6234e6048
commit 1d1d828097
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -33,6 +33,8 @@ pub fn clamp_to_buffer(self: *Self, root: Buffer.Root, metrics: Metrics) void {
self.col = root.line_width(self.row, metrics) catch 0;
} else {
self.col = @min(self.col, root.line_width(self.row, metrics) catch 0);
_, _, const offset = root.egc_at(self.row, self.col, metrics) catch return;
self.col -= @min(self.col, offset);
}
}