Subject: bug#44594: tabulated-list-mode: column header needlessly truncated

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 27 Aug 2021 18:41:55 +0200

Stefan Kangas <[email-masked]> writes:

> The column header in tabulated-list-mode is needlessly truncated.
>
> Steps to reproduce:
>
> 0. emacs -Q
> 1. M-x list-buffers RET
> 2. C-x o
> 3. C-4 C-f
> 4. C-1 C-4 {
>
> Result: The header is truncated to "Buff..." even though there is enough
> space to show it all.
>
> Expected result: The header is not truncated.

The issue is basically this:

(truncate-string-to-width "Buffer" 5 nil nil t)
=> "Buff…"

Or...  Uhm...  Oh!  I've never noticed that the mode lets column overlap:

    ;; Truncate labels if necessary (except last column).
    ;; Don't truncate to `width' if the next column is align-right
    ;; and has some space left, truncate to `available-space' instead.
    (when (and not-last-col
	       (> label-width available-space))
      (setq label (truncate-string-to-width
		   label available-space nil nil t t)
	    label-width available-space))

So we allow column data to extend into the next column (if the next
column is right-aligned).  But we don't do the same computation in the
header?  Right.

Now fixed in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no