diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 7879566..b109a9d 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -123,6 +123,18 @@ 1 iri))) status-completed)) + (perform-after-stream-exausted-actions () + (print-info-message (_ "Stream finished")) + (gui:configure-mouse-pointer (gemtext-widget main-window) :xterm) + (render-toc main-window iri) + (a:when-let* ((fragment (uri:fragment (iri:iri-parse iri))) + (regexp (gemini-viewer::fragment->regex fragment))) + (setf (gui:text (client-search-frame::entry (search-frame main-window))) + regexp) + (funcall (client-search-frame::start-search-clsr (search-frame main-window) + (gemtext-widget main-window) + nil) + nil))) (loop-fetch (&optional (last-lines-fetched-count 0)) (ev:with-enqueued-process-and-unblock () (gui-goodies:with-notify-errors @@ -134,16 +146,13 @@ (next-start-fetching (length last-lines-fetched))) (when last-lines-fetched (funcall process-function stream-wrapper last-lines-fetched)) - (when (not (or (funcall aborting-function) + (if (not (or (funcall aborting-function) (and (stream-exausted-p) (<= next-start-fetching 0)))) - (loop-fetch (+ last-lines-fetched-count - next-start-fetching)))))))) + (loop-fetch (+ last-lines-fetched-count + next-start-fetching)) + (perform-after-stream-exausted-actions))))))) (loop-fetch) - (ev:with-enqueued-process-and-unblock () - (print-info-message (_ "Stream finished")) - (gui:configure-mouse-pointer (gemtext-widget main-window) :xterm) - (render-toc main-window iri)) (if (cev:enqueue-request-and-wait-results :gemini-bookmarked-p 1 ev:+standard-event-priority+ @@ -153,16 +162,7 @@ (ev:with-enqueued-process-and-unblock () (set-bookmark-button-false main-window))) (ev:with-enqueued-process-and-unblock () - (set-gemlog-toolbar-button-appearance main-window iri)) - (ev:with-enqueued-process-and-unblock () - (a:when-let* ((fragment (uri:fragment (iri:iri-parse iri))) - (regexp (gemini-viewer::fragment->regex fragment))) - (setf (gui:text (client-search-frame::entry (search-frame main-window))) - regexp) - (funcall (client-search-frame::start-search-clsr (search-frame main-window) - (gemtext-widget main-window) - nil) - nil))))) + (set-gemlog-toolbar-button-appearance main-window iri)))) (defun set-gemlog-toolbar-button-appearance (main-window iri) (if (comm:make-request :gemini-gemlog-subscribed-p 1 iri)