Skip to content

Commit 5f2fe5f

Browse files
authored
Fix erroneous indent between closers of auto-pairs (#5330)
inserting a newline between 2 closers of an auto-pair.
1 parent 7ac72a3 commit 5f2fe5f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

helix-core/src/auto_pairs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)]
2222
pub struct AutoPairs(HashMap<char, Pair>);
2323

helix-term/src/commands.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

0 commit comments

Comments
 (0)