diff options
author | Triton171 | 2022-12-29 15:23:40 +0000 |
---|---|---|
committer | GitHub | 2022-12-29 15:23:40 +0000 |
commit | 5f2fe5fca516fa2b55d3020004ab0cec60251e89 (patch) | |
tree | e5f446f1c5a567c90ba185dc319d2de2fb3a0e06 | |
parent | 7ac72a39cbcaeda31c717418bde068f9bfc32d0e (diff) |
Fix erroneous indent between closers of auto-pairs (#5330)
inserting a newline between 2 closers of an auto-pair.
-rw-r--r-- | helix-core/src/auto_pairs.rs | 2 | ||||
-rw-r--r-- | helix-term/src/commands.rs | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/helix-core/src/auto_pairs.rs b/helix-core/src/auto_pairs.rs index 072c93d0..31f9d364 100644 --- a/helix-core/src/auto_pairs.rs +++ b/helix-core/src/auto_pairs.rs @@ -17,7 +17,7 @@ pub const DEFAULT_PAIRS: &[(char, char)] = &[ ]; /// The type that represents the collection of auto pairs, -/// keyed by the opener. +/// keyed by both opener and closer. #[derive(Debug, Clone)] pub struct AutoPairs(HashMap<char, Pair>); diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 437e11b5..7ee1d77c 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3173,8 +3173,7 @@ pub mod insert { let on_auto_pair = doc .auto_pairs(cx.editor) .and_then(|pairs| pairs.get(prev)) - .and_then(|pair| if pair.close == curr { Some(pair) } else { None }) - .is_some(); + .map_or(false, |pair| pair.open == prev && pair.close == curr); let local_offs = if on_auto_pair { let inner_indent = indent.clone() + doc.indent_style.as_str(); |