Repeated wrapping via sp-wrap-repeat-last behaves oddly when point > mark
Expected behavior
Repeated wrapping of active region has same semantics depending on whether point < mark or point > mark
Actual behavior
It seems to act unexpectedly when wrapping a region with point > mark
Steps to reproduce the problem
- Enable smartparens-mode, with sp-wrap-repeat-last either 1 or 2. No other post-self-insert-hooks.
- Type in "abc".
- Move point to start of line, set mark, and move to end of line. So mark is at "a" and point is after "c" with region active.
- Press "(". This wraps the active region. So we now have "(abc)", point is after ")", and region is inactive.
- Type in "de". We see "(abc)de" and point is after "e".
- Press "(". This wraps everything on the line to give "((abc)de)"
- I can repeat like this to get "((((abc)de)efghi)jkl)" and so on.
I mean, this is not an error, and possibly it's the expected behaviour, but it seems odd. It seems that if I wrap a region and point is after the wrapped region, additional typing does not clear sp-last-wrapped-region, though other things do (movement commands, C-g, minibuffer, etc). By contrast, if I wrap a region and point is before the wrapped region, additional typing does clear sp-last-wrapped-region, as I would have expected.
Environment & version information
In recent enough smartparens you can call M-x sp-describe-system to generate this report. Please fill manually what we could not detect automatically. Edit the output as you see fit to protect your privacy.
smartparensversion: 20201229.1937- Active
major-mode:emacs-lisp-mode - Smartparens strict mode: nil
- Emacs version (
M-x emacs-version): GNU Emacs 27.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2020-08-12 - Starterkit/Distribution: Vanilla
- OS: darwin