[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/ws-butler 7553d6392a 36/64: Handle adding back text during
From: |
Stefan Kangas |
Subject: |
[nongnu] elpa/ws-butler 7553d6392a 36/64: Handle adding back text during undo correctly. |
Date: |
Fri, 31 Dec 2021 11:09:30 -0500 (EST) |
branch: elpa/ws-butler
commit 7553d6392a0527bad904c45259eed8a7cc361987
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
Handle adding back text during undo correctly.
---
ws-butler.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/ws-butler.el b/ws-butler.el
index 6ff1bbe726..c778d63fbc 100644
--- a/ws-butler.el
+++ b/ws-butler.el
@@ -209,13 +209,20 @@ ensure point doesn't jump due to white space trimming."
(ws-butler-map-changes (lambda (_prop start end)
(remove-list-of-text-properties start end
'(ws-butler-chg))))))
-(defun ws-butler-after-change (beg end leng-before &optional)
- (unless undo-in-progress
- (with-silent-modifications
- (when (and (= beg end) (> leng-before 0))
- ;; deletion
- (setq end (min (+ end 1) (point-max))))
- (put-text-property beg end 'ws-butler-chg t))))
+(defun ws-butler-after-change (beg end length-before)
+ (let ((type (if (and (= beg end) (> length-before 0))
+ 'delete
+ 'chg)))
+ (if undo-in-progress
+ ;; add back deleted text during undo
+ (if (and (zerop length-before)
+ (> end beg)
+ (eq (get-text-property end 'ws-butler-chg) 'delete))
+ (remove-list-of-text-properties end (1+ end) '(ws-butler-chg)))
+ (with-silent-modifications
+ (when (eq type 'delete)
+ (setq end (min (+ end 1) (point-max))))
+ (put-text-property beg end 'ws-butler-chg type)))))
(defun ws-butler-after-save ()
"Restore trimmed whitespace before point."
- [nongnu] elpa/ws-butler 0c941aedeb 31/64: Declare type of keep-whitespace-before-point, (continued)
- [nongnu] elpa/ws-butler 0c941aedeb 31/64: Declare type of keep-whitespace-before-point, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 7d30203cf9 19/64: forgot to trim blanks in README (oh the irony!), Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler fe08e8770b 08/64: update lighter, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 8ca373047a 24/64: Fix point moving if after blanks., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 4154816145 27/64: Clean up end marker., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 106d313c0d 30/64: Fix package problems; bump version to 0.3., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 34393f1aaa 07/64: add install instructions, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 75deadecb9 35/64: Remove dependency on highlight-changes-mode., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler ee0fc31020 52/64: Merge branch 'xificurC-master', Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 76265d11f8 44/64: Debian and Ubuntu installation instructions, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 7553d6392a 36/64: Handle adding back text during undo correctly.,
Stefan Kangas <=
- [nongnu] elpa/ws-butler aa1935f150 37/64: update documentation re: highlight-changes-mode, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 11311538f6 50/64: fix up tests, simplify predicate code a bit., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler a998a23ee8 41/64: Clarify ws-butler-keep-whitespace-before-point docs., Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 9b40da8428 46/64: add exemptions to ws-butler-global-mode, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler e5fc878904 54/64: disable changing leading whitespace by default, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 52321b99be 59/64: Merge pull request #29 from alevy03/master, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 323b651dd7 55/64: bump version, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler a02607ef63 33/64: Some minor grammatical fixes, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler f6ac856b82 13/64: clean up newlines at EOB when appropriate, Stefan Kangas, 2021/12/31
- [nongnu] elpa/ws-butler 81143ac737 25/64: Add customization for virtual space preservation., Stefan Kangas, 2021/12/31