rksm / paredit.js

Generic reader and editor for s-expressions.
MIT License
107 stars 21 forks source link

How is wrapAround supposed to work? #20

Open PEZ opened 5 years ago

PEZ commented 5 years ago

I expect paredit-wrapAround to wrap the current expression if nothing is selected. Currently it wraps the next (forward) expression, and includes whatever of the current expression is forward from the cursor. For instance, if the cursor is on the i in printlin here:

(println (parting "Mark"))

the result is

(pr(intln (parting "Mark")))

Inside strings things get a bit more strange. If the string is the last thing inside some parens en empty list is inserted. So if the cursor is on s in "es" in the below expression:

(println (parting "Mark" "es"))

Result is:

(println (parting "Mark" "e()s"))

But if the string is somewhere else in a paren-enclosed form it often wraps to, and including, the end of the defn/toplevel expression. So if the cursor is on r in "Mark" in the above expression, I get:

(println (parting "Ma(rk" "es")))

which, since the first paren is inside the string, gives an unbalanced expression.