[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 959e978986 385/431: invalid ranges: use cus
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 959e978986 385/431: invalid ranges: use custom marker cache |
Date: |
Mon, 16 Sep 2024 12:59:53 -0400 (EDT) |
branch: externals/indent-bars
commit 959e978986e7023bc29904b0bc8a24fbc4eae23f
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
invalid ranges: use custom marker cache
intersect was returning sometimes the old markers, whose positions get
updated.
---
indent-bars-ts.el | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 6d52d31e09..9e0a65b56c 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -381,10 +381,29 @@ ranges of the current scope."
(scope (buffer-local-value 'ibtcs (window-buffer win)))
(rngs (indent-bars-ts--intersect-all
(cons start end) (ibts/invalid-ranges scope))))
- (message "On scroll with %S: %d" (selected-window) start)
+ ;; (message "WS: %s %d" win start)
(cl-loop for (beg . end) in rngs do
(indent-bars-ts--add-bars-in-range beg end))))
+(defvar-local indent-bars-ts--invalid-range-markers nil)
+(defun indent-bars-ts--update-invalid-ranges (ranges)
+ "Update invalid ranges for the current scope with RANGES.
+Also sets the `indent-bars-invalid' property on the indicates
+ranges. Re-uses markers for efficiency."
+ (let* ((lm (length indent-bars-ts--invalid-range-markers))
+ (lr (length ranges)))
+ (when (> lr lm)
+ (dotimes (_ (- lr lm))
+ (push (cons (make-marker) (make-marker))
+ indent-bars-ts--invalid-range-markers))
+ (setq lm lr))
+ (setf (ibts/invalid-ranges ibtcs)
+ (nthcdr (- lm lr) indent-bars-ts--invalid-range-markers))
+ (cl-loop for (beg . end) in ranges
+ for (mbeg . mend) in (ibts/invalid-ranges ibtcs) do
+ (put-text-property beg end 'indent-bars-invalid t)
+ (set-marker mbeg beg) (set-marker mend end))))
+
(defun indent-bars-ts--update-scope1 (buf)
"Perform the treesitter scope font-lock update in buffer BUF.
Re-query the scope node at point, and if it has moved (beyond
@@ -413,9 +432,7 @@ window."
(save-excursion
(goto-char (car new))
(indent-bars--current-indentation-depth)))
- (setf (ibts/invalid-ranges ibtcs) (indent-bars-ts--union old new))
- (cl-loop for (beg . end) in (ibts/invalid-ranges ibtcs) do
- (put-text-property beg end 'indent-bars-invalid t))
+ (indent-bars-ts--update-invalid-ranges (indent-bars-ts--union old
new))
(set-marker (car old) (car new)) ;updates ibts/range
(set-marker (cdr old) (cdr new))
;; Arrange to check the current window's bars, just in case
- [elpa] externals/indent-bars ea1144feae 315/431: always ppss at bol, (continued)
- [elpa] externals/indent-bars ea1144feae 315/431: always ppss at bol, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars fa7047773a 349/431: README improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ad972ba512 337/431: Increment version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 05e23d6145 360/431: README: update with styling-scope information, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 626ea0443e 378/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 827c99d394 332/431: README: FAQ updates, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars c247f02b04 324/431: Reduce out-of-scope default blend to 0.1, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2dcc80f2ba 347/431: docs: mention new scope invalidation improvements, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 8c487907e1 373/431: README: Fix footnote, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 098a5aad79 383/431: Remove clip-win scope slot, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 959e978986 385/431: invalid ranges: use custom marker cache,
ELPA Syncer <=
- [elpa] externals/indent-bars 4974f6c16c 351/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars e557c7a6fa 366/431: New custom-set function for immediate feedback, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a7ecae26dd 370/431: Mention new customize options, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 48c8f7ecff 380/431: cleanup-stipple-remaps: protect needs-cleanup against non-live buf, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d5e6fb0fa9 384/431: Initial window-scroll based supplemental draw, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 4d460b0a02 363/431: Remove \\=' quotes from docstrings, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars d62f1cc825 361/431: Bump version, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars e9443e68c1 371/431: README: version update and footnote for in-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2ca5192273 372/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars b433467d57 376/431: Update README.md, ELPA Syncer, 2024/09/16