emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/csv-mode 797c322 13/34: Fix column width calculation in


From: Stefan Monnier
Subject: [elpa] externals/csv-mode 797c322 13/34: Fix column width calculation in cvs-mode.el
Date: Sun, 29 Nov 2020 18:46:14 -0500 (EST)

branch: externals/csv-mode
commit 797c3223fe952b23bd0440695f1919a126fd44bf
Author: Leo Liu <sdl.web@gmail.com>
Commit: Leo Liu <sdl.web@gmail.com>

    Fix column width calculation in cvs-mode.el
    
    * csv-mode/cvs-mode.el (csv--column-widths, csv-align-fields): Fix
      column width calculation.
---
 csv-mode.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/csv-mode.el b/csv-mode.el
index 692579d..1e20f8c 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -5,7 +5,7 @@
 ;; Author: Francis J. Wright <F.J.Wright at qmul.ac.uk>
 ;; Time-stamp: <23 August 2004>
 ;; URL: http://centaur.maths.qmul.ac.uk/Emacs/
-;; Version: 1.4
+;; Version: 1.5
 ;; Keywords: convenience
 
 ;; This package is free software; you can redistribute it and/or modify
@@ -964,18 +964,17 @@ The fields yanked are those last killed by 
`csv-kill-fields'."
     (while (not (eobp))                   ; for each record...
       (or (csv-not-looking-at-record)
           (let ((w widths)
-                (beg (point))            ; Beginning of current field.
+                (col (current-column))
                 x)
             (while (not (eolp))
               (csv-end-of-field)
-              (setq x (- (point) beg))    ; Field width.
+              (setq x (- (current-column) col)) ; Field width.
               (if w
                   (if (> x (car w)) (setcar w x))
                 (setq w (list x)
                       widths (nconc widths w)))
               (or (eolp) (forward-char))  ; Skip separator.
-              (setq w (cdr w)
-                    beg (point)))))
+              (setq w (cdr w) col (current-column)))))
       (forward-line))
     widths))
 
@@ -1021,8 +1020,8 @@ If there is no selected region, default to the whole 
buffer."
                        (align-padding (if (bolp) 0 csv-align-padding))
                        (left-padding 0) (right-padding 0)
                        (field-width
-                        ;; FIXME: Don't assume length=string-width!
-                        (progn (csv-end-of-field) (- (point) beg)))
+                        (- (- (current-column)
+                              (progn (csv-end-of-field) (current-column)))))
                        (column-width (pop w))
                        (x (- column-width field-width))) ; Required padding.
                   (set-marker end (point)) ; End of current field.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]