on master help sign in
Fix erroneous indent between closers of auto-pairs (#5330)

inserting a newline between 2 closers of an auto-pair.

commit5f2fe5fca516fa2b55d3020004ab0cec60251e89 authorTriton171 <daniel.ebert@protonmail.com> dateThu 29 Dec 2022, 16:23 (4 years ago) parent7ac72a3
2 files changed+2−3
helix-core/src/auto_pairs.rs+1−1 helix-term/src/commands.rs+1−2
helix-core/src/auto_pairs.rs+1−1
@@ -17,7 +17,7 @@ pub const DEFAULT_PAIRS: &[(char, char)] = &[
1717];
1818
1919/// The type that represents the collection of auto pairs,
20−/// keyed by the opener.
20+/// keyed by both opener and closer.
2121#[derive(Debug, Clone)]
2222pub struct AutoPairs(HashMap<char, Pair>);
2323
helix-term/src/commands.rs+1−2
@@ -3173,8 +3173,7 @@ pub mod insert {
31733173 let on_auto_pair = doc
31743174 .auto_pairs(cx.editor)
31753175 .and_then(|pairs| pairs.get(prev))
3176− .and_then(|pair| if pair.close == curr { Some(pair) } else { None })
3177− .is_some();
3176+ .map_or(false, |pair| pair.open == prev && pair.close == curr);
31783177
31793178 let local_offs = if on_auto_pair {
31803179 let inner_indent = indent.clone() + doc.indent_style.as_str();