summaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-01-08 07:15:12 +0000
committerBlaž Hrastnik2021-01-08 07:15:12 +0000
commit7d41550a23fc3506a37016d5bc362144fb00c080 (patch)
treedfa3497e8292df6dfac7845f48b7eb36133b7dae /helix-term/src/commands.rs
parent941c34a7fc86e613b41887174c699be52ab202a8 (diff)
indent: refactor logic to be more correct.
Thanks to atom-sane-indentation, nvim-treesitter and tree-sitter-indent.el for inspiration.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 8216437d..a11c3145 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -535,6 +535,7 @@ pub fn open_below(cx: &mut Context) {
cx.view.doc.syntax.as_ref(),
&cx.view.doc.state,
index,
+ true,
);
let indent = " ".repeat(TAB_WIDTH).repeat(indent_level);
let mut text = String::with_capacity(1 + indent.len());
@@ -654,6 +655,7 @@ pub mod insert {
cx.view.doc.syntax.as_ref(),
&cx.view.doc.state,
range.head,
+ true,
);
let indent = " ".repeat(TAB_WIDTH).repeat(indent_level);
let mut text = String::with_capacity(1 + indent.len());