summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Tham2021-07-24 14:37:33 +0000
committerBlaž Hrastnik2021-07-26 13:36:40 +0000
commitf7c85007972b18bf57c1ed23d40f42d56fe1f470 (patch)
treeefb468c953fcd8cb184307e74eabe7e2a810487d
parent63e54e30a74bb0d1d782877ddbbcf95f2817d061 (diff)
Fix append newline indent
Fix #492
-rw-r--r--helix-core/src/indent.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index 0ca05fb3..5ae66769 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -47,7 +47,7 @@ fn calculate_indentation(query: &IndentQuery, node: Option<Node>, newline: bool)
// NOTE: can't use contains() on query because of comparing Vec<String> and &str
// https://doc.rust-lang.org/std/vec/struct.Vec.html#method.contains
- let mut increment: i32 = 0;
+ let mut increment: isize = 0;
let mut node = match node {
Some(node) => node,
@@ -93,9 +93,7 @@ fn calculate_indentation(query: &IndentQuery, node: Option<Node>, newline: bool)
node = parent;
}
- assert!(increment >= 0);
-
- increment as usize
+ increment.max(0) as usize
}
#[allow(dead_code)]