commit f2d12756210f16377ce081bae9ab8fc992b89b0c
parent 9b7e5e3a320d036640ac28a82e09bc2455e9394d
Author: Wojciech Siewierski <wojciech@siewierski.eu>
Date: Sun, 21 Jul 2024 12:30:27 +0200
Fix display of the overlays created with kmacro-x-mc-mark-at-click
Diffstat:
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/kmacro-x-mc-extra.el b/kmacro-x-mc-extra.el
@@ -58,7 +58,8 @@ Some code borrowed from `mc/toggle-cursor-on-click'."
(throw 'cursor ov))))
(let ((ov (make-overlay point (1+ point) nil t)))
(unless kmacro-x-mc-mode
- (let ((kmacro-x-mc-mark-whole-symbol nil))
+ (let ((kmacro-x-mc-mark-whole-symbol nil)
+ (kmacro-x-mc--bounds-override (cons (point) (1+ (point)))))
(kmacro-x-mc-mode 1)))
(overlay-put ov 'face 'kmacro-x-mc-cursor-face)
(overlay-put ov 'offsets '(0 . 0))
diff --git a/kmacro-x-mc.el b/kmacro-x-mc.el
@@ -337,6 +337,13 @@ If region is active, merely deactivate it instead."
(define-key map (kbd "M-RET") #'kmacro-x-mc-apply-one)
map))
+(defvar kmacro-x-mc--bounds-override nil
+ "An alternate boundaries of the edited text element.
+
+Unless it's non-nil, the boundaries of the symbol at point are
+used. This variable can override this behavior in commands using
+different semantics, for instance mouse-placed cursors.")
+
(define-minor-mode kmacro-x-mc-mode
"Record a keyboard macro to apply with multiple cursors.
@@ -348,11 +355,8 @@ user directory.
(if kmacro-x-mc-mode
(let ((bounds (if (use-region-p)
(cons (region-beginning) (region-end))
- (or (bounds-of-thing-at-point 'symbol)
- ;; A technically correct fallback.
- ;; Relevant mostly for the alternative ways to
- ;; create cursors such as mouse clicks.
- (cons (point) (1+ (point)))))))
+ (or kmacro-x-mc--bounds-override
+ (bounds-of-thing-at-point 'symbol)))))
(let ((regexp (regexp-quote
(buffer-substring-no-properties