[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/valign b000cca 02/15: Fix alignment for table.el tables
From: |
Stefan Monnier |
Subject: |
[elpa] externals/valign b000cca 02/15: Fix alignment for table.el tables |
Date: |
Tue, 16 Mar 2021 00:01:27 -0400 (EDT) |
branch: externals/valign
commit b000ccafcdf2a690979dfbb58baa09d5e9710190
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Fix alignment for table.el tables
When display-line-number-mode is on.
* valign.el (valign--cell-content-config): Change = to <=.
(valign--pixel-width-from-to): Handle line-number-mode bug
differently (correctly).
---
valign.el | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/valign.el b/valign.el
index bd118ae..3307f31 100644
--- a/valign.el
+++ b/valign.el
@@ -252,10 +252,10 @@ right bar."
;; as cell content, rather than to consider it as part of the
;; padding and add overlay over it.
(list cell-beg
- (if (= (- content-beg-strict cell-beg) 1)
+ (if (<= (- content-beg-strict cell-beg) 1)
content-beg-strict
(1- content-beg-strict))
- (if (= (- cell-end content-end-strict) 1)
+ (if (<= (- cell-end content-end-strict) 1)
content-end-strict
(1+ content-end-strict))
cell-end)))))
@@ -308,16 +308,16 @@ width. BAR-CHAR is the bar character (“|”)."
The buffer has to be in a live window. FROM has to be less than
TO and they should be on the same line. Valign display
properties must be cleaned before using this."
- ;; HACK: You would expect (window-text-pixel-size WINDOW FROM TO) to
- ;; return line-number-display-width when FROM equals to TO, but no,
- ;; it returns 0. Then if we still subtract line number width, we
- ;; get a negative number. So if FROM = TO, we simply return 0.
- (if (eq from to)
- 0
- (- (car (window-text-pixel-size
- nil (line-beginning-position) to))
- (car (window-text-pixel-size
- nil (line-beginning-position) from)))))
+ (- (car (window-text-pixel-size
+ nil (line-beginning-position) to))
+ (+ (car (window-text-pixel-size
+ nil (line-beginning-position) from))
+ ;; HACK: You would expect (window-text-pixel-size WINDOW
+ ;; FROM TO) to return line-number-display-width when FROM
+ ;; equals to TO, but no, it returns 0.
+ (if (eq (line-beginning-position) from)
+ (line-number-display-width 'pixel)
+ 0))))
(defun valign--pixel-x (point)
"Return the x pixel position of POINT."
- [elpa] externals/valign updated (223407d -> 2035143), Stefan Monnier, 2021/03/16
- [elpa] externals/valign b000cca 02/15: Fix alignment for table.el tables,
Stefan Monnier <=
- [elpa] externals/valign 6b0345e 03/15: Make at-table-p testing stricter, Stefan Monnier, 2021/03/16
- [elpa] externals/valign 49209b4 05/15: * README-CN.org: Touch up on phrasing., Stefan Monnier, 2021/03/16
- [elpa] externals/valign 2035143 15/15: * README-CN.org (自定义): Add descriptions for some variables., Stefan Monnier, 2021/03/16
- [elpa] externals/valign acdb551 01/15: Really really fix org-indent and line-number problem, Stefan Monnier, 2021/03/16
- [elpa] externals/valign b6a0dcd 04/15: Add Chinese README, Stefan Monnier, 2021/03/16
- [elpa] externals/valign e8a5ce1 07/15: Remove note about org-indent-mode + line-numbers-mode, Stefan Monnier, 2021/03/16
- [elpa] externals/valign f5db1ef 06/15: ; * README.org: Change link to Chinese README., Stefan Monnier, 2021/03/16
- [elpa] externals/valign db5145a 14/15: * README.org (Customization): Add description for some variables., Stefan Monnier, 2021/03/16
- [elpa] externals/valign ccbcc1c 10/15: Fix alignment for Unicode tables, Stefan Monnier, 2021/03/16
- [elpa] externals/valign 16ff947 08/15: Patch an outline bug., Stefan Monnier, 2021/03/16