1
0
Fork 0

- fixed regression: searching in the message window does not get stuck at the first occurence.

This commit is contained in:
cage 2021-06-16 18:33:16 +02:00
parent c2f3f155aa
commit 68c250e03c
1 changed files with 14 additions and 8 deletions

View File

@ -480,14 +480,20 @@
(defmethod search-regex ((object message-window) regex)
(with-accessors ((row-selected-index row-selected-index)) object
(let ((line-found (rows-position-if object
(lambda (a)
(scan regex
(tui-string->chars-string (normal-text a))))
:start (clamp row-selected-index
0
(rows-length object))))
(replacements-strings ()))
(let* ((selected-row (selected-row object))
(selected-text (normal-text selected-row))
(actual-row-starting (if (scan regex
(tui-string->chars-string selected-text))
(1+ row-selected-index)
row-selected-index))
(line-found (rows-position-if object
(lambda (a)
(scan regex
(tui-string->chars-string (normal-text a))))
:start (clamp actual-row-starting
0
(rows-length object))))
(replacements-strings ()))
(when line-found
(progn
(row-move object (- line-found row-selected-index))