mirror of https://codeberg.org/cage/tinmop/
- added code to perform a search of gemspace, when the software is unable to understand the input typed in the address bar.
This commit is contained in:
parent
c84e747868
commit
4de0de1e2c
|
@ -968,7 +968,11 @@ local file paths."
|
||||||
((fs:directory-exists-p path)
|
((fs:directory-exists-p path)
|
||||||
(gui:choose-directory :initial-dir path :parent main-window :mustexist t))
|
(gui:choose-directory :initial-dir path :parent main-window :mustexist t))
|
||||||
(t
|
(t
|
||||||
(gui-goodies:notify-request-error (format nil (_ "No such file or directory: ~a") path)))))
|
(when (gui:ask-yesno (format nil (_ "No such file or directory: ~s, search genspace instead?")
|
||||||
|
path)
|
||||||
|
:title (_ "Error")
|
||||||
|
:parent main-window)
|
||||||
|
(open-search-iri path main-window)))))
|
||||||
|
|
||||||
(defun render-gemtext-string (main-window parsed-lines &key (links-path-prefix ""))
|
(defun render-gemtext-string (main-window parsed-lines &key (links-path-prefix ""))
|
||||||
(ev:with-enqueued-process-and-unblock ()
|
(ev:with-enqueued-process-and-unblock ()
|
||||||
|
@ -1032,6 +1036,14 @@ local file paths."
|
||||||
(otherwise
|
(otherwise
|
||||||
(render-line rendered-line))))))))))))
|
(render-line rendered-line))))))))))))
|
||||||
|
|
||||||
|
(defun open-search-iri (criteria main-window)
|
||||||
|
(let ((parsed-iri-search-capsule (iri:iri-parse constants:+gemini-search-engine+)))
|
||||||
|
(setf (uri:query parsed-iri-search-capsule)
|
||||||
|
(text-utils:maybe-percent-encode criteria))
|
||||||
|
(let ((search-iri (with-output-to-string (stream)
|
||||||
|
(iri:render-iri parsed-iri-search-capsule stream))))
|
||||||
|
(open-iri search-iri main-window nil))))
|
||||||
|
|
||||||
(defun open-iri (iri main-window use-cache &key (status +stream-status-streaming+))
|
(defun open-iri (iri main-window use-cache &key (status +stream-status-streaming+))
|
||||||
(handler-case
|
(handler-case
|
||||||
(let* ((actual-iri (remove-standard-port iri))
|
(let* ((actual-iri (remove-standard-port iri))
|
||||||
|
@ -1068,7 +1080,10 @@ local file paths."
|
||||||
(client-os-utils:open-resource-with-external-program main-window actual-iri))))
|
(client-os-utils:open-resource-with-external-program main-window actual-iri))))
|
||||||
(esrap:esrap-parse-error (e)
|
(esrap:esrap-parse-error (e)
|
||||||
(declare (ignore e))
|
(declare (ignore e))
|
||||||
(gui-goodies:notify-request-error (format nil (_ "Invalid address: ~s") iri)))
|
(when (gui:ask-yesno (_ "Invalid address, perform a search using your input?")
|
||||||
|
:title (_ "Invalid address")
|
||||||
|
:parent main-window)
|
||||||
|
(open-search-iri iri main-window)))
|
||||||
(error (e)
|
(error (e)
|
||||||
(gui-goodies:notify-request-error e))))
|
(gui-goodies:notify-request-error e))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue