diff options
author | Eli Zaretskii <eliz@gnu.org> | 2024-09-07 11:27:03 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-09-07 11:27:03 +0300 |
commit | 04c44405bf604380c575fa2a4d9611af0f3bc0d9 (patch) | |
tree | c8c2c80cd33a0535acaeab9eee2e17f4cf582985 /lisp/emacs-lisp | |
parent | 4d6fadb8d2146218fd573dc8b6ccfcab59fbfb93 (diff) | |
download | emacs-04c44405bf604380c575fa2a4d9611af0f3bc0d9.tar.gz emacs-04c44405bf604380c575fa2a4d9611af0f3bc0d9.tar.bz2 emacs-04c44405bf604380c575fa2a4d9611af0f3bc0d9.zip |
Fix alignment and documentation of vtable.el
* lisp/emacs-lisp/vtable.el (vtable--insert-header-line): Ensure
proper alignment between the columns in header-line and in the
body of the table. (Bug#73032)
* doc/misc/vtable.texi (Making A Table): Document the defaults of
the various keyword parameters.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/vtable.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el index cb7ea397314..d58c6894c16 100644 --- a/lisp/emacs-lisp/vtable.el +++ b/lisp/emacs-lisp/vtable.el @@ -722,15 +722,17 @@ This also updates the displayed table." (vtable--limit-string name (- (elt widths index) indicator-width)) name)) - (let ((fill-width - (+ (- (elt widths index) - (string-pixel-width displayed) - indicator-width - (vtable-separator-width table) - ;; We want the indicator to not be quite flush - ;; right. - (/ (vtable--char-width table) 2.0)) - (if last 0 spacer)))) + (let* ((indicator-lead-width + ;; We want the indicator to not be quite flush right. + (/ (vtable--char-width table) 2.0)) + (indicator-pad-width (- (vtable--char-width table) + indicator-lead-width)) + (fill-width + (+ (- (elt widths index) + (string-pixel-width displayed) + indicator-width + indicator-lead-width) + (if last 0 spacer)))) (if (or (not last) (zerop indicator-width) (< (seq-reduce #'+ widths 0) (window-width nil t))) @@ -739,7 +741,9 @@ This also updates the displayed table." displayed (propertize " " 'display (list 'space :width (list fill-width))) - indicator) + indicator + (propertize " " 'display + (list 'space :width (list indicator-pad-width)))) ;; This is the final column, and we have a sorting ;; indicator, and the table is too wide for the window. (let* ((pre-indicator (string-pixel-width @@ -758,10 +762,6 @@ This also updates the displayed table." (list (- fill-width pre-fill)))))))) (when (and divider (not last)) (insert (propertize divider 'keymap dmap))) - (insert (propertize - " " 'display - (list 'space :width (list - (/ (vtable--char-width table) 2.0))))) (put-text-property start (point) 'vtable-column index))) (vtable-columns table)) (insert "\n") |