[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 687cd7f205 1/3: fix tab bar count logic
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 687cd7f205 1/3: fix tab bar count logic |
Date: |
Wed, 6 Nov 2024 15:58:29 -0500 (EST) |
branch: externals/indent-bars
commit 687cd7f205be4af921b0580c5d5a47f4d9a76ac3
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
fix tab bar count logic
When tab-width is small, an infinite loop was encountered. May also
have explained missing bars in tab-rich small-spacing modes like
emacs-lisp-mode. See #86.
---
indent-bars.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/indent-bars.el b/indent-bars.el
index 097f8ecc80..d05584cec7 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -1058,12 +1058,12 @@ Bars are displayed using stipple properties or
characters; see
?\s))))
(defun indent-bars--tab-display (style p off bar-from max &rest r)
- "Display up to MAX bars on the tab at P, offseting them by OFF.
+ "Display up to MAX bars on the tab at P, offsetting them by OFF.
Bars are spaced by `indent-bars-spacing' and displayed with style
STYLE. BAR-FROM is the bar number for the first bar. Other
arguments R are passed to `indent-bars--blank-string'. Returns
the number of bars actually displayed."
- (let* ((nb (min max (/ (- tab-width off -1) indent-bars-spacing)))
+ (let* ((nb (min max (1+ (/ (- tab-width off 1) indent-bars-spacing))))
(str (apply #'indent-bars--blank-string style off nb
bar-from tab-width r)))
(put-text-property p (+ p 1) 'indent-bars-display str)
@@ -1107,7 +1107,7 @@ needed."
(if (<= switch-after 0) (setq switch-after t))) ; switch the rest
(cl-incf bar bars-drawn)
(cl-incf vp (* bars-drawn indent-bars-spacing)))
- (cl-incf start (+ (mod vp tab-width) (/ vp tab-width))))
+ (cl-incf start (+ (/ vp tab-width) (mod vp tab-width))))
(when (<= bar nbars) ; still bars to show
(if indent-bars--no-stipple
(setq prop 'indent-bars-display fun #'indent-bars--no-stipple-char)