From 68b696ead861bb416c339f624bea82ed478bb2dd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 23 Nov 2026 15:38:37 -0300 Subject: changes layer: the node keys and the indent parse the FILE's text, as every other parse does (round 8 left them parsing the buffer with the layer's lines in it): `normal.fileTree` parses `File.fileText` (the buffer itself with no layer: a length test), and `Editor.Tree` carries the text it parsed and the file whose buffer the keys' places are of, `in` (a buffer place as the tree's: `File.fileOffset`) and `out` (back: `File.bufferOffset`, a range's end before the layer's lines standing there; the library's text is its own: both the identity at comptime): Alt-o and kin (`nodeSelect`: the walk asked in the file's places, its spans mapped back), `]f` and kin (`objectJump`), a tree-sitter text object (`maf` and kin, edit.zig), and `o`'s indent (`treeIndent`: the file's text, row and offset with the layer shown; unchanged with none); `File.edit` tells the kept tree of no edit with the layer's lines in the buffer or going in or out (`told`, `read_only`): it is the file's text's, parsed anew at the next key; THE FAILING TEST FIRST (core/jj.zig "the node keys and the indent read the file's text ..."): with the layer shown and hidden, the cursor on `c2();`, Alt-o once, twice and three times and `maf` give the same range of the file's text (9P's `dot`), and `o` the same new line: on the round's base the function's text object selected nothing beside the layer's lines (27..27 where hidden 0..34: the description line in the buffer broke the function's parse); with this, equal; core-test filtered on jj (Debug tui) 55/55 Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/lib_editor.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/lib_editor.zig') diff --git a/core/lib_editor.zig b/core/lib_editor.zig index 3fe631af..3e4a1f15 100644 --- a/core/lib_editor.zig +++ b/core/lib_editor.zig @@ -585,7 +585,7 @@ pub const Syntax = struct { if (!syntax_impl.addLanguage(lang)) return null; s.tree = @ptrCast(@alignCast(syntax_impl.parseTree(path, text, null) orelse return null)); } - return .{ .root = s.tree.?, .path = path, .history = &s.history, .gpa = std.heap.page_allocator }; + return .{ .root = s.tree.?, .path = path, .history = &s.history, .gpa = std.heap.page_allocator, .text = text, .file = {} }; } /// One `Syn` a byte of `ed`'s text from `from` to `to`, in `a`. -- cgit v1.3