1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-03-30 23:48:07 +01:00

Add temporary highlight of match.

This commit is contained in:
Andrey Kotlarski 2013-04-01 12:57:58 +03:00
parent 670561e811
commit ac382e90dc

35
vlfi.el
View File

@ -316,22 +316,31 @@ OP-TYPE specifies the file operation being performed over FILENAME."
(progress-reporter-update search-reporter (progress-reporter-update search-reporter
vlfi-end-pos))))) vlfi-end-pos)))))
(progress-reporter-done search-reporter)) (progress-reporter-done search-reporter))
(vlfi-end-search (if backward match-start-pos match-end-pos) (if backward
count to-find)))) (vlfi-end-search match-end-pos match-start-pos
count to-find)
(vlfi-end-search match-start-pos match-end-pos
count to-find)))))
(defun vlfi-end-search (match-pos count to-find) (defun vlfi-end-search (match-pos-start match-pos-end count to-find)
"Move to chunk surrounding MATCH-POS. "Move to chunk surrounding MATCH-POS-START and MATCH-POS-END.
According to COUNT and left TO-FIND show if search has been According to COUNT and left TO-FIND show if search has been
successful. Return nil if nothing found." successful. Return nil if nothing found."
(vlfi-move-to-batch (- match-pos (/ vlfi-batch-size 2))) (vlfi-move-to-batch (- match-pos-start (/ vlfi-batch-size 2)))
(goto-char (- match-pos vlfi-start-pos)) (let* ((match-end (- match-pos-end vlfi-start-pos))
(cond ((zerop to-find) t) (overlay (make-overlay (- match-pos-start vlfi-start-pos)
((< to-find count) match-end)))
(message "Moved to the %d match which is last found" (overlay-put overlay 'face 'region)
(- count to-find)) (goto-char match-end)
t) (cond ((zerop to-find) t)
(t (message "Not found") ((< to-find count)
nil))) (message "Moved to the %d match which is last found"
(- count to-find))
t)
(t (message "Not found")
nil))
(sit-for 0.1)
(delete-overlay overlay)))
(defun vlfi-re-search-forward (regexp count) (defun vlfi-re-search-forward (regexp count)
"Search forward for REGEXP prefix COUNT number of times." "Search forward for REGEXP prefix COUNT number of times."