diff options
author | Blaž Hrastnik | 2021-04-07 07:39:13 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-04-07 07:39:13 +0000 |
commit | 63e602bda6e6c4381372880f4313aec46170044d (patch) | |
tree | 716ac13aa5a9d14252d2de08c0287609ef5041dd /helix-core/src | |
parent | 4103349be1f1b1b2891b4db9dcfb66255aa7d8c1 (diff) |
Fix issues with "enum A {|}" <Enter> indent calculation.
Diffstat (limited to 'helix-core/src')
-rw-r--r-- | helix-core/src/indent.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 4bd644d4..659783ba 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -106,8 +106,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize { let parent_kind = parent.kind(); let start = parent.start_position().row; - // println!( - // "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={}", + // detect deeply nested indents in the same line + let starts_same_line = start == prev_start; + + // log::error!( + // "name: {}\tparent: {}\trange:\t{} {}\tfirst={:?}\tlast={:?} start={} prev={} same_line={}", // node.kind(), // parent.kind(), // node.range().start_point, @@ -116,14 +119,11 @@ fn calculate_indentation(node: Option<Node>, newline: bool) -> usize { // node.next_sibling().is_none(), // node.start_position(), // prev_start, + // starts_same_line // ); - // detect deeply nested indents in the same line - let starts_same_line = start == prev_start; - - if outdent.contains(&node.kind()) { + if outdent.contains(&node.kind()) && !starts_same_line { // we outdent by skipping the rules for the current level and jumping up - // println!("skipping.."); // node = parent; increment -= 1; // continue; |