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
|
(handler-case
|
||||||
(with-accessors ((row-selected-index row-selected-index)) object
|
(with-accessors ((row-selected-index row-selected-index)) object
|
||||||
(let* ((scanner (create-scanner regex :case-insensitive-mode t))
|
(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)
|
(position-found (position-if (lambda (a)
|
||||||
(if (selectedp a)
|
(if (selectedp a)
|
||||||
(scan scanner (selected-text a))
|
(scan scanner (selected-text a))
|
||||||
(scan scanner (normal-text a))))
|
(scan scanner (normal-text a))))
|
||||||
(safe-subseq (rows object)
|
(safe-subseq (rows object)
|
||||||
row-selected-index))))
|
actual-row-starting))))
|
||||||
(when position-found
|
(when position-found
|
||||||
(unselect-all object)
|
(unselect-all object)
|
||||||
(select-row object (+ row-selected-index position-found))
|
(select-row object (+ actual-row-starting position-found))
|
||||||
(when redraw
|
(when redraw
|
||||||
(draw object))
|
(draw object))
|
||||||
position-found)))
|
position-found)))
|
||||||
|
|
|
@ -176,18 +176,23 @@
|
||||||
|
|
||||||
(defmethod search-row ((object open-gemini-document-link-window) regex &key (redraw t))
|
(defmethod search-row ((object open-gemini-document-link-window) regex &key (redraw t))
|
||||||
(handler-case
|
(handler-case
|
||||||
(with-accessors ((row-selected-index row-selected-index)) object
|
(with-accessors ((row-selected-index row-selected-index)
|
||||||
(let* ((saved-selected-index row-selected-index)
|
(links links)) object
|
||||||
(scanner (create-scanner regex :case-insensitive-mode t))
|
(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)
|
(position-header (position-if (lambda (a)
|
||||||
(scan scanner
|
(scan scanner
|
||||||
(gemini-parser:name a)))
|
(gemini-parser:name a)))
|
||||||
(safe-subseq (links object)
|
(safe-subseq (links object)
|
||||||
row-selected-index))))
|
actual-row-starting))))
|
||||||
(call-next-method) ; search in urls
|
(call-next-method) ; search in urls
|
||||||
(when position-header ; but if an header has been found, it wins
|
(when position-header ; but if an header has been found, it wins
|
||||||
(unselect-all object)
|
(unselect-all object)
|
||||||
(select-row object (+ saved-selected-index position-header))
|
(select-row object (+ actual-row-starting position-header))
|
||||||
(when redraw
|
(when redraw
|
||||||
(draw object)))))
|
(draw object)))))
|
||||||
(error ()
|
(error ()
|
||||||
|
|
Loading…
Reference in New Issue