From a5a5b10acd58de15e8446dfd76e40fe0e14bb508 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Mon, 10 Oct 2022 23:15:58 -0400 Subject: [PATCH] review comments --- helix-core/src/auto_pairs.rs | 3 +++ helix-term/tests/test/auto_pairs.rs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helix-core/src/auto_pairs.rs b/helix-core/src/auto_pairs.rs index 42616321ad2ee..310a658176962 100644 --- a/helix-core/src/auto_pairs.rs +++ b/helix-core/src/auto_pairs.rs @@ -272,6 +272,9 @@ fn handle_open(doc: &Rope, selection: &Selection, pair: &Pair) -> Transaction { let next_char = doc.get_char(cursor); let len_inserted; + // Since auto pairs are currently limited to single chars, we're either + // inserting exactly one or two chars. When arbitrary length pairs are + // added, these will need to be changed. let change = match next_char { Some(_) if !pair.should_close(doc, start_range) => { len_inserted = 1; diff --git a/helix-term/tests/test/auto_pairs.rs b/helix-term/tests/test/auto_pairs.rs index 126b5139d1996..b3bd6c91d6c2e 100644 --- a/helix-term/tests/test/auto_pairs.rs +++ b/helix-term/tests/test/auto_pairs.rs @@ -28,8 +28,9 @@ async fn insert_basic() -> anyhow::Result<()> { #[tokio::test] async fn insert_configured_multi_byte_chars() -> anyhow::Result<()> { - // [NOTE] these are multi-byte Unicode characters - let pairs = hashmap!('„' => '“', '‚' => '‘'); + // NOTE: these are multi-byte Unicode characters + let pairs = hashmap!('„' => '“', '‚' => '‘', '「' => '」'); + let config = Config { editor: helix_view::editor::Config { auto_pairs: AutoPairConfig::Pairs(pairs.clone()),