mirror of
https://github.com/vale981/boon
synced 2025-03-04 09:01:39 -05:00
fix bug in repeating a mutiple-cursor replacement op.
This commit is contained in:
parent
74cb03a0ea
commit
2b7a41491d
2 changed files with 9 additions and 7 deletions
|
@ -287,8 +287,10 @@ If there is more than one, use mc/create-fake-cursor-at-point."
|
|||
"Kill the regions REGS, and switch to insertion mode or replay CHANGES."
|
||||
(interactive (list (boon-spec-select-top "replace")))
|
||||
(boon-interactive-insert regs)
|
||||
(let ((markers (mapcar 'boon-reg-to-markers (boon-run-selector regs))))
|
||||
;; use markers so that deleting things does not mess the positions
|
||||
(let ((markers (mapcar 'boon-reg-to-markers (-sort 'boon-reg-before (boon-run-selector regs)))))
|
||||
;; Sort so that the changes recorded will be relative to a consistent position.
|
||||
;; (The actual cursor will be 1st and will not jump around).
|
||||
;; Use markers so that deleting things does not mess the positions
|
||||
(boon-take-region regs)
|
||||
(deactivate-mark t)
|
||||
(if changes ; if we have a change to apply then we do not want to lay new cursors, just apply the changes.
|
||||
|
@ -296,8 +298,7 @@ If there is more than one, use mc/create-fake-cursor-at-point."
|
|||
(dolist (reg markers)
|
||||
(goto-char (boon-reg-point reg))
|
||||
(boon/replay-changes changes)))
|
||||
(boon-lay-multiple-cursors (lambda (reg)
|
||||
(goto-char (boon-reg-point reg)))
|
||||
(boon-lay-multiple-cursors (lambda (reg) (goto-char (boon-reg-point reg)))
|
||||
markers)
|
||||
(boon-insert changes))))
|
||||
|
||||
|
|
|
@ -66,11 +66,12 @@ directed forward, or or before, if the region is backwards."
|
|||
"Given a region REG, return its contents (crop the region by 1)."
|
||||
(boon-mk-reg (+ (boon-reg-begin reg) 1) (- (boon-reg-end reg) 1) (boon-reg-cursor reg)))
|
||||
|
||||
(defun boon-reg-after (r1 r2)
|
||||
"Return non-nil when R1 occurs after R2."
|
||||
(> (boon-reg-begin r1) (boon-reg-end r2)))
|
||||
(defun boon-reg-before (r1 r2)
|
||||
"Return non-nil when R1 occurs before R2."
|
||||
(< (boon-reg-begin r1) (boon-reg-end r2)))
|
||||
|
||||
(defun boon-reg-cur-after (r1 r2)
|
||||
(declare (obsolete "unused" "July 2017"))
|
||||
(or (not (boon-reg-cursor r1))
|
||||
(and (boon-reg-cursor r2)
|
||||
(> (overlay-end (boon-reg-cursor r1))
|
||||
|
|
Loading…
Add table
Reference in a new issue