[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/indent-bars 7e0493f157 280/431: Store and check bol not
From: |
ELPA Syncer |
Subject: |
[elpa] externals/indent-bars 7e0493f157 280/431: Store and check bol not point; no scope recompute on same line |
Date: |
Mon, 16 Sep 2024 12:59:38 -0400 (EDT) |
branch: externals/indent-bars
commit 7e0493f157dcc8eaf4069ad420f8ee8e30edac3d
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
Store and check bol not point; no scope recompute on same line
---
indent-bars-ts.el | 71 ++++++++++++++++++++++++++++---------------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/indent-bars-ts.el b/indent-bars-ts.el
index 0136a632cf..ec78fce0bf 100644
--- a/indent-bars-ts.el
+++ b/indent-bars-ts.el
@@ -222,8 +222,8 @@ mentioned in
`indent-bars-treesit-ignore-blank-lines-types'."
:documentation "The clipping window for the current scope.")
( start-bars 0 :type integer
:documentation "The number of bars shown at start of current scope.")
- ( point -1 :type integer
- :documentation "Point at last scope update.")
+ ( bol-point -1 :type integer
+ :documentation "Point at line beginning during last scope update.")
( tick 0 :type integer
:documentation "Buffer modification tick at last scope update.")
( query nil :type ts-query
@@ -314,39 +314,40 @@ marker movement), refontify the union of old and new
clipped
ranges and update. Note that the updated node range clips to an
\"extended window\" with 50% padding on either side."
(setq indent-bars-ts--scope-timer nil)
- (unless (or (not ibtcs) ; can be called from other buffers!
- (and (= (point) (ibts/point ibtcs))
- (= (buffer-modified-tick) (ibts/tick ibtcs))))
- (when-let ((node (treesit-node-on
- (max (point-min) (1- (point))) (point)
- indent-bars-ts--parser))
- (scope (indent-bars-ts--node-query
- node (ibts/query ibtcs) nil 'innermost
- indent-bars-treesit-scope-min-lines)))
- (let* ((old (ibts/range ibtcs)) ;old node range markers
- (old-clip (ibts/clip-win ibtcs)) ;old clipping window
- (win (cons (window-start) (window-end)))
- (new (cons (treesit-node-start scope) (treesit-node-end scope))))
- (unless (and (equal new old) ; if node is the same and
- (>= (car win) (car old-clip)) ; window inside old range:
- (<= (cdr win) (cdr old-clip))) ; no update needed
- (let* ((marg (/ (- (cdr win) (car win)) 2)) ; a bit of space
- (clip-wide (cons (max (point-min) (- (car win) marg))
- (min (point-max) (+ (cdr win) marg)))))
- (setf (ibts/tick ibtcs) (buffer-modified-tick)
- (ibts/point ibtcs) (point)
- (ibts/start-bars ibtcs)
- (save-excursion
- (goto-char (car new))
- (indent-bars--current-indentation-depth)))
- (cl-loop for rng in (indent-bars-ts--union old new)
- for (beg . end) = (indent-bars-ts--intersection rng
clip-wide)
- do (font-lock-flush beg end))
- (dolist (fn '(car cdr))
- (set-marker (funcall fn (ibts/range ibtcs))
- (funcall fn new))
- (set-marker (funcall fn (ibts/clip-win ibtcs))
- (funcall fn clip-wide)))))))))
+ (let ((lbp (line-beginning-position)))
+ (unless (or (not ibtcs) ; can be called from other buffers!
+ (and (= lbp (ibts/bol-point ibtcs))
+ (= (buffer-modified-tick) (ibts/tick ibtcs))))
+ (when-let ((node (treesit-node-on
+ (max (point-min) (1- (point))) (point)
+ indent-bars-ts--parser))
+ (scope (indent-bars-ts--node-query
+ node (ibts/query ibtcs) nil 'innermost
+ indent-bars-treesit-scope-min-lines)))
+ (let* ((old (ibts/range ibtcs)) ;old node range markers
+ (old-clip (ibts/clip-win ibtcs)) ;old clipping window
+ (win (cons (window-start) (window-end)))
+ (new (cons (treesit-node-start scope) (treesit-node-end scope))))
+ (unless (and (equal new old) ; if node is the same and
+ (>= (car win) (car old-clip)) ; window inside old range:
+ (<= (cdr win) (cdr old-clip))) ; no update needed
+ (let* ((marg (/ (- (cdr win) (car win)) 2)) ; a bit of space
+ (clip-wide (cons (max (point-min) (- (car win) marg))
+ (min (point-max) (+ (cdr win) marg)))))
+ (setf (ibts/tick ibtcs) (buffer-modified-tick)
+ (ibts/bol-point ibtcs) lbp
+ (ibts/start-bars ibtcs)
+ (save-excursion
+ (goto-char (car new))
+ (indent-bars--current-indentation-depth)))
+ (cl-loop for rng in (indent-bars-ts--union old new)
+ for (beg . end) = (indent-bars-ts--intersection rng
clip-wide)
+ do (font-lock-flush beg end))
+ (dolist (fn '(car cdr))
+ (set-marker (funcall fn (ibts/range ibtcs))
+ (funcall fn new))
+ (set-marker (funcall fn (ibts/clip-win ibtcs))
+ (funcall fn clip-wide))))))))))
(defun indent-bars-ts--update-scope ()
"Update treesit scope when possible."
- [elpa] externals/indent-bars 29b7bdc8f9 204/431: Return nil from font-lock face expression functions, (continued)
- [elpa] externals/indent-bars 29b7bdc8f9 204/431: Return nil from font-lock face expression functions, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a282e1bbb8 238/431: use BEG+END for drawing rather than match boundaries, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 85fcf55464 210/431: Merge branch 'main' into treesit-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 2a8cf5a2fa 243/431: Major refactor for STYLE stipple face & support, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 13cebfa12f 229/431: Merge pull request #37 from gekoke/gekoke/nixlang-indentation, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 6116ab7468 263/431: Correctly remove remaps from plists, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 1f575f2404 211/431: Remove unused ts--scope-query, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars b0c138ce17 256/431: teardown whr win-param but not global faces, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars ac949f347e 260/431: Remove unnecessary cleanup on update-all-stipples, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 916dc89ce9 261/431: Do not trust indent-bars-whr window parameter absolutely, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 7e0493f157 280/431: Store and check bol not point; no scope recompute on same line,
ELPA Syncer <=
- [elpa] externals/indent-bars 75498edc35 281/431: docstrings: custom vars, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 1439cc08d1 285/431: create-stipples -> create-stipple-remaps, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a3dc4a81d6 322/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars a7e9554671 326/431: Bump width-frac to 0.375, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars b2ea9c3b47 343/431: treesit scope: save and invalidate old ranges too, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 56bf93a7c3 313/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 0c136d8f68 357/431: Merge branch 'main' into simple-scope, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 5ddaf12da3 375/431: Update README.md, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars 11e639365d 368/431: Add new ts--custom-update-scope to custom-set hook, ELPA Syncer, 2024/09/16
- [elpa] externals/indent-bars b4594e0946 355/431: Correct local stipple update on text-scale, ELPA Syncer, 2024/09/16