mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 21:33:05 +00:00
avy.el (avy--find-visible-regions): Add bounds safety
Re abo-abo/lispy#139
This commit is contained in:
parent
edf1259f25
commit
f341c2f18f
23
avy.el
23
avy.el
@ -567,16 +567,19 @@ Use OVERLAY-FN to visualize the decision overlay."
|
|||||||
|
|
||||||
(defun avy--find-visible-regions (rbeg rend)
|
(defun avy--find-visible-regions (rbeg rend)
|
||||||
"Return a list of all visible regions between RBEG and REND."
|
"Return a list of all visible regions between RBEG and REND."
|
||||||
(let (visibles beg)
|
(setq rbeg (max rbeg (point-min)))
|
||||||
(save-excursion
|
(setq rend (min rend (point-max)))
|
||||||
(save-restriction
|
(when (< rbeg rend)
|
||||||
(narrow-to-region rbeg rend)
|
(let (visibles beg)
|
||||||
(setq beg (goto-char (point-min)))
|
(save-excursion
|
||||||
(while (not (= (point) (point-max)))
|
(save-restriction
|
||||||
(goto-char (avy--next-invisible-point))
|
(narrow-to-region rbeg rend)
|
||||||
(push (cons beg (point)) visibles)
|
(setq beg (goto-char (point-min)))
|
||||||
(setq beg (goto-char (avy--next-visible-point))))
|
(while (not (= (point) (point-max)))
|
||||||
(nreverse visibles)))))
|
(goto-char (avy--next-invisible-point))
|
||||||
|
(push (cons beg (point)) visibles)
|
||||||
|
(setq beg (goto-char (avy--next-visible-point))))
|
||||||
|
(nreverse visibles))))))
|
||||||
|
|
||||||
(defun avy--regex-candidates (regex &optional beg end pred group)
|
(defun avy--regex-candidates (regex &optional beg end pred group)
|
||||||
"Return all elements that match REGEX.
|
"Return all elements that match REGEX.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user