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.
commitc803ef8753bc828c9c68f40878d9467ead50dc0d
authorYuriy Gabuev <yugabuev@gmail.com>
dateTue 1 Nov 2022, 15:48 (4 years ago)
parent8ff92c7
helix-term/src/commands.rs+1
@@ -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 {