diff options
Diffstat (limited to 'src/modal.zig')
| -rw-r--r-- | src/modal.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/modal.zig b/src/modal.zig index 11eda7b9..316a66fa 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -1773,12 +1773,10 @@ pub fn indentWidth(line: []const u8) usize { return w; } -/// full indent LEVELS of a line as spaces (helix indent_level_for_line: -/// partial levels round down) — what o/O/insert-newline copy. +/// A line's indent as it is, tabs and spaces both, as acme's autoindent +/// copies it: what o/O/insert-newline give the new line. pub fn indentText(line: []const u8) []const u8 { - const level = indentWidth(line) / INDENT_W; - const max = " "; // 8 levels is plenty (ponytail) - return max[0..@min(level * INDENT_W, max.len)]; + return line[0 .. std.mem.indexOfNone(u8, line, " \t") orelse line.len]; } /// Copy full indent levels and add one after (, [, {, or ), without parsing. |
