Merge branch 'zig-0.14'

This commit is contained in:
CJ van den Berg 2025-09-29 20:58:06 +02:00
commit 2a74de8f73
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -174,10 +174,10 @@ pub fn render(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx
} }
} }
pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx)), point: Point) void { pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBack(@TypeOf(ctx)), point: Point) bool {
const cursor = Query.Cursor.create() catch return; const cursor = Query.Cursor.create() catch return false;
defer cursor.destroy(); defer cursor.destroy();
const tree = self.tree orelse return; const tree = self.tree orelse return false;
cursor.execute(self.query, tree.getRootNode()); cursor.execute(self.query, tree.getRootNode());
cursor.setPointRange(.{ .row = point.row, .column = 0 }, .{ .row = point.row + 1, .column = 0 }); cursor.setPointRange(.{ .row = point.row, .column = 0 }, .{ .row = point.row + 1, .column = 0 });
while (cursor.nextMatch()) |match| { while (cursor.nextMatch()) |match| {
@ -187,11 +187,11 @@ pub fn highlights_at_point(self: *const Self, ctx: anytype, comptime cb: CallBac
const end = range.end_point; const end = range.end_point;
const scope = self.query.getCaptureNameForId(capture.id); const scope = self.query.getCaptureNameForId(capture.id);
if (start.row == point.row and start.column <= point.column and point.column < end.column) if (start.row == point.row and start.column <= point.column and point.column < end.column)
cb(ctx, range, scope, capture.id, 0, &capture.node) catch return; cb(ctx, range, scope, capture.id, 0, &capture.node) catch return true;
break; break;
} }
} }
return; return false;
} }
pub fn node_at_point_range(self: *const Self, range: Range) error{Stop}!treez.Node { pub fn node_at_point_range(self: *const Self, range: Range) error{Stop}!treez.Node {