summaryrefslogtreecommitdiff
path: root/core/syntax.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 22:24:29 -0300
committerGabriel Schneider <[email protected]>2026-11-24 22:24:29 -0300
commit89b3e7365bac28c4cd7d52d40c1786c01db5af52 (patch)
treedcc65675b340f4ba93bfcf8d4edd9c7a4d16dc6c /core/syntax.zig
parentb44a129a8854483dbe45ce2bcfa09f33ccbd6e8c (diff)
downloadpardes-89b3e7365bac28c4cd7d52d40c1786c01db5af52.tar.gz
pardes-89b3e7365bac28c4cd7d52d40c1786c01db5af52.zip
body_layer: a motion root's level paints its targets in the gutter while it shows: `g` its first and last lines, the window's top and bottom and the last edit (`g e t b .`); `]` the next and `[` the previous function, paragraph, test, comment, change, diagnostic, type and argument (`f p T c g d t a`); browsing `m` unrolled on `a` or `i` tints the brackets' region around the caret (pick-ui SPEC §4.4, walk UI line F item 2): the keys are the level's own (bindings.level, each leaf's role), each target looked for in the rows shown alone and a target off them not painted (the tag's arrows of §15 not built): the tree objects through syntax.objectNext given the shown bytes (QueryCursor.setByteRange; the motion passes null), `]g` through jj.nextChange bounded to the shown lines (`most`; the motion unbounded), `]d` a binary search of the fed diagnostics, `]p` the shown lines, `g t`/`g b` normal.gotoWindow's rows; drawn into the body as the `gw` labels are (R3), never written; at rest one test of the view's tag state (TagState.hostOf); the tree is the one the motion reads (normal.fileTree, made once a revision), not painted while the Changes layer's lines are in the buffer; TEST: body_layer.zig "a motion root's level paints its targets in the gutter ..." (`]` p, `g` g e, `m` on i tinted, rest as before); core-test 1025/1192 (167 skipped), 0 failed, load 9
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/syntax.zig')
-rw-r--r--core/syntax.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/syntax.zig b/core/syntax.zig
index 08ea1fb4..a388573b 100644
--- a/core/syntax.zig
+++ b/core/syntax.zig
@@ -566,7 +566,7 @@ pub fn objectAt(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object
/// `]f`/`[f` and kin: the next object starting after byte `at`, or the
/// previous one ending before it (helix goto_treesitter_object), from the
/// first of `.movement`, `.around`, `.inside` the query names.
-pub fn objectNext(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object: Object, forward: bool, at: usize) ?Span {
+pub fn objectNext(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object: Object, forward: bool, at: usize, within: ?[2]usize) ?Span {
const q = objectQuery(path) orelse return null;
var buf: [32]u8 = undefined;
const capture = for ([_][]const u8{ "movement", "around", "inside" }) |kind| {
@@ -576,6 +576,9 @@ pub fn objectNext(path: []const u8, tree_ptr: *anyopaque, text: []const u8, obje
const tree: *const ts.Tree = @ptrCast(@alignCast(tree_ptr));
const cursor = ts.QueryCursor.create();
defer cursor.destroy();
+ // Only the objects these bytes hold (a body's rows shown): its painted
+ // targets (body_layer.paintTargets).
+ if (within) |w| cursor.setByteRange(@intCast(w[0]), @intCast(w[1])) catch return null;
cursor.exec(q, tree.rootNode());
var best: ?Span = null;
while (cursor.nextMatch()) |match| {