branch: elpa/undo-fu
commit 1ecbe826aecb9892eaf0b57180700a987584201e
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>
Fix undo-fu-only-redo-all counting incorrectly
Setting last-command caused the count to be incorrect.
---
undo-fu.el | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/undo-fu.el b/undo-fu.el
index c1c2a32da1..a97abd894d 100644
--- a/undo-fu.el
+++ b/undo-fu.el
@@ -201,6 +201,14 @@ Optional argument ARG The number of steps to redo."
(let*
(
+ ;; Important to clamp before assigning 'last-command'
+ ;; since it's used when checking the available steps.
+ (steps
+ (if (numberp arg)
+ (if (and undo-fu--respect undo-fu--checkpoint)
+ (undo-fu--count-redo-available undo-fu--checkpoint arg)
+ arg)
+ 1))
(last-command
(cond
(was-undo
@@ -212,12 +220,6 @@ Optional argument ARG The number of steps to redo."
(t
;; No change.
last-command)))
- (steps
- (if (numberp arg)
- (if (and undo-fu--respect undo-fu--checkpoint)
- (undo-fu--count-redo-available undo-fu--checkpoint arg)
- arg)
- 1))
(success
(condition-case err
(progn
@@ -281,6 +283,7 @@ Optional argument ARG the number of steps to undo."
;; Swap in 'undo' for our own function name.
;; Without this undo won't stop once the first undo step is reached.
(
+ (steps (or arg 1))
(last-command
(cond
(was-undo-or-redo
@@ -289,7 +292,6 @@ Optional argument ARG the number of steps to undo."
(t
;; No change.
last-command)))
- (steps (or arg 1))
(success
(condition-case err
(progn