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

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

[elpa] externals/vundo 68f2000c4b 2/2: Merge branch 'fix-branch-char2'


From: ELPA Syncer
Subject: [elpa] externals/vundo 68f2000c4b 2/2: Merge branch 'fix-branch-char2'
Date: Tue, 2 May 2023 02:08:10 -0400 (EDT)

branch: externals/vundo
commit 68f2000c4b5d34d2d85b55db9d0903d30c879956
Merge: a33cc17c3e 4886512813
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Merge branch 'fix-branch-char2'
---
 vundo.el | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/vundo.el b/vundo.el
index 1e50b99878..81e35f7ee5 100644
--- a/vundo.el
+++ b/vundo.el
@@ -588,7 +588,10 @@ corresponding to the index of the last saved node."
           (setq last-saved-idx node-idx))
         ;; Go to parent.
         (if parent (goto-char (vundo-m-point parent)))
-        (let ((col (max 0 (1- (current-column)))))
+        (let ((col (max 0 (1- (current-column))))
+              (room-for-another-rx
+               (rx-to-string
+                `(or (>= ,(if vundo-compact-display 3 4) ?\s) eol))))
           (if (null parent)
               (insert (propertize (vundo--translate "○")
                                   'face node-face))
@@ -597,12 +600,20 @@ corresponding to the index of the last saved node."
               ;; Example: 1--2--3  Here we want to add a
               ;;             |     child to 1 but is blocked
               ;;             +--4  by that plus sign.
-              (while (not (looking-at (rx (or "    " eol))))
+              (while (not (looking-at room-for-another-rx))
                 (vundo--next-line-at-column col)
-                (unless (looking-at "$")
-                  (delete-char 1))
-                (insert (propertize (vundo--translate "│")
-                                    'face 'vundo-stem)))
+                ;; When we go down, we could encounter space, EOL, │,
+                ;; ├, or └. Space and EOL should be replaced by │, ├
+                ;; and └ should be replaced by ├.
+                (let ((replace-char
+                       (if (looking-at
+                            (rx-to-string
+                             `(or ,(vundo--translate "├")
+                                  ,(vundo--translate "└"))))
+                           (vundo--translate "├")
+                         (vundo--translate "│"))))
+                  (unless (eolp) (delete-char 1))
+                  (insert (propertize replace-char 'face 'vundo-stem))))
               ;; Make room for inserting the new node.
               (unless (looking-at "$")
                 (delete-char (if vundo-compact-display 2 3)))



reply via email to

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