[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-goggles 685e3714a5 090/225: Handle a specific u/redo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-goggles 685e3714a5 090/225: Handle a specific u/redo case when the list has 2 connecting items |
Date: |
Wed, 12 Jan 2022 08:58:58 -0500 (EST) |
branch: elpa/evil-goggles
commit 685e3714a59016970428084aad52ba308009d646
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Evgeni Kolev <evgenysw@gmail.com>
Handle a specific u/redo case when the list has 2 connecting items
This handles this scenario: `oinput<esc>u`
---
evil-goggles.el | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/evil-goggles.el b/evil-goggles.el
index 58fed0b313..b111bfb731 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -270,8 +270,38 @@ N and LIST are the arguments of the original function."
"Process LIST and return the first item if it's only one, or nil."
(let* ((processed-list
(cl-remove-if #'null (mapcar #'evil-goggles--undo-elt list))))
- (when (eq 1 (length processed-list))
- (car processed-list))))
+ (message "processed-list %s" processed-list)
+ (cond
+ ;; if there's only item in the list, return it
+ ((eq 1 (length processed-list))
+ (car processed-list))
+
+ ;; check if first and second region are connected:
+ ;; if we have: ((text-added 2 6) (text-added 1 2))
+ ;; then return: ((text-added 1 6))
+ ;;
+ ;; or, if we have: ((text-removed 1 2) (text-removed 2 6))
+ ;; then return: ((text-removed 1 6))
+ ;;
+ ;; TODO this could be more generic, it could work for any number of items
in processed-list
+ ;; for example, this should be handled as well:
+ ;; ((text-added 43 46) (text-added 22 43) (text-added 1 22))
+ ;; should become:
+ ;; ((text-added 1 46))
+ ((and (eq 2 (length processed-list))
+ (eq (caadr processed-list) (caar processed-list)))
+ (let (
+ (change-type (caadr processed-list))
+ (start-of-first-region (nth 1 (nth 0 processed-list)))
+ (end-of-first-region (nth 2 (nth 0 processed-list)))
+ (start-of-second-region (nth 1 (nth 1 processed-list)))
+ (end-of-second-region (nth 2 (nth 1 processed-list))))
+ (message "here1 %s %s" start-of-first-region end-of-second-region)
+ (cond
+ ((eq start-of-first-region end-of-second-region)
+ `(,change-type ,start-of-second-region ,end-of-first-region))
+ ((eq end-of-first-region start-of-second-region)
+ `(,change-type ,start-of-first-region ,end-of-second-region))))))))
(defun evil-goggles--undo-elt (undo-elt)
"Process UNDO-ELT.
- [nongnu] elpa/evil-goggles 0afe8cf165 020/225: Fix no-whitespace check, (continued)
- [nongnu] elpa/evil-goggles 0afe8cf165 020/225: Fix no-whitespace check, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 55ecf5c2c4 045/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 450e153a2d 046/225: Depend on emacs 25 for `funcall-interactively', ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 99d3416598 049/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 9927490983 042/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 08da44cf83 057/225: Add the evil-goggles face, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles ef1cad8f3a 064/225: Re-add paste and fill-and-move, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 179c3002f2 071/225: Update README.md, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 904fc39728 072/225: Add doc for evil-goggles-use-diff-faces, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles e65aa39749 083/225: Add support for block paste, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 685e3714a5 090/225: Handle a specific u/redo case when the list has 2 connecting items,
ELPA Syncer <=
- [nongnu] elpa/evil-goggles 1e9ebe5e4c 095/225: Extend support for u/redo after some text is changed., ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 221a5ed8ea 098/225: Add support for Emacs 24 by not relying on funcall-interactively, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles aaa93841f9 103/225: Update evil-goggles.el, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles f79c03ba62 108/225: Experimental: add support for pulsing, new option`evil-goggles-pulse', ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 9fa3d448ca 112/225: Update "Recent Significant Changes" section in README, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 219d93e125 118/225: Add support for displaying the hint after the operation, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles c5c49d7965 127/225: Use different duration for before/after hints, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 5c313522cf 128/225: Don't call deprecated functions, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 03cb67fc4c 125/225: Remove duplicated line, ELPA Syncer, 2022/01/12
- [nongnu] elpa/evil-goggles 70ed667698 131/225: Fix compile warnings, ELPA Syncer, 2022/01/12