smartparens
smartparens copied to clipboard
Inserting ) with a highlighted pair selection visible jumps to enclosing ) instead
I don't understand how to reproduce this.
I type (
then the text, then I go back then I hit (
then I hit )
and the result is what I expected
(foo
()| bar
baz)
This isn't quite right. I type the list, move point to the start of the second item, insert a paren pair, delete the closing paren, move point to the end of the second item, then type a closing paren. I expect a closing paren to be inserted (like with every self-inserting key). Instead point moves to the outer closing paren and the highlighting stops. If I go back again and attempt inserting the closing paren another time, it works. Almost as if Smartparens were in a special state while the area between delimiters is highlighted...
Now with less prose:
Typing the list:
(foo
bar
baz)|
Positioning point at the start of the second list item:
(foo
|bar
baz)
Typing (
results in a pair:
(foo
(|)bar
baz)
I delete the )
with DEL
:
(foo
(|bar
baz)
Positioning point at the end of the second list item:
(foo
(bar|
baz)
Typing )
doesn't insert anything and moves point to the end instead:
(foo
(bar
baz)|
Positioning point at the start of the second list item (again):
(foo
|(bar
baz)
Positioning point at the end of the second list item (again):
(foo
(bar|
baz)
Now typing )
works as expected:
(foo
(bar)|
baz)
What does DEL
call?
That it jumps out is expected, SP doesn't parse the entire buffer to figure out if you are not balanced. As soon as it finds a working pair it jumps out in strict mode. In non-strict mode it inserts the closing thing.
The thing is that I'm not using strict mode at all, so this behaviour surprises me. Even more so when it works as expected after canceling the pair content highlighting. DEL
calls delete-forward-char
.
What is sp-autoskip-closing-pair
set to? I can't repro this so far.
It's set to always-end
.
Perhaps all I need to do is updating Smartparens...
I've updated Smartparens and can still reproduce this ._.
When the pair is "active" and you type the closing delimiter it jumps out, so yes it is in a special state.
What should happen is the state should be cancelled when you enter another insertion... probably.
With strict mode disabled and (setq-local sp-autoskip-closing-pair 'always-end)
it now inserts the closing paren at the first insertion properly. Can you confirm this?