mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-21 06:55:39 +00:00
Eglot: fix edge case when deleting inlay hint overlays
When asked to update hints in a region (FROM TO), eglot--update-hints-1 first deletes the existing hints. It must however take care to delete all overlays that logically belong to the region, even if they don't physically belong to it, e.g. inlay overlays spanning (FROM-1 FROM) and having a 'after-string' property. * lisp/progmodes/eglot.el (eglot--update-hints-1): Fix edge case.
This commit is contained in:
parent
a365984d9e
commit
941ef044f2
@ -3664,7 +3664,19 @@ If NOERROR, return predicate, else erroring function."
|
||||
:success-fn (lambda (hints)
|
||||
(eglot--when-live-buffer buf
|
||||
(eglot--widening
|
||||
(remove-overlays from to 'eglot--inlay-hint t)
|
||||
;; Overlays ending right at FROM with an
|
||||
;; `after-string' property logically belong to
|
||||
;; the (FROM TO) region. Likewise, such
|
||||
;; overlays ending at TO don't logically belong
|
||||
;; to it.
|
||||
(dolist (o (overlays-in (1- from) to))
|
||||
(when (and (overlay-get o 'eglot--inlay-hint)
|
||||
(cond ((eq (overlay-end o) from)
|
||||
(overlay-get o 'after-string))
|
||||
((eq (overlay-end o) to)
|
||||
(overlay-get o 'before-string))
|
||||
(t)))
|
||||
(delete-overlay o)))
|
||||
(mapc paint-hint hints))))
|
||||
:deferred 'eglot--update-hints-1)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user