[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ftable 9f75340 08/14: Make ftable work with CJK charact
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ftable 9f75340 08/14: Make ftable work with CJK characters |
Date: |
Mon, 2 Aug 2021 18:27:32 -0400 (EDT) |
branch: externals/ftable
commit 9f7534079c60c62a9e7256faf9a6726202404982
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Make ftable work with CJK characters
* ftable.el (ftable--parse-to, ftable--max-line-width,
ftable--pad-to): Replace 'length' with 'string-width'.
---
ftable.el | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/ftable.el b/ftable.el
index ca418b3..5af7eda 100644
--- a/ftable.el
+++ b/ftable.el
@@ -189,7 +189,7 @@ It defaults to the first charset."
(make-ftable
:column-width-list
(mapcar (lambda (column)
- (apply #'max (mapcar #'length column)))
+ (apply #'max (mapcar #'string-width column)))
(cl-loop for n from 0 to (1- (length (car matrix)))
collect (ftable--nth-column n matrix)))
:min-width-list
@@ -264,7 +264,6 @@ Assumes each line in LINE-LIST has the same length."
(cl-loop for col from 0 to (1- (length (car matrix)))
collect (ftable--nth-column col matrix)))))
-
;;; Fill
(cl-defmethod ftable--fill ((table ftable) table-max-width)
@@ -365,7 +364,7 @@ Return a new table with shrinked column."
(defun ftable--max-line-width ()
"Return the maximum line width in buffer."
(apply #'max
- (mapcar #'length
+ (mapcar #'string-width
(split-string (buffer-string) "\n"))))
;;; Unparse
@@ -485,8 +484,8 @@ which corresponds to
(defun ftable--pad-to (text width)
"Append padding to TEXT until it is WIDTH characters long.
Return a new string."
- (if (< (length text) width)
- (concat text (make-vector (- width (length text)) ?\s))
+ (if (< (string-width text) width)
+ (concat text (make-vector (- width (string-width text)) ?\s))
text))
;;; Convenience
- [elpa] externals/ftable 63fb0ac 04/14: Add checks for parsing, (continued)
- [elpa] externals/ftable 63fb0ac 04/14: Add checks for parsing, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 9c13bfc 07/14: Add table.el intergration, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 71dcbd0 12/14: Fix beginning- and end-of-table function, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 939cc1b 13/14: Fix typo, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 1ea20be 11/14: Allow non-table lines before and after table, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 96a0475 14/14: Prepare for ELPA, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable a647832 03/14: xx, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 8ff305b 02/14: Not use forward-paragraph, Stefan Monnier, 2021/08/02
- [elpa] externals/ftable e029b2f 10/14: * ftable.el: Add a workaround., Stefan Monnier, 2021/08/02
- [elpa] externals/ftable d2385e3 05/14: * ftable.el (ftable-misc-test): Fix test., Stefan Monnier, 2021/08/02
- [elpa] externals/ftable 9f75340 08/14: Make ftable work with CJK characters,
Stefan Monnier <=
- [elpa] externals/ftable 33b32ba 09/14: * ftable.el (ftable-edit-cell): Fix typos., Stefan Monnier, 2021/08/02