branch: externals/indent-bars
commit b9a980bf80b4313d1a90bb99a5d26cbec359c575
Author: JD Smith <93749+jdtsm...@users.noreply.github.com>
Commit: JD Smith <93749+jdtsm...@users.noreply.github.com>

    Initial support for `variable-pitch-mode'
---
 indent-bars.el | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/indent-bars.el b/indent-bars.el
index f551d3667b..7c64195a8e 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -930,12 +930,22 @@ Useful for calling after theme changes."
        (ibs/no-stipple-chars style) (indent-bars--create-no-stipple-chars 
style 7))
 
   ;; Base stipple face
-  (face-spec-set
-   (ibs/stipple-face style)
-   (indent-bars--stipple-face-spec
-    (frame-char-width) (frame-char-height)
-    (indent-bars--stipple-rot (selected-window) (frame-char-width))
-    style))
+  (let ((width (or (and (bound-and-true-p variable-pitch-mode)
+                       (with-silent-modifications
+                         (let ((inhibit-read-only t))
+                           (unwind-protect
+                               (save-excursion
+                                 (insert-before-markers ?\s)
+                                 (when-let ((wh (posn-object-width-height 
(posn-at-point (1- (point))))))
+                                   (message "indent-bars: using variable pitch 
width = %d" (car wh))
+                                   (car wh)))
+                             (delete-char -1)))))
+                  (frame-char-width))))
+    (face-spec-set
+     (ibs/stipple-face style)
+     (indent-bars--stipple-face-spec width (frame-char-height)
+      (indent-bars--stipple-rot (selected-window) width)
+      style)))
 
   ;; Current depth highlight faces/stipple
   (setf (ibs/current-bg-color style)

Reply via email to