fix: translate command line column from byte position to actual column

This commit is contained in:
CJ van den Berg 2025-02-10 19:52:06 +01:00
parent 910331868e
commit 5afabeb7a5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -4518,7 +4518,9 @@ pub const Editor = struct {
return error.InvalidGotoColumnArgument;
const root = self.buf_root() catch return;
const primary = self.get_primary();
try primary.cursor.move_to(root, primary.cursor.row, @intCast(if (column < 1) 0 else column - 1), self.metrics);
column = if (column < 1) 0 else column - 1;
column = try root.pos_to_width(primary.cursor.row, column, self.metrics);
try primary.cursor.move_to(root, primary.cursor.row, column, self.metrics);
self.clamp();
}
pub const goto_column_meta = .{ .arguments = &.{.integer} };