diff options
Diffstat (limited to 'src/normal.zig')
| -rw-r--r-- | src/normal.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/normal.zig b/src/normal.zig index fc6da633..e95a5798 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -207,9 +207,11 @@ pub fn appendSearchLiteral(out: *std.ArrayList(u8), arena: std.mem.Allocator, te /// kept until the next: never made again for a key that changed nothing. pub fn fileTree(p: *Pardes, f: *panes.File.State) ?*anyopaque { if (f.node_tree == null or f.node_tree_revision != f.revision) { - if (f.node_tree) |old| syntax.freeTree(old); - f.node_tree = syntax.parseTree(f.path, f.content); + const old = f.node_tree; + f.node_tree = syntax.parseTree(f.path, f.content, if (f.node_tree_edits == f.revision) old else null); + if (old) |o| syntax.freeTree(o); f.node_tree_revision = f.revision; + f.node_tree_edits = f.revision; for (f.node_history.items) |step| p.gpa.free(step.ranges); f.node_history.clearRetainingCapacity(); } |
