[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/valign 82be45d 198/198: Bug fix
From: |
Stefan Monnier |
Subject: |
[elpa] externals/valign 82be45d 198/198: Bug fix |
Date: |
Tue, 1 Dec 2020 18:19:48 -0500 (EST) |
branch: externals/valign
commit 82be45d66cc48c074ab760307ded17dc8d635686
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Bug fix
* valign.el (valign--clean-text-property): Fix the problem that the
first line is not cleaned.
(valign--table-2): Measure char-width after cleaning text properties.
---
valign.el | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/valign.el b/valign.el
index 9ae26f4..0ff7b7d 100644
--- a/valign.el
+++ b/valign.el
@@ -593,10 +593,8 @@ before event, ACTION is either 'entered or 'left."
(when (overlay-get ov 'valign)
(delete-overlay ov))))
;; Remove text properties.
- (let ((p beg) tab-end last-p)
+ (let ((p beg) tab-end (last-p -1))
(while (not (eq p last-p))
- (setq last-p p
- p (next-single-char-property-change p 'valign nil end))
(when (plist-get (text-properties-at p) 'valign)
;; We are at the beginning of a tab, now find the end.
(setq tab-end (next-single-char-property-change
@@ -604,7 +602,9 @@ before event, ACTION is either 'entered or 'left."
;; Remove text property.
(with-silent-modifications
(put-text-property p tab-end 'display nil)
- (put-text-property p tab-end 'valign nil))))))
+ (put-text-property p tab-end 'valign nil)))
+ (setq last-p p
+ p (next-single-char-property-change p 'valign nil end)))))
(defun valign--glyph-width-of (string point)
"Return the pixel width of STRING with font at POINT.
@@ -822,15 +822,17 @@ Assumes point is at (2).
(valign--beginning-of-table)
(let* ((charset (valign--guess-charset))
(ucharset (alist-get 'unicode valign-box-charset-alist))
- (char-width (with-silent-modifications
- (insert (valign-box-char 1 ucharset))
- (prog1 (valign--pixel-width-from-to
- (1- (point)) (point))
- (backward-delete-char 1))))
(table-beg (point))
(table-end (save-excursion (valign--end-of-table) (point)))
;; Very hacky, but..
(_ (valign--clean-text-property table-beg table-end))
+ ;; Measure char width after cleaning text properties.
+ ;; Otherwise the measurement is not accurate.
+ (char-width (with-silent-modifications
+ (insert (valign-box-char 'h ucharset))
+ (prog1 (valign--pixel-width-from-to
+ (1- (point)) (point))
+ (backward-delete-char 1))))
(column-width-list
;; Make every width multiples of CHAR-WIDTH.
(mapcar (lambda (x)
- [elpa] externals/valign 80cf682 121/198: Remove some internal variables, (continued)
- [elpa] externals/valign 80cf682 121/198: Remove some internal variables, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 9daeab8 071/198: * valign.el (valign-table-quite): Really ignore errors., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 09e89aa 105/198: * valign.el (valign--at-table-p): Don’t align org blocks., Stefan Monnier, 2020/12/01
- [elpa] externals/valign e91abf2 112/198: Extract out boilerplate from valign-table, Stefan Monnier, 2020/12/01
- [elpa] externals/valign d799e31 181/198: ; * valign.el (valign--cell-content-config): Fix typo., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 9fc0c11 149/198: Use new function to calculate space and bar width, Stefan Monnier, 2020/12/01
- [elpa] externals/valign d18aea8 183/198: Improve error handling, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 62766e7 184/198: Add custom group, Stefan Monnier, 2020/12/01
- [elpa] externals/valign bf68d39 171/198: Remove single-column style, Stefan Monnier, 2020/12/01
- [elpa] externals/valign ce1a53c 188/198: ; * test.org: Update., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 82be45d 198/198: Bug fix,
Stefan Monnier <=
- [elpa] externals/valign cf3a794 099/198: Fix: cursor disappears on bars when fancy-bar is t, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 0e77a02 164/198: Add some commands that suppresses auto alignment, Stefan Monnier, 2020/12/01
- [elpa] externals/valign 7afe578 182/198: Improve documentation, Stefan Monnier, 2020/12/01
- [elpa] externals/valign e0362c0 156/198: * valign.el (valign-region): Report to jit-lock the actual end of fontified region., Stefan Monnier, 2020/12/01
- [elpa] externals/valign 841925f 189/198: Remove all advice when they are not needed, Stefan Monnier, 2020/12/01
- [elpa] externals/valign e438083 103/198: Change text property to overlay, Stefan Monnier, 2020/12/01
- [elpa] externals/valign cd2b563 191/198: * valign.el: Bump version to 3.0.0., Stefan Monnier, 2020/12/01