summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 16:41:37 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit78daa25e5c99cc0d71da36b6e0dcdd362b0cb284 (patch)
treefd98816559ccd4f4a54b1993a7defa39a4f7fda2 /src/edit.zig
parent686673bfb67ac80ed464351528d9ab1bceaa1d02 (diff)
downloadpardes-78daa25e5c99cc0d71da36b6e0dcdd362b0cb284.tar.gz
pardes-78daa25e5c99cc0d71da36b6e0dcdd362b0cb284.zip
Tab after text leaves the syntax node in insert mode; Shift-Tab indents
helix smart_tab: in insert mode, Tab where text precedes the cursor on its line moves past the end of the node the cursor is in, the parent-node end of Alt-e; in leading blanks it indents. Only where the file has a grammar: the reference pins smart tab off, which a file without a grammar agrees with, so there Tab still indents. Shift-Tab is insert_tab, and the differential harness now reads the S- modifier. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/edit.zig b/src/edit.zig
index 39050b9d..01b34237 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -13,6 +13,7 @@ const body_layer = @import("body_layer.zig");
const config = @import("config.zig");
const pdf_enabled = panes.Pdf.enabled;
const lsp = @import("lsp/lsp.zig");
+const syntax = @import("syntax.zig");
const platform = pardes.platform;
const Pane = panes.Pane;
const Text = panes.Text;
@@ -929,6 +930,17 @@ fn insertEdit(p: *Pardes, t: *Text, key: Key) void {
p.lspRequest(p.active, .completion, "");
if (p.lsp_seq != seq) return;
}
+ // helix smart_tab: after text, Tab leaves the syntax node the
+ // cursor is in; only where the file has a grammar, since the
+ // reference pins smart tab off, which a file without one agrees
+ // with. Shift-Tab always types the tab.
+ const after_text = std.mem.indexOfNone(u8, ln[0..@min(c.col, ln.len)], " \t") != null;
+ if (!key.shift and after_text and t.what == .body) smart: {
+ const pane = t.pane() orelse break :smart;
+ const f = pane.file orelse break :smart;
+ if (!syntax.supportsPath(f.path)) break :smart;
+ return normal.nodeSelect(p, pane, t, .parent_end);
+ }
insertTab(p, t);
},
else => {},