mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
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.
This commit is contained in:
parent
8ff92c7492
commit
c803ef8753
@ -3198,6 +3198,7 @@ pub fn delete_char_backward(cx: &mut Context) {
|
||||
(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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user