From 5afabeb7a5f6d37a683c911305a63ef4fa17fe22 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 10 Feb 2025 19:52:06 +0100 Subject: [PATCH] fix: translate command line column from byte position to actual column --- src/tui/editor.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index a89c603..ba15cb3 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -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} };