fix: convert column to byte position in inspector_view.inspect_location

fixes #54
This commit is contained in:
CJ van den Berg 2024-10-23 12:20:40 +02:00
parent a46c75da63
commit 6755eaab44
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 21 additions and 1 deletions

View file

@ -73,7 +73,9 @@ fn clear(self: *Self) void {
fn inspect_location(self: *Self, row: usize, col: usize) void {
const syn = self.editor.syntax orelse return;
syn.highlights_at_point(self, dump_highlight, .{ .row = @intCast(row), .column = @intCast(col) });
const root = (self.editor.buffer orelse return).root;
const col_pos = root.get_line_width_to_pos(row, col,self.editor.metrics) catch return;
syn.highlights_at_point(self, dump_highlight, .{ .row = @intCast(row), .column = @intCast(col_pos) });
}
fn get_buffer_text(self: *Self, buf: []u8, sel: Buffer.Selection) ?[]const u8 {