You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and type "%%" when the region consists of "text" and point is after the last "t", the result is
%%text%|%
with point before the last closing "%". From what I can tell, a simple fix would be to change the definition of wrap-region-with to this
(defunwrap-region-with (leftright)
"Wraps region with LEFT and RIGHT."
(run-hooks'wrap-region-before-wrap-hook)
(let ((beg (region-beginning))
(end (region-end))
(pos (point))
(deactivate-marknil))
(save-excursion
(goto-char beg)
(insert left)
(goto-char (+ end (length left)))
(insert right))
;; (if (= pos end) (forward-char 1))
(if (= pos end) (forward-char (length right)))
(if wrap-region-keep-mark
(let* ((beg-p (eq beg pos))
(beg* (+ beg (length left)))
(end* (+ end (length left))))
(push-mark (if beg-p end* beg*) nilt)
(goto-char (if beg-p beg* end*)))
(deactivate-mark)))
(run-hooks'wrap-region-after-wrap-hook))
where the commented out line is in the original definition, and the one immediately below it is the proposed change. Happy to submit a pull request if you think that'd be a good idea.
The text was updated successfully, but these errors were encountered:
To be honest I think you're better of using Smartparens (https://github.com/Fuco1/smartparens). I don't use wrap-region anymore, so I don't really have that strong of an opinion. Perhaps someone else does?
From what I can tell,
wrap-region
doesn't play nicely with multi-character wrappers.If use something like this:
and type "%%" when the region consists of "text" and point is after the last "t", the result is
with point before the last closing "%". From what I can tell, a simple fix would be to change the definition of
wrap-region-with
to thiswhere the commented out line is in the original definition, and the one immediately below it is the proposed change. Happy to submit a pull request if you think that'd be a good idea.
The text was updated successfully, but these errors were encountered: