From f7c85007972b18bf57c1ed23d40f42d56fe1f470 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 24 Jul 2021 22:37:33 +0800 Subject: [PATCH] Fix append newline indent Fix #492 --- helix-core/src/indent.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 0ca05fb3c..5ae667695 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -47,7 +47,7 @@ fn calculate_indentation(query: &IndentQuery, node: Option, newline: bool) // NOTE: can't use contains() on query because of comparing Vec 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, newline: bool) node = parent; } - assert!(increment >= 0); - - increment as usize + increment.max(0) as usize } #[allow(dead_code)]