Skip to content

Commit 67d0279

Browse files
ygabuevFrederik Vestre
authored andcommitted
Fix delete_char_backward for paired characters (helix-editor#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 helix-editor#4544.
1 parent 6d00cfe commit 67d0279

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

helix-term/src/commands.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,6 +3198,7 @@ pub mod insert {
31983198
(Some(_x), Some(_y), Some(ap))
31993199
if range.is_single_grapheme(text)
32003200
&& ap.get(_x).is_some()
3201+
&& ap.get(_x).unwrap().open == _x
32013202
&& ap.get(_x).unwrap().close == _y =>
32023203
// delete both autopaired characters
32033204
{

0 commit comments

Comments
 (0)