[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b09765a7114: Fix alignment of columns in Dired display with ls-li
From: |
Eli Zaretskii |
Subject: |
master b09765a7114: Fix alignment of columns in Dired display with ls-lisp |
Date: |
Sat, 23 Dec 2023 06:04:08 -0500 (EST) |
branch: master
commit b09765a7114a92fbb71dad50a44a66938723624d
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix alignment of columns in Dired display with ls-lisp
* lisp/dired.el (dired-align-file): Don't realign the first column
of file's data. (Bug#67953)
---
lisp/dired.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/dired.el b/lisp/dired.el
index 357787b6495..5239e568de1 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1613,14 +1613,21 @@ BEG..END is the line where the file info is located."
;; 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)))))
+ ;; It is never TRT to realign the first column of
+ ;; file's data. But the code below does attempt to
+ ;; realign the first column if there's no whitespace
+ ;; before it, so we force it to let the first column
+ ;; alone.
+ (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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b09765a7114: Fix alignment of columns in Dired display with ls-lisp,
Eli Zaretskii <=