1
0
Fork 0

- fixed search in message window.

If more than  one occurence of the matched string  was present (in the
same line) drawing the last will overwrite the others.
This commit is contained in:
cage 2021-04-06 18:27:47 +02:00
parent 816a04812d
commit f6556fd4ff
1 changed files with 14 additions and 9 deletions

View File

@ -286,18 +286,19 @@
(defmethod search-regex ((object message-window) regex)
(with-accessors ((rows rows)
(row-selected-index row-selected-index)) object
(let ((line-found (position-if (lambda (a)
(scan regex
(tui-string->chars-string (normal-text a))))
rows
:start (min (1+ row-selected-index)
(length rows)))))
(let ((line-found (position-if (lambda (a)
(scan regex
(tui-string->chars-string (normal-text a))))
rows
:start (min (1+ row-selected-index)
(length rows))))
(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)
(first-line->string object)
(labels ((highlight (&optional (start-scan 0))
(labels ((calc-highlight (&optional (start-scan 0))
(multiple-value-bind (start end)
(scan regex first-window-line-simple :start start-scan)
(when start
@ -309,8 +310,12 @@
0
start))
(new-prefix (cat-tui-string prefix mask)))
(print-text object new-prefix 1 1)
(highlight end))))))
(push new-prefix replacements-strings)
(calc-highlight end)))))
(highlight ()
(loop for replacement in replacements-strings do
(print-text object replacement 1 1))))
(calc-highlight)
(highlight)))))))
(defun init ()