all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73032: 31.0.50; vtable header is not aligned
@ 2024-09-04 22:45 Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-09-05  7:36 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-04 22:45 UTC (permalink / raw)
  To: 73032

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]


Hi,

There is a problem in vtable.el when an emoji is specified as a delimiter; the
header and row delimiters are not aligned.

Minimal reproducer for emacs -Q:

(require 'vtable)
(with-current-buffer (get-buffer-create "*test*")
  (make-vtable
   :columns '((:name "Name" :width 20) "Size" "File")
   :objects (buffer-list)
   :actions '("k" kill-buffer
              "RET" display-buffer)
   :divider " 🍉 "
   :getter (lambda (object column vtable)
             (pcase (vtable-column vtable column)
               ("Name" (buffer-name object))
               ("Size" (buffer-size object))
               ("File" (or (buffer-file-name object) "")))))
  (switch-to-buffer "*test*"))

Screenshot is attached.

[-- Attachment #2: screenshot --]
[-- Type: image/png, Size: 177987 bytes --]

[-- Attachment #3: Type: text/plain, Size: 12762 bytes --]



In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0)
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/s0lycm77a6whmzzg0q7gx5wgd5q0ghms-emacs-rrr-next-31.0.50-56.d277123
 --enable-fast-install --with-pgtk --without-libsystemd
 --with-tree-sitter --with-native-compilation --with-cairo
 --with-modules --with-native-compilation=aot --disable-build-details'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: /home/akagi/.guix-home/profile/share/emacs/site-lisp:/gnu/store/s0lycm77a6whmzzg0q7gx5wgd5q0ghms-emacs-rrr-next-31.0.50-56.d277123/share/emacs/31.0.50/lisp
  value of $EMACSNATIVELOADPATH: /home/akagi/.guix-home/profile/lib/emacs/native-site-lisp
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  eshell-syntax-highlighting-global-mode: t
  gnus-topic-mode: t
  hl-line-mode: t
  gnus-undo-mode: t
  telega-adblock-mode: t
  global-telega-mnz-mode: t
  telega-root-auto-fill-mode: t
  telega-contact-birthdays-mode: t
  telega-active-video-chats-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  telega-active-stories-mode: t
  server-mode: t
  eros-mode: t
  debbugs-browse-mode: t
  bug-reference-mode: t
  envrc-global-mode: t
  envrc-mode: t
  savehist-mode: t
  electric-pair-mode: t
  midnight-mode: t
  global-so-long-mode: t
  company-posframe-mode: t
  global-company-mode: t
  company-mode: t
  fancy-battery-mode: t
  reverse-im-mode: t
  vertico-mode: t
  marginalia-mode: t
  mood-line-mode: t
  global-auto-revert-mode: t
  save-place-mode: t
  recentf-mode: t
  pixel-scroll-precision-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/gnu/store/4j9d9a72igkwlls5jw9y0v2vnx3r1a7d-emacs-soap-client-3.2.3/share/emacs/site-lisp/soap-client-3.2.3/soap-client hides /gnu/store/s0lycm77a6whmzzg0q7gx5wgd5q0ghms-emacs-rrr-next-31.0.50-56.d277123/share/emacs/31.0.50/lisp/net/soap-client
/gnu/store/4j9d9a72igkwlls5jw9y0v2vnx3r1a7d-emacs-soap-client-3.2.3/share/emacs/site-lisp/soap-client-3.2.3/soap-inspect hides /gnu/store/s0lycm77a6whmzzg0q7gx5wgd5q0ghms-emacs-rrr-next-31.0.50-56.d277123/share/emacs/31.0.50/lisp/net/soap-inspect
/gnu/store/ww19l89x34crra4wqcyxbhm1l5nzx5aa-emacs-compat-30.0.0.0/share/emacs/site-lisp/compat-30.0.0.0/compat hides /gnu/store/s0lycm77a6whmzzg0q7gx5wgd5q0ghms-emacs-rrr-next-31.0.50-56.d277123/share/emacs/31.0.50/lisp/emacs-lisp/compat

Features:
(shadow dired-x diff-hl-dired gnus-dired av-guix plz vtable help-fns
radix-tree cl-print debug backtrace av-video av-comm link-hint goto-addr
rect flow-fill qp sort smerge-mode diff smiley gnus-cite mail-extr
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check gnus-async gnus-bcklg gnus-ml nndoc gnus-dup git-link
display-line-numbers debbugs-gnu add-log debbugs-compat debbugs
soap-client rng-xsd rng-dt rng-util xsd-regexp info-colors info
project-rg rg rg-info-hack rg-menu rg-ibuffer rg-result wgrep-rg wgrep
rg-history rg-header ibuf-ext ibuffer ibuffer-loaddefs consult-imenu
eshell-syntax-highlighting eshell-prompt-extras em-tramp em-unix
em-script em-prompt em-pred em-ls em-hist em-extpipe em-cmpl em-dirs
em-basic em-alias em-glob esh-mode esh-var em-term term disp-table ehelp
pcmpl-args pcmpl-gnu pcmpl-linux pcmpl-unix eshell esh-cmd esh-ext
esh-proc esh-opt esh-io esh-arg esh-module esh-module-loaddefs esh-util
copyright mm-archive url-http url-gw url-cache url-auth multitran
oc-basic ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc ol-info
ol-gnus nnselect ol-docview doc-view jka-compr ol-bibtex bibtex ol-bbdb
ol-w3m ol-doi org-link-doi denote tmr-notification misearch
multi-isearch al-scheme arei arei-macroexpansion arei-module
arei-evaluation arei-overlay arei-spinner arei-completion arei-xref
arei-eldoc arei-syntax arei-client arei-nrepl queue sesman scheme
find-dired grep av-message gnus-topic hl-line nndraft nnmh epa-file
network-stream nsm nnmaildir nnfolder nnnil gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view
mml-smime smime gnutls dig nntp gnus-cache gnus-sum shr pixel-fill
kinsoku url-file gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud
nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range
gnus-win gnus nnheader range pulsar pulse tmr tramp-cmds etags fileloop
xref face-remap mule-util telega-adblock ol-telega telega-mnz
telega-dired-dwim telega-obsolete telega telega-x embark-consult consult
embark-org embark checkdoc av-vc autoinsert vertico-repeat
telega-tdlib-events telega-webpage telega-match telega-root telega-info
telega-chat visual-fill-column telega-modes image-mode exif
telega-company telega-emoji telega-user telega-notifications
notifications telega-voip telega-msg telega-story telega-tme
telega-sticker telega-vvnote bindat telega-ffplay telega-i18n
telega-sort telega-filter telega-ins telega-inline telega-util
telega-folders telega-topic telega-media telega-tdlib transient edmacro
kmacro rainbow-identifiers org-element org-persist org-id org-refile
org-element-ast inline avl-tree generator org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src sh-script smie treesit executable
ob-comint org-pcomplete org-list org-footnote org-faces org-entities
noutline outline org-version ob-emacs-lisp ob-core ob-eval org-cycle
org-table ol org-fold org-fold-core org-keys oc org-loaddefs org-compat
org-macs dired-aux telega-server telega-core cursor-sensor color
telega-customize svg dom emacsbug message yank-media puny dired-subtree
dired-hacks-utils dash dired dired-loaddefs rfc822 mml mml-sec epa epg
rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils eiwc server time av-skempo
skempo tempo skeleton mode-local derived package-lint-flymake
package-lint let-alist imenu finder finder-inf find-func lisp-mnt
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers eros flymake compile tramp-sh tramp-cache time-stamp tramp
trampver tramp-integration files-x tramp-message tramp-compat shell
pcomplete comint ansi-osc parse-time iso8601 time-date format-spec
tramp-loaddefs project diff-hl log-view pcvs-util vc-dir ewoc vc
debbugs-browse bug-reference envrc inheritenv ansi-color savehist
elec-pair ffap thingatpt auth-source-pass url-parse auth-source eieio
eieio-core cl-macs password-cache json map byte-opt url-vars midnight
so-long company-files company-keywords company-dabbrev-code
company-dabbrev company-capf company-posframe posframe company pcase
appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
fancy-battery battery dbus xml reverse-im cus-start avy quail av-elisp
spinner-autoloads epl-autoloads pkg-info-autoloads parseclj-autoloads
a-autoloads parseedn-autoloads clojure-mode-autoloads cider-autoloads
xr-autoloads inspector-autoloads orglink-autoloads eplot-autoloads
graphql-ts-mode-autoloads devicetree-ts-mode-autoloads
ts-query-highlight-autoloads try-autoloads svg-lib-autoloads
hammy-autoloads tmr-autoloads queue-autoloads sesman-autoloads
arei-autoloads pulsar-autoloads oauth2-autoloads shikimori-autoloads
al-scheme-autoloads av-autoloads hl-todo-autoloads async-autoloads
password-store-autoloads ledger-mode-autoloads rde-ledger-autoloads
plz-autoloads srht-autoloads soap-client-autoloads debbugs-autoloads
rde-gnus-autoloads rde-browse-url-autoloads emms-autoloads
rde-emms-autoloads mastodon-alt-autoloads ts-autoloads persist-autoloads
request-autoloads mastodon-autoloads telega-contrib-autoloads
rainbow-identifiers-autoloads visual-fill-column-autoloads
telega-autoloads rde-telega-autoloads rde-message-autoloads
denote-autoloads rde-denote-autoloads sdcwoc-autoloads
multitran-autoloads info-colors-autoloads esh-help-autoloads
elisp-demos-autoloads olivetti-autoloads kv-autoloads nov-el-autoloads
saveplace-pdf-view-autoloads tablist-autoloads pdf-tools-autoloads
rde-pdf-tools-autoloads daemons-autoloads bui-autoloads
cuirass-autoloads rde-guix-autoloads diff-hl-autoloads agitate-autoloads
git-timemachine-autoloads git-link-autoloads rde-git-autoloads
package-lint-autoloads eros-autoloads rde-elisp-autoloads
rde-flymake-autoloads ace-window-autoloads wgrep-autoloads rg-autoloads
project-rg-autoloads rde-project-autoloads reverse-im-autoloads
fancy-battery-autoloads sudo-edit-autoloads rde-tramp-autoloads
s-autoloads f-autoloads eimp-autoloads dired-hacks-autoloads
rde-dired-autoloads eshell-prompt-extras-autoloads
eshell-syntax-highlighting-autoloads rde-eshell-autoloads
rde-comint-autoloads skempo-autoloads rde-abbrev-autoloads
link-hint-autoloads avy-autoloads vertico-x-autoloads vertico-autoloads
consult-autoloads posframe-autoloads company-posframe-autoloads
company-autoloads pcmpl-args-autoloads marginalia-autoloads
orderless-autoloads rde-completion-autoloads almost-mono-white-autoloads
mood-line-autoloads rde-startup-autoloads rde-keymaps-autoloads
rde-emacs-base-autoloads rde-compile-autoloads rde-mpv-autoloads
rde-sway-autoloads rde-fonts-autoloads feature-loader-autoloads
feature-loader rde-pass rde-emacs-gnupg rde-ledger rde-tab-bar rde-srht
rde-debbugs rde-gnus rde-browse-url rde-emms rde-mastodon rde-telega
rde-message rde-denote rde-spelling rde-info rde-help rde-nov-el
rde-pdf-tools saveplace-pdf-view bookmark text-property-search rde-xref
rde-guix rde-git vc-git diff-mode track-changes easy-mmode vc-dispatcher
rde-elisp rde-flymake rde-eglot rde-window-ace rde-project
rde-input-method rde-battery rde-calendar rde-tramp rde-dired rde-eshell
rde-comint rde-proced rde-shell rde-abbrev rde-avy rde-vertico vertico-x
vertico rde-completion marginalia compat orderless rde-window
rde-appearance almost-mono-white-theme almost-mono-themes mood-line
rde-emacs-base autorevert filenotify advice cap-words superword subword
saveplace recentf tree-widget rde-keymaps rde-compile rde-envrc
rde-bluetooth rde-transmission rde-mpv rde-sway comp cl-seq comp-cstr
cl-extra help-mode warnings gv comp-run bytecomp byte-compile
comp-common rx rde-fonts xdg fontaine rde-networking
inheritenv-autoloads envrc-autoloads dash-autoloads bluetooth-autoloads
transmission-autoloads mpv-autoloads compat-autoloads embark-autoloads
sway-autoloads fontaine-autoloads eiwc-autoloads guix-emacs cus-edit pp
cus-load icons wid-edit cl-loaddefs cl-lib pixel-scroll cua-base ring
subr-x rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/pgtk-win
pgtk-win term/common-win touch-screen pgtk-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 4245885 714044) (symbols 48 74479 20)
 (strings 32 667716 148824) (string-bytes 1 17025465)
 (vectors 16 143987) (vector-slots 8 2345893 284611)
 (floats 8 369959 2426) (intervals 56 82140 8542) (buffers 992 77))


-- 
Best regards,
Aleksandr Vityazev

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#73032: 31.0.50; vtable header is not aligned
  2024-09-04 22:45 bug#73032: 31.0.50; vtable header is not aligned Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-05  7:36 ` Eli Zaretskii
  2024-09-05 16:39   ` Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-09-05  7:36 UTC (permalink / raw)
  To: Aleksandr Vityazev; +Cc: 73032

> Date: Thu, 05 Sep 2024 01:45:14 +0300
> From:  Aleksandr Vityazev via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> There is a problem in vtable.el when an emoji is specified as a delimiter; the
> header and row delimiters are not aligned.
> 
> Minimal reproducer for emacs -Q:
> 
> (require 'vtable)
> (with-current-buffer (get-buffer-create "*test*")
>   (make-vtable
>    :columns '((:name "Name" :width 20) "Size" "File")
>    :objects (buffer-list)
>    :actions '("k" kill-buffer
>               "RET" display-buffer)
>    :divider " 🍉 "
>    :getter (lambda (object column vtable)
>              (pcase (vtable-column vtable column)
>                ("Name" (buffer-name object))
>                ("Size" (buffer-size object))
>                ("File" (or (buffer-file-name object) "")))))
>   (switch-to-buffer "*test*"))
> 
> Screenshot is attached.

I cannot get them aligned even if I replace the Emoji character with
an ASCII character, like 'x'.  Can you?

AFAICT, there's inconsistency in whitespace calculation between the
header line and the body of the table, due to the desire to display
the sorting indicator not quite right-aligned.  The patch below
attempts to fix that; does it give good results?

diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el
index cb7ea39..dd26ccd 100644
--- a/lisp/emacs-lisp/vtable.el
+++ b/lisp/emacs-lisp/vtable.el
@@ -722,15 +722,17 @@ vtable--insert-header-line
                    (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 @@ vtable--insert-header-line
                 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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#73032: 31.0.50; vtable header is not aligned
  2024-09-05  7:36 ` Eli Zaretskii
@ 2024-09-05 16:39   ` Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-09-07  8:28     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-05 16:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 73032

On 2024-09-05 10:36, Eli Zaretskii wrote:

>> Date: Thu, 05 Sep 2024 01:45:14 +0300
>> From:  Aleksandr Vityazev via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> There is a problem in vtable.el when an emoji is specified as a delimiter; the
>> header and row delimiters are not aligned.
>> 
>> Minimal reproducer for emacs -Q:
>> 
>> (require 'vtable)
>> (with-current-buffer (get-buffer-create "*test*")
>>   (make-vtable
>>    :columns '((:name "Name" :width 20) "Size" "File")
>>    :objects (buffer-list)
>>    :actions '("k" kill-buffer
>>               "RET" display-buffer)
>>    :divider " 🍉 "
>>    :getter (lambda (object column vtable)
>>              (pcase (vtable-column vtable column)
>>                ("Name" (buffer-name object))
>>                ("Size" (buffer-size object))
>>                ("File" (or (buffer-file-name object) "")))))
>>   (switch-to-buffer "*test*"))
>> 
>> Screenshot is attached.
>
> I cannot get them aligned even if I replace the Emoji character with
> an ASCII character, like 'x'.  Can you?
No, I can't.

> AFAICT, there's inconsistency in whitespace calculation between the
> header line and the body of the table, due to the desire to display
> the sorting indicator not quite right-aligned.  The patch below
> attempts to fix that; does it give good results?

The patch helped, but there are still some issues. I was able to achieve
alignment with the following settings:
(set-face-attribute 'default nil :family "monospace" :height 210)

With: (set-face-attribute 'default nil :family "monospace" :height 220)
the header separators are also misaligned. My patch is based on the one
that was sent; I just commented out the insertion of an extra space
after the column name.

diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el
index cb7ea397314..e5bcb54f28e 100644
--- a/lisp/emacs-lisp/vtable.el
+++ b/lisp/emacs-lisp/vtable.el
@@ -722,15 +722,17 @@ vtable--insert-header-line
                    (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 @@ vtable--insert-header-line
                 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,10 @@ vtable--insert-header-line
                                   (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)))))
+         ;; (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")


-- 
Best regards,
Aleksandr Vityazev





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#73032: 31.0.50; vtable header is not aligned
  2024-09-05 16:39   ` Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-07  8:28     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-09-07  8:28 UTC (permalink / raw)
  To: Aleksandr Vityazev; +Cc: 73032-done

> From: Aleksandr Vityazev <avityazev@disroot.org>
> Cc: 73032@debbugs.gnu.org
> Date: Thu, 05 Sep 2024 19:39:37 +0300
> 
> On 2024-09-05 10:36, Eli Zaretskii wrote:
> 
> >> Date: Thu, 05 Sep 2024 01:45:14 +0300
> >> From:  Aleksandr Vityazev via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >> 
> >> There is a problem in vtable.el when an emoji is specified as a delimiter; the
> >> header and row delimiters are not aligned.
> >> 
> >> Minimal reproducer for emacs -Q:
> >> 
> >> (require 'vtable)
> >> (with-current-buffer (get-buffer-create "*test*")
> >>   (make-vtable
> >>    :columns '((:name "Name" :width 20) "Size" "File")
> >>    :objects (buffer-list)
> >>    :actions '("k" kill-buffer
> >>               "RET" display-buffer)
> >>    :divider " 🍉 "
> >>    :getter (lambda (object column vtable)
> >>              (pcase (vtable-column vtable column)
> >>                ("Name" (buffer-name object))
> >>                ("Size" (buffer-size object))
> >>                ("File" (or (buffer-file-name object) "")))))
> >>   (switch-to-buffer "*test*"))
> >> 
> >> Screenshot is attached.
> >
> > I cannot get them aligned even if I replace the Emoji character with
> > an ASCII character, like 'x'.  Can you?
> No, I can't.
> 
> > AFAICT, there's inconsistency in whitespace calculation between the
> > header line and the body of the table, due to the desire to display
> > the sorting indicator not quite right-aligned.  The patch below
> > attempts to fix that; does it give good results?
> 
> The patch helped, but there are still some issues. I was able to achieve
> alignment with the following settings:
> (set-face-attribute 'default nil :family "monospace" :height 210)
> 
> With: (set-face-attribute 'default nil :family "monospace" :height 220)
> the header separators are also misaligned. My patch is based on the one
> that was sent; I just commented out the insertion of an extra space
> after the column name.

Thanks, I've now installed the changes with your modification, and I'm
therefore closing this bug.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-07  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 22:45 bug#73032: 31.0.50; vtable header is not aligned Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05  7:36 ` Eli Zaretskii
2024-09-05 16:39   ` Aleksandr Vityazev via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-07  8:28     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.