mirror of https://codeberg.org/cage/tinmop/
- fixed regression: searching in links window does not get stuck at the first occurence.
This commit is contained in:
parent
68c250e03c
commit
34284f9a51
|
@ -289,15 +289,20 @@ this exact quantity would go beyond the length or rows or zero."
|
|||
(handler-case
|
||||
(with-accessors ((row-selected-index row-selected-index)) object
|
||||
(let* ((scanner (create-scanner regex :case-insensitive-mode t))
|
||||
(selected-row (selected-row object))
|
||||
(selected-text (normal-text selected-row))
|
||||
(actual-row-starting (if (scan scanner selected-text)
|
||||
(1+ row-selected-index)
|
||||
row-selected-index))
|
||||
(position-found (position-if (lambda (a)
|
||||
(if (selectedp a)
|
||||
(scan scanner (selected-text a))
|
||||
(scan scanner (normal-text a))))
|
||||
(safe-subseq (rows object)
|
||||
row-selected-index))))
|
||||
actual-row-starting))))
|
||||
(when position-found
|
||||
(unselect-all object)
|
||||
(select-row object (+ row-selected-index position-found))
|
||||
(select-row object (+ actual-row-starting position-found))
|
||||
(when redraw
|
||||
(draw object))
|
||||
position-found)))
|
||||
|
|
|
@ -176,18 +176,23 @@
|
|||
|
||||
(defmethod search-row ((object open-gemini-document-link-window) regex &key (redraw t))
|
||||
(handler-case
|
||||
(with-accessors ((row-selected-index row-selected-index)) object
|
||||
(let* ((saved-selected-index row-selected-index)
|
||||
(scanner (create-scanner regex :case-insensitive-mode t))
|
||||
(with-accessors ((row-selected-index row-selected-index)
|
||||
(links links)) object
|
||||
(let* ((scanner (create-scanner regex :case-insensitive-mode t))
|
||||
(selected-link (elt links row-selected-index))
|
||||
(selected-text (gemini-parser:name selected-link))
|
||||
(actual-row-starting (if (scan scanner selected-text)
|
||||
(1+ row-selected-index)
|
||||
row-selected-index))
|
||||
(position-header (position-if (lambda (a)
|
||||
(scan scanner
|
||||
(gemini-parser:name a)))
|
||||
(safe-subseq (links object)
|
||||
row-selected-index))))
|
||||
actual-row-starting))))
|
||||
(call-next-method) ; search in urls
|
||||
(when position-header ; but if an header has been found, it wins
|
||||
(unselect-all object)
|
||||
(select-row object (+ saved-selected-index position-header))
|
||||
(select-row object (+ actual-row-starting position-header))
|
||||
(when redraw
|
||||
(draw object)))))
|
||||
(error ()
|
||||
|
|
Loading…
Reference in New Issue