Skip to content

Commit

Permalink
Fix erroneous indent between closers of auto-pairs (helix-editor#5330)
Browse files Browse the repository at this point in the history
inserting a newline between 2 closers of an auto-pair.
  • Loading branch information
Triton171 authored and semin-park committed Jan 4, 2023
1 parent 50a5ad6 commit 60c241a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helix-core/src/auto_pairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>);

Expand Down
3 changes: 1 addition & 2 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 60c241a

Please sign in to comment.