1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-18 23:22:52 +01:00

- [GUI] improved gemtext search interface.

This commit is contained in:
cage 2024-12-13 14:41:27 +01:00
parent 38ce6cfe91
commit ea00615a3e

View File

@ -65,20 +65,28 @@
(gui-goodies:attach-tooltips ((button-next frame) (_ "make next match visible")) (gui-goodies:attach-tooltips ((button-next frame) (_ "make next match visible"))
((button-previous frame) (_ "make previous match visible")) ((button-previous frame) (_ "make previous match visible"))
(button-close (_ "end searching"))) (button-close (_ "end searching")))
(gui:bind (entry frame) (flet ((move-to-search-results (counter-add-function)
#$<KeyPress-Return>$ (if (matches frame)
(start-search-clsr frame (progn
gemtext-widget (setf (counter frame) (rem (funcall counter-add-function
(not (gui:value case-sensitive-checkbox)))) (counter frame))
(setf (gui:command (button-next frame)) (length (matches frame))))
(lambda () (gui:see gemtext-widget (gui:match-start (elt (matches frame)
(when (matches frame) (counter frame)))))
(setf (counter frame) (rem (1+ (counter frame)) (length (matches frame)))) (client-main-window:print-info-message (format nil
(gui:see gemtext-widget (gui:match-start (elt (matches frame) (counter frame))))))) (_ "No occurrences of ~s found")
(setf (gui:command (button-previous frame)) (gui:text (entry frame)))))))
(lambda () (gui:bind (entry frame)
(when (matches frame) #$<KeyPress-Return>$
(setf (counter frame) (max 0 (1- (counter frame)))) (lambda (e)
(gui:see gemtext-widget (gui:match-start (elt (matches frame) (counter frame))))))) (funcall (start-search-clsr frame
(setf (gui:command button-close) (lambda () (gui:grid-forget frame))) gemtext-widget
frame)) (not (gui:value case-sensitive-checkbox)))
e)
(move-to-search-results #'1+)))
(setf (gui:command (button-next frame))
(lambda () (move-to-search-results #'1+)))
(setf (gui:command (button-previous frame))
(lambda () (move-to-search-results #'1-)))
(setf (gui:command button-close) (lambda () (gui:grid-forget frame)))
frame)))