Skip to content

Commit

Permalink
fix(delsel): do not run sp-delete-pair with active region
Browse files Browse the repository at this point in the history
Fixes #703.
  • Loading branch information
Fuco1 committed Mar 25, 2024
1 parent 6c21901 commit 755b62f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -4241,6 +4241,7 @@ is remove the just added wrapping."
;; multiple character, so let him do that
(sp--with-case-sensitive
(when (and (= arg 1)
(not (use-region-p))
smartparens-mode)
(if (and sp-autodelete-wrap
(eq sp-last-operation 'sp-wrap-region))
Expand Down
9 changes: 9 additions & 0 deletions test/smartparens-delete-pair-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,12 @@
(smartparens-strict-mode 1)
(sp-backward-delete-char)
(sp-buffer-equals "\" | \"")))

(ert-deftest sp-test-delete-pair-dont-delete-with-active-region ()
"Fixes #703"
(sp-test-with-temp-elisp-buffer "(|
M)"
(smartparens-strict-mode -1)
(call-interactively 'backward-delete-char)
(should (equal (buffer-string) "()"))))

0 comments on commit 755b62f

Please sign in to comment.