[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/which-key 5fe2d3317d 04/11: Fix horizontal off-by-one e
From: |
ELPA Syncer |
Subject: |
[elpa] externals/which-key 5fe2d3317d 04/11: Fix horizontal off-by-one error |
Date: |
Thu, 11 Aug 2022 12:58:11 -0400 (EDT) |
branch: externals/which-key
commit 5fe2d3317d60411970e662d62ffc05fe5eac7319
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Fix horizontal off-by-one error
Delay increasing width used by columns until we know that we have to
do so because we have determined that there is enough room to add an
additional column and a space between the last two columns.
If we don't do that, then we can easily get an off-by-one error. If
docstrings are shown and the window is narrow, then it is likely that
we end up using the maximal width. If we then add one to the actual
width and later compare that again with the maximal width, then that
is too width.
---
which-key.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/which-key.el b/which-key.el
index 8162d207f7..9d5e403f6d 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1877,7 +1877,7 @@ that width."
(which-key--max-len
col-keys 2
which-key-min-column-description-width)))
- (col-width (+ 1 col-key-width col-sep-width col-desc-width))
+ (col-width (+ col-key-width col-sep-width col-desc-width))
(col-format (concat "%" (int-to-string col-key-width)
"s%s%-" (int-to-string col-desc-width) "s")))
(cons col-width
@@ -1915,10 +1915,10 @@ as well as metadata."
(while (and cols-w-widths
(or (null which-key-max-display-columns)
(< n-columns which-key-max-display-columns))
- (<= (+ (caar cols-w-widths) page-width) avl-width))
+ (<= (+ page-width 1 (caar cols-w-widths)) avl-width))
(setq col (pop cols-w-widths))
(push (cdr col) page-cols)
- (cl-incf page-width (car col))
+ (cl-incf page-width (1+ (car col)))
(cl-incf n-keys (length (cdr col)))
(cl-incf n-columns))
(push (which-key--join-columns page-cols) pages)
- [elpa] externals/which-key 783d6954bc 07/11: Support different types for which-key-max-description-length, (continued)
- [elpa] externals/which-key 783d6954bc 07/11: Support different types for which-key-max-description-length, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 08d57febc4 08/11: Don't make description longer than allowed when truncating, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 245be33189 05/11: Fix vertical off-by-one error, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key e993113868 09/11: Allow truncating without using any ellipsis, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key fe68fe2812 06/11: Avoid unnecessary work, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 16c992f80f 02/11: Displaying just one column means pages are arranged vertically, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 2875fcdc93 10/11: Ignore .DS_Store, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key d924a4a766 01/11: Calculate format string only once, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 254d6fdc2b 03/11: Don't pad beyond maximal width, ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 8093644032 11/11: Merge commit 'pullreqs/343', ELPA Syncer, 2022/08/11
- [elpa] externals/which-key 5fe2d3317d 04/11: Fix horizontal off-by-one error,
ELPA Syncer <=