Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dead10ck committed Oct 19, 2022
1 parent faf9b8b commit a5a5b10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions helix-core/src/auto_pairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions helix-term/tests/test/auto_pairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down

0 comments on commit a5a5b10

Please sign in to comment.