emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/indent-bars 945418c86d 112/431: current-indentation-dep


From: ELPA Syncer
Subject: [elpa] externals/indent-bars 945418c86d 112/431: current-indentation-depth: fallback to naive indent
Date: Mon, 16 Sep 2024 12:59:19 -0400 (EDT)

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

    current-indentation-depth: fallback to naive indent
    
    if the context nodes are not identified
---
 indent-bars.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/indent-bars.el b/indent-bars.el
index 0374e81e3b..a7b9712b6f 100644
--- a/indent-bars.el
+++ b/indent-bars.el
@@ -740,13 +740,14 @@ starting line's depth."
         (p (point)))
     (when-let (((/= p (point-min)))
               (node (treesit-node-on (1- p) p indent-bars--ts-lang)))
-      (if (and indent-bars-no-descend-string
-              (string= (treesit-node-type node) indent-bars--string-content))
-         (min d (1+ (/ (indent-bars--indent-at-node node) 
indent-bars-spacing)))
-       (if-let ((indent-bars--ts-node-types)
-                (ctx (treesit-parent-until node 
#'indent-bars--treesit-node-match t)))
-           (min d (1+ (/ (indent-bars--indent-at-node ctx) 
indent-bars-spacing)))
-         d)))))
+      (or
+       (if (and indent-bars-no-descend-string
+               (string= (treesit-node-type node) indent-bars--string-content))
+          (min d (1+ (/ (indent-bars--indent-at-node node) 
indent-bars-spacing)))
+        (if-let ((indent-bars--ts-node-types)
+                 (ctx (treesit-parent-until node 
#'indent-bars--treesit-node-match t)))
+            (min d (1+ (/ (indent-bars--indent-at-node ctx) 
indent-bars-spacing)))))
+       d))))
 
 ;;;; No stipple (e.g. terminal)
 (defvar indent-bars--no-stipple-chars nil)
@@ -831,7 +832,7 @@ indicated, even if otherwise they would be."
                                  (indent-bars--current-indentation-depth)))))
                 0)
          (goto-char beg)
-         (while (<= (point) (1- end))  ;note: end extends 1 char beyond blank 
line range
+         (while (<= (point) (1- end)) ;note: end extends 1 char beyond blank 
line range
            (let* ((bp (line-beginning-position))
                   (ep (line-end-position))
                   (len (- ep bp))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]