diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CHANGELOG.md | 5 | ||||
| -rw-r--r-- | src/edit.zig | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 6d51311b..764b9815 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -19,7 +19,10 @@ in the library on pardes's own functions, Alt-i going back the way Alt-o came; `replace` rewrites a byte range as one step to undo, the ranges following, and a drag that rewrites a number every frame can - join its frames into one. + join its frames into one. A new line's indent comes from that parse + where its grammar has an indent query (a `Language`'s `indents`), as a + file's does from its own, so a language whose lines end in `)` is not + pushed a level in at every line. - The terminal is a module of its own (`src/term/`: the emulator, its screen state for replicas, kitty images, the pager's parse), which never imports the core and is reached through one table of plain-data diff --git a/src/edit.zig b/src/edit.zig index 32943c19..fe644541 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -762,8 +762,13 @@ pub fn retireEditText(e: Editor, new: []u8) void { } /// helix's indent for a line opened after byte `at` of `row` (indent.zig), -/// from the file's tree, where its grammar has an indent query. +/// from the file's tree, where its grammar has an indent query; in the +/// library, from the parse handed in (normal.nodeTree), its `Language`'s. fn treeIndent(e: Editor, t: *Text, text: []const u8, row: usize, at: usize) Error!?[]const u8 { + if (comptime Editor.lib) { + const tree = normal.nodeTree(e, t, text) orelse return null; + return indents.forNewline(e.scratch, indents.lang(tree.path) orelse return null, tree.root, text, row, at); + } const f = bodyFile(t) orelse return null; const l = indents.lang(f.path) orelse return null; const tree = normal.fileTree(e.p, f) orelse return null; |
