mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 05:23:05 +00:00
avy.el (avy--overlay): Take BEG END, instead of only BEG
* avy.el (avy--overlay): (avy--overlay-pre): (avy--overlay-at): (avy--overlay-post): Update. Previously, END was implied to be (1+ BEG).
This commit is contained in:
parent
13377d92b2
commit
d4b693f274
20
avy.el
20
avy.el
@ -621,13 +621,13 @@ When GROUP is non-nil, (BEG . END) should delimit that regex group."
|
|||||||
(propertize old-str 'face 'avy-background-face)
|
(propertize old-str 'face 'avy-background-face)
|
||||||
old-str)))
|
old-str)))
|
||||||
|
|
||||||
(defun avy--overlay (str pt wnd &optional compose-fn)
|
(defun avy--overlay (str beg end wnd &optional compose-fn)
|
||||||
"Create an overlay with STR at PT in WND.
|
"Create an overlay with STR from BEG to END in WND.
|
||||||
COMPOSE-FN is a lambda that concatenates the old string at PT with STR."
|
COMPOSE-FN is a lambda that concatenates the old string at BEG with STR."
|
||||||
(when (<= (1+ pt) (with-selected-window wnd (point-max)))
|
(when (<= (1+ beg) (with-selected-window wnd (point-max)))
|
||||||
(let* ((pt (+ pt avy--overlay-offset))
|
(let* ((beg (+ beg avy--overlay-offset))
|
||||||
(ol (make-overlay pt (1+ pt) (window-buffer wnd)))
|
(ol (make-overlay beg (or end (1+ beg)) (window-buffer wnd)))
|
||||||
(old-str (avy--old-str pt wnd))
|
(old-str (avy--old-str beg wnd))
|
||||||
(os-line-prefix (get-text-property 0 'line-prefix old-str))
|
(os-line-prefix (get-text-property 0 'line-prefix old-str))
|
||||||
(os-wrap-prefix (get-text-property 0 'wrap-prefix old-str)))
|
(os-wrap-prefix (get-text-property 0 'wrap-prefix old-str)))
|
||||||
(when os-line-prefix
|
(when os-line-prefix
|
||||||
@ -691,7 +691,7 @@ LEAF is normally ((BEG . END) . WND)."
|
|||||||
str))
|
str))
|
||||||
(avy--overlay
|
(avy--overlay
|
||||||
str
|
str
|
||||||
(avy-candidate-beg leaf)
|
(avy-candidate-beg leaf) nil
|
||||||
(avy-candidate-wnd leaf))))
|
(avy-candidate-wnd leaf))))
|
||||||
|
|
||||||
(defun avy--overlay-at (path leaf)
|
(defun avy--overlay-at (path leaf)
|
||||||
@ -704,7 +704,7 @@ LEAF is normally ((BEG . END) . WND)."
|
|||||||
'face 'avy-lead-face)))
|
'face 'avy-lead-face)))
|
||||||
(avy--overlay
|
(avy--overlay
|
||||||
str
|
str
|
||||||
(avy-candidate-beg leaf)
|
(avy-candidate-beg leaf) nil
|
||||||
(avy-candidate-wnd leaf)
|
(avy-candidate-wnd leaf)
|
||||||
(lambda (str old-str)
|
(lambda (str old-str)
|
||||||
(cond ((string= old-str "\n")
|
(cond ((string= old-str "\n")
|
||||||
@ -782,7 +782,7 @@ LEAF is normally ((BEG . END) . WND)."
|
|||||||
str))
|
str))
|
||||||
(avy--overlay
|
(avy--overlay
|
||||||
str
|
str
|
||||||
(avy-candidate-end leaf)
|
(avy-candidate-end leaf) nil
|
||||||
(avy-candidate-wnd leaf))))
|
(avy-candidate-wnd leaf))))
|
||||||
|
|
||||||
(defun avy--update-offset-and-str (offset str)
|
(defun avy--update-offset-and-str (offset str)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user