[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode 71ab6a35e3 5/9: [semantic-highlight] Remove and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode 71ab6a35e3 5/9: [semantic-highlight] Remove and rebuild overlays in file on reload only in changed area |
Date: |
Tue, 6 Dec 2022 05:59:06 -0500 (EST) |
branch: elpa/idris-mode
commit 71ab6a35e3ed83ddc17919185f576b0a4e2fbeaa
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek L <nospam.keram@gmail.com>
[semantic-highlight] Remove and rebuild overlays in file on reload only in
changed area
Why:
Currently when file is reloaded to Idris
all overlays are removed from buffer and added back later.
This causes flashing and bad user experience.
After change only overlays in changed area are removed and redrawn.
---
idris-commands.el | 2 --
idris-highlight-input.el | 53 ++++++++++++++++++++++++++++++------------------
2 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/idris-commands.el b/idris-commands.el
index 9b8eb7ee32..54f558b19a 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -209,8 +209,6 @@ A prefix argument forces loading but only up to the current
line."
(when (get-buffer idris-notes-buffer-name)
(with-current-buffer idris-notes-buffer-name
(let ((inhibit-read-only t)) (erase-buffer))))
- ;; Remove stale semantic highlighting
- (idris-highlight-remove-overlays (current-buffer))
;; Actually do the loading
(let* ((dir-and-fn (idris-filename-to-load))
(fn (cdr dir-and-fn))
diff --git a/idris-highlight-input.el b/idris-highlight-input.el
index 521e4b0399..ec9aaaab67 100644
--- a/idris-highlight-input.el
+++ b/idris-highlight-input.el
@@ -57,32 +57,45 @@ See Info node `(elisp)Overlay Properties' to understand how
ARGS are used."
(defun idris-highlight-input-region (buffer start-line start-col end-line
end-col highlight)
"Highlight in BUFFER using an overlay from START-LINE and START-COL to
END-LINE and END-COL and the semantic properties specified in HIGHLIGHT."
- (when idris-semantic-source-highlighting
- (save-restriction
- (widen)
- (if (or (> end-line start-line)
- (and (= end-line start-line)
- (> end-col start-col)))
- (with-current-buffer buffer
+ (if (or (> end-line start-line)
+ (and (= end-line start-line)
+ (> end-col start-col)))
+ (when idris-semantic-source-highlighting
+ (with-current-buffer buffer
+ (save-restriction
+ (widen)
(save-excursion
(goto-char (point-min))
(let* ((start-pos (+ (line-beginning-position start-line)
(idris-highlight-column start-col)))
(end-pos (+ (line-beginning-position end-line)
(idris-highlight-column end-col)))
- (highlight-overlay (make-overlay start-pos end-pos
- (get-buffer buffer))))
- (overlay-put highlight-overlay 'idris-source-highlight t)
- (idris-add-overlay-properties highlight-overlay
- (idris-semantic-properties
highlight))
- (overlay-put highlight-overlay
- 'modification-hooks
- '(idris-highlight--overlay-modification-hook)))))
- (when (eq idris-semantic-source-highlighting 'debug)
- (message "Not highlighting absurd span %s:%s-%s:%s with %s"
- start-line start-col
- end-line end-col
- highlight ))))))
+ (existing-idris-overlays-in-range (seq-filter
+ (lambda (overlay)
+ (overlay-get overlay
'idris-source-highlight))
+ (overlays-in start-pos
end-pos)))
+ (existing-idris-overlay (seq-find (lambda (overlay)
+ (and
+ (eql start-pos
(overlay-start overlay))
+ (eql end-pos
(overlay-end overlay))
+ ;; TODO: overlay
properties match
+ ))
+
existing-idris-overlays-in-range)))
+ (when (null existing-idris-overlay)
+ (dolist (old-overlay existing-idris-overlays-in-range)
+ (delete-overlay old-overlay))
+ (let ((highlight-overlay (make-overlay start-pos end-pos)))
+ (overlay-put highlight-overlay 'idris-source-highlight t)
+ (idris-add-overlay-properties highlight-overlay
+ (idris-semantic-properties
highlight))
+ (overlay-put highlight-overlay
+ 'modification-hooks
+
'(idris-highlight--overlay-modification-hook)))))))))
+ (when (eq idris-semantic-source-highlighting 'debug)
+ (message "Not highlighting absurd span %s:%s-%s:%s with %s"
+ start-line start-col
+ end-line end-col
+ highlight))))
(defun idris-highlight-source-file (hs)
(cl-loop
- [nongnu] elpa/idris-mode updated (0cae4b8086 -> 4a36953e76), ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode 6fbd9cff31 6/9: Improve `idris-switch-working-directory` by, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode 4a36953e76 9/9: Merge pull request #580 from keram/load-file-switch-dir-idris2, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode ee551230ed 7/9: Merge pull request #579 from keram/tests-impro, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode 71ab6a35e3 5/9: [semantic-highlight] Remove and rebuild overlays in file on reload only in changed area,
ELPA Syncer <=
- [nongnu] elpa/idris-mode 7ebd8e721b 8/9: Merge pull request #581 from keram/highlight-partial, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode d6ac9524f6 1/9: Simplify `idris-test-idris-type-search` by removing loading a file, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode 928f785bb7 4/9: Remove conditional for srcdir in `idris-load-file` used to switch work directory, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode d0d609bff7 3/9: Include tests from idris-navigate.el in idris-tests.el, ELPA Syncer, 2022/12/06
- [nongnu] elpa/idris-mode 8a4ce46373 2/9: Delete AddClause.ibc between and after tests, ELPA Syncer, 2022/12/06