emacs-diffs
[Top][All Lists]
Advanced

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

master 5017f2573f: Fix vtable-insert-object line insertion


From: Lars Ingebrigtsen
Subject: master 5017f2573f: Fix vtable-insert-object line insertion
Date: Sat, 8 Oct 2022 09:26:30 -0400 (EDT)

branch: master
commit 5017f2573f7f878a05f82f69d96e50a6f4d78ec0
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix vtable-insert-object line insertion
    
    * lisp/emacs-lisp/vtable.el (vtable-insert-object): Pass in the
    correct ellipsis values (bug#58370).
    (vtable--insert-line): Don't bug out on missing optional arguments.
---
 lisp/emacs-lisp/vtable.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el
index 9bdf90bf1d..de8503a1cb 100644
--- a/lisp/emacs-lisp/vtable.el
+++ b/lisp/emacs-lisp/vtable.el
@@ -353,6 +353,11 @@ This also updates the displayed table."
     (let* ((cache (vtable--cache table))
            (inhibit-read-only t)
            (keymap (get-text-property (point) 'keymap))
+           (ellipsis (if (vtable-ellipsis table)
+                         (propertize (truncate-string-ellipsis)
+                                     'face (vtable-face table))
+                       ""))
+           (ellipsis-width (string-pixel-width ellipsis))
            (elem (and after-object
                       (assq after-object (car cache))))
            (line (cons object (vtable--compute-cached-line table object))))
@@ -370,7 +375,8 @@ This also updates the displayed table."
         ;; FIXME: We have to adjust colors in lines below this if we
         ;; have :row-colors.
         (vtable--insert-line table line 0
-                             (nth 1 cache) (vtable--spacer table))
+                             (nth 1 cache) (vtable--spacer table)
+                             ellipsis ellipsis-width)
         (add-text-properties start (point) (list 'keymap keymap
                                                  'vtable table)))
       ;; We may have inserted a non-numerical value into a previously
@@ -516,7 +522,8 @@ This also updates the displayed table."
                   (if (> (nth 1 elem) (elt widths index))
                       (concat
                        (vtable--limit-string
-                        pre-computed (- (elt widths index) ellipsis-width))
+                        pre-computed (- (elt widths index)
+                                        (or ellipsis-width 0)))
                        ellipsis)
                     pre-computed))
                  ;; Recompute widths.
@@ -524,7 +531,8 @@ This also updates the displayed table."
                   (if (> (string-pixel-width value) (elt widths index))
                       (concat
                        (vtable--limit-string
-                        value (- (elt widths index) ellipsis-width))
+                        value (- (elt widths index)
+                                 (or ellipsis-width 0)))
                        ellipsis)
                     value))))
                (start (point))



reply via email to

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