From 5362706b26f54b441d27f50ef209ea85c3fb7d5e Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 2 Oct 2025 16:28:23 +0200 Subject: [PATCH] fix: translate columns to byte offsets when requesting completions --- 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 e13d0d4..6d15a20 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -5520,9 +5520,11 @@ pub const Editor = struct { pub fn completion(self: *Self, _: Context) Result { const file_path = self.file_path orelse return; + const root = self.buf_root() catch return; const primary = self.get_primary(); + const col = try root.get_line_width_to_pos(primary.cursor.row, primary.cursor.col, self.metrics); self.completions.clearRetainingCapacity(); - return project_manager.completion(file_path, primary.cursor.row, primary.cursor.col); + return project_manager.completion(file_path, primary.cursor.row, col); } pub const completion_meta: Meta = .{ .description = "Language: Show completions at cursor" };