emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/undo-tree 2fd006f 055/195: Fixed bug in undo-tree-inser


From: Stefan Monnier
Subject: [elpa] externals/undo-tree 2fd006f 055/195: Fixed bug in undo-tree-insert triggered by undo-tree-visualizer-set.
Date: Sat, 28 Nov 2020 13:41:20 -0500 (EST)

branch: externals/undo-tree
commit 2fd006f455ebcaf0770ff00517768570cd9ea0a0
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>

    Fixed bug in undo-tree-insert triggered by undo-tree-visualizer-set.
    
    If transient-mark-mode is enabled and the mark is active, 
backward-delete-char
    will delete the region rather than a single character. We now avoid this by
    making sure the mark is inactive before deleting.
---
 undo-tree.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index b44dd5e..d712916 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -299,7 +299,7 @@
 ;;                             o
 ;;
 ;; But if you're unlucky, and you happen to have moved the point (say) after
-;; getting to the point labelled "got this far", then you've "broken the undo
+;; getting to the state labelled "got this far", then you've "broken the undo
 ;; chain". Hold on to something solid, because things are about to get
 ;; hairy. If you try to undo now, Emacs thinks you're trying to undo the
 ;; undos! So to get back to the initial state you now have to rewind through
@@ -320,7 +320,7 @@
 ;;                             o       :   o
 ;;                                     :
 ;;                             (got this far, but
-;;                              broke undo chain)
+;;                              broke the undo chain)
 ;;
 ;; Confused?
 ;;
@@ -1701,6 +1701,9 @@ Argument is a character, naming the register."
   (dotimes (i arg) (insert str))
   (setq arg (* arg (length str)))
   (undo-tree-move-forward arg)
+  ;; make sure mark isn't active, otherwise `backward-delete-char' might
+  ;; delete region instead of single char if transient-mark-mode is enabled
+  (setq mark-active nil)
   (backward-delete-char arg)
   (when (boundp 'undo-tree-insert-face)
     (put-text-property (- (point) arg) (point) 'face undo-tree-insert-face)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]