mirror of https://codeberg.org/cage/tinmop/
- [gui] prevented creating a new file with editor
when a string not representing an absolute IRI, or an existing path in a local file system was typed on the address bar, the program tried to open it with an external program (example, starting an editor) instead of trigger a search on the gemspace.
This commit is contained in:
parent
759fc15125
commit
dcda3f91ad
|
@ -1023,6 +1023,14 @@ local file paths."
|
||||||
:font (gui-conf:gemini-preformatted-text-font-configuration))
|
:font (gui-conf:gemini-preformatted-text-font-configuration))
|
||||||
(set-text-gemtext main-window lines)))
|
(set-text-gemtext main-window lines)))
|
||||||
|
|
||||||
|
(defun ask-for-search (criteria main-window)
|
||||||
|
(when (gui:ask-yesno (format nil
|
||||||
|
(_ "No such file or directory: ~s, search gemspace instead?")
|
||||||
|
criteria)
|
||||||
|
:title (_ "Question")
|
||||||
|
:parent main-window)
|
||||||
|
(open-search-iri criteria main-window)))
|
||||||
|
|
||||||
(defun open-local-path (path main-window &key (force-rendering nil))
|
(defun open-local-path (path main-window &key (force-rendering nil))
|
||||||
(cond
|
(cond
|
||||||
((fs:file-exists-p path)
|
((fs:file-exists-p path)
|
||||||
|
@ -1056,11 +1064,7 @@ local file paths."
|
||||||
(set-address-bar-text main-window file-path)
|
(set-address-bar-text main-window file-path)
|
||||||
(open-local-path file-path main-window)))
|
(open-local-path file-path main-window)))
|
||||||
(t
|
(t
|
||||||
(when (gui:ask-yesno (format nil (_ "No such file or directory: ~s, search gemspace instead?")
|
(ask-for-search path main-window))))
|
||||||
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 ()
|
||||||
|
@ -1178,13 +1182,10 @@ local file paths."
|
||||||
(initialize-ir-lines main-window)
|
(initialize-ir-lines main-window)
|
||||||
(open-local-path (iri:path parsed-iri) main-window))
|
(open-local-path (iri:path parsed-iri) main-window))
|
||||||
(t
|
(t
|
||||||
(client-os-utils:open-resource-with-external-program main-window actual-iri))))
|
(ask-for-search iri main-window))))
|
||||||
(esrap:esrap-parse-error (e)
|
(esrap:esrap-parse-error (e)
|
||||||
(declare (ignore e))
|
(declare (ignore e))
|
||||||
(when (gui:ask-yesno (_ "Invalid address, perform a search using your input?")
|
(ask-for-search iri main-window))
|
||||||
: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