[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/smartparens 803c9e2880 2/2: fix(wrap): cancel repeated wra
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/smartparens 803c9e2880 2/2: fix(wrap): cancel repeated wrapping after point moves forward |
Date: |
Wed, 18 Jan 2023 14:02:05 -0500 (EST) |
branch: elpa/smartparens
commit 803c9e28808a04a1510932912c99002f339ddba9
Author: Matus Goljer <matus.goljer@gmail.com>
Commit: Matus Goljer <matus.goljer@gmail.com>
fix(wrap): cancel repeated wrapping after point moves forward
Fixes #1084
---
smartparens.el | 5 ++---
test/smartparens-wrapping-test.el | 3 ++-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/smartparens.el b/smartparens.el
index d1fec70249..b67d95e389 100644
--- a/smartparens.el
+++ b/smartparens.el
@@ -3388,7 +3388,6 @@ provided values."
(e (make-marker)))
(set-marker b beg)
(set-marker e end)
- (set-marker-insertion-type e t)
`(:beg ,b :end ,e :op ,open :cl ,close :prefix "")))
;; Wrapping is basically the same thing as insertion, only the closing
@@ -3979,7 +3978,7 @@ active region."
((= 2 sp-wrap-repeat-last)))
(memq sp-last-operation '(sp-self-insert sp-wrap-region))
(or (= (point) (+ b oplen acolen))
- (= (point) e)))
+ (= (point) (+ e acolen))))
(delete-char (- acolen))
(if (< (point) e)
(progn (goto-char (+ b oplen))
@@ -3997,7 +3996,7 @@ active region."
(insert (cdr active-pair))
(setq sp-last-wrapped-region
(sp--make-last-wraped-region
- b e (car active-pair) (cdr active-pair))))
+ b (+ e acolen) (car active-pair) (cdr active-pair))))
(setq sp-last-operation 'sp-wrap-region)
(sp--run-hook-with-args (car active-pair) :post-handlers 'wrap)
sp-last-operation)))))
diff --git a/test/smartparens-wrapping-test.el
b/test/smartparens-wrapping-test.el
index 832d7e012f..d5216b7d19 100644
--- a/test/smartparens-wrapping-test.el
+++ b/test/smartparens-wrapping-test.el
@@ -75,7 +75,8 @@
(ert-deftest sp-test-wrap-repeated nil
(let ((sp-pairs sp--test-basic-pairs))
(sp-test-wrapping "|aM" "[[" "[[|a]]")
- (sp-test-wrapping "Ma|" "[[" "[[a]]|")))
+ (sp-test-wrapping "Ma|" "[[" "[[a]]|")
+ (sp-test-wrapping "Ma|" "[ [" "[a] [|]")))
(ert-deftest sp-test-wrap-repeated-wrap-only-pair nil
(let ((sp-pairs