Fix erroneous indent between closers of auto-pairs (#5330)

inserting a newline between 2 closers of an auto-pair.
pull/5341/head
Triton171 2 years ago committed by GitHub
parent 7ac72a39cb
commit 5f2fe5fca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,7 @@ pub const DEFAULT_PAIRS: &[(char, char)] = &[
]; ];
/// The type that represents the collection of auto pairs, /// The type that represents the collection of auto pairs,
/// keyed by the opener. /// keyed by both opener and closer.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct AutoPairs(HashMap<char, Pair>); pub struct AutoPairs(HashMap<char, Pair>);

@ -3173,8 +3173,7 @@ pub mod insert {
let on_auto_pair = doc let on_auto_pair = doc
.auto_pairs(cx.editor) .auto_pairs(cx.editor)
.and_then(|pairs| pairs.get(prev)) .and_then(|pairs| pairs.get(prev))
.and_then(|pair| if pair.close == curr { Some(pair) } else { None }) .map_or(false, |pair| pair.open == prev && pair.close == curr);
.is_some();
let local_offs = if on_auto_pair { let local_offs = if on_auto_pair {
let inner_indent = indent.clone() + doc.indent_style.as_str(); let inner_indent = indent.clone() + doc.indent_style.as_str();

Loading…
Cancel
Save