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

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

[elpa] externals/vundo 1737bcee28 18/58: Add vundo-compact-display


From: ELPA Syncer
Subject: [elpa] externals/vundo 1737bcee28 18/58: Add vundo-compact-display
Date: Fri, 15 Apr 2022 12:58:11 -0400 (EDT)

branch: externals/vundo
commit 1737bcee281256e6cb1f51073b245ed62d4c8a64
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Add vundo-compact-display
    
    * vundo.el (vundo-compact-display): New option.
    (vundo--draw-tree): Draw shorter stem according to vundo-compact-display.
---
 vundo.el | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/vundo.el b/vundo.el
index 1f1f346714..5ba9ad4180 100644
--- a/vundo.el
+++ b/vundo.el
@@ -125,6 +125,17 @@
     (last-branch . ?└))
   "Unicode symbols to draw vundo tree.")
 
+(defcustom vundo-compact-display nil
+  "Show a more compact tree display if non-nil.
+Basically we display
+
+    ○─○─○  instead of  ○──○──○
+    │ └─●              │  └──●
+    ├─○                ├──○
+    └─○                └──○
+"
+  :type 'boolean)
+
 (defcustom vundo-glyph-alist vundo-ascii-symbols
   "Alist mapping tree parts to characters used to draw a tree.
 Keys are names for different parts of a tree, values are
@@ -423,18 +434,23 @@ Translate according to ‘vundo-glyph-alist’."
                                     'face 'vundo-stem)))
               ;; Make room for inserting the new node.
               (unless (looking-at "$")
-                (delete-char 3))
+                (delete-char (if vundo-compact-display 2 3)))
               ;; Insert the new node.
               (if (eq (point) planned-point)
-                  (insert (propertize (vundo--translate "──")
-                                      'face 'vundo-stem)
+                  (insert (propertize
+                           (vundo--translate
+                            (if vundo-compact-display "─" "──"))
+                           'face 'vundo-stem)
                           (propertize (vundo--translate "○")
                                       'face 'vundo-node))
                 ;; Delete the previously inserted |.
                 (delete-char -1)
-                (insert (propertize (vundo--translate
-                                     (if node-last-child-p "└──" "├──"))
-                                    'face 'vundo-stem))
+                (insert (propertize
+                         (vundo--translate
+                          (if node-last-child-p
+                              (if vundo-compact-display "└─" "└──")
+                            (if vundo-compact-display "├─" "├──")))
+                         'face 'vundo-stem))
                 (insert (propertize (vundo--translate "○")
                                     'face 'vundo-node))))))
         ;; Store point so we can later come back to this node.



reply via email to

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