From 45a7a4a67f1323b98fc990ddbb2c48d97151e220 Mon Sep 17 00:00:00 2001 From: Yuriy Gabuev Date: Tue, 1 Nov 2022 15:48:43 +0100 Subject: [PATCH] Fix `delete_char_backward` for paired characters (#4558) When backward-deleting a character, if this character and the following character form a Pair, we want to delete both. However, there is a bug that deletes both characters also if both characters are closers of some Pair. This commit fixes that by adding an additional check that the deleted character should be an opener in a Pair. Closes https://github.com/helix-editor/helix/issues/4544. --- helix-term/src/commands.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e6979a649365..78917b505dfe 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3238,6 +3238,7 @@ pub mod insert { (Some(_x), Some(_y), Some(ap)) if range.is_single_grapheme(text) && ap.get(_x).is_some() + && ap.get(_x).unwrap().open == _x && ap.get(_x).unwrap().close == _y => // delete both autopaired characters {