1
0
Fork 0

- prevented crash when performing searching in an empty message window.

This commit is contained in:
cage 2022-02-11 14:01:44 +01:00
parent 8acd72dba3
commit 18110dbd42
1 changed files with 15 additions and 16 deletions

View File

@ -618,22 +618,21 @@
(defmethod search-regex ((object message-window) regex)
(with-accessors ((row-selected-index row-selected-index)) object
(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
(when-let ((selected-row (selected-row object)))
(let* ((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
(row-move object (- line-found row-selected-index))
(draw object)
(multiple-value-bind (first-window-line-simple first-window-line-complex)