[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67953: 30.0.50; ls-lisp messes up columns
From: |
Stefan Monnier |
Subject: |
bug#67953: 30.0.50; ls-lisp messes up columns |
Date: |
Fri, 22 Dec 2023 10:31:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> The simple kludge below, which simply prevents it from realigning the
> first column of data, seems to fix it here. WDYT?
Looks OK to me. I'd recommend we add a comment about this (zerop
curcol) test explaining why the other branch mishandles this
case (or mentioning that we don't know why).
Stefan
> diff --git a/lisp/dired.el b/lisp/dired.el
> index cc548ba..3838368 100644
> --- a/lisp/dired.el
> +++ b/lisp/dired.el
> @@ -1572,14 +1572,16 @@ dired-align-file
> ;; the beginning or the end of the next field, depending on
> ;; whether this field is left or right aligned).
> (align-pt-offset
> - (save-excursion
> - (goto-char other)
> - (move-to-column curcol)
> - (when (looking-at
> - (concat
> - (if (eq (char-before) ?\s) " *" "[^ ]* *")
> - (if num-align "[0-9][^ ]*")))
> - (- (match-end 0) (match-beginning 0)))))
> + (if (zerop curcol)
> + 0
> + (save-excursion
> + (goto-char other)
> + (move-to-column curcol)
> + (when (looking-at
> + (concat
> + (if (eq (char-before) ?\s) " *" "[^ ]* *")
> + (if num-align "[0-9][^ ]*")))
> + (- (match-end 0) (match-beginning 0))))))
> ;; Now, the number of spaces to insert is align-pt-offset
> ;; minus the distance to the equivalent point on the
> ;; current line.