1
0
Fork 0

- ignored fragment when using the heuristic to openin an URL using an external resource.

This commit is contained in:
cage 2023-06-24 11:46:49 +02:00
parent 4dccfda25e
commit d8f389296e
4 changed files with 48 additions and 32 deletions

View File

@ -20,19 +20,23 @@
(flet ((edit (file)
(croatoan:end-screen)
(os-utils:open-with-editor file)))
(let ((program (swconf:link-regex->program-to-use resource)))
(if program
(cond
((swconf:use-editor-as-external-program-p program)
(edit resource))
((swconf:use-tinmop-as-external-program-p program)
(if open-for-edit
(edit resource)
(client-main-window:open-local-path resource
main-window
:force-rendering t)))
(t
(os-utils:open-link-with-program program resource :wait open-for-edit)))
(if open-for-edit
(error (_ "No program defined in configuration file to edit this kind of files."))
(os-utils:xdg-open resource))))))
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource))
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
(let ((program (if (iri:absolute-url-p resource)
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
(swconf:link-regex->program-to-use resource))))
(if program
(cond
((swconf:use-editor-as-external-program-p program)
(edit resource))
((swconf:use-tinmop-as-external-program-p program)
(if open-for-edit
(edit resource)
(client-main-window:open-local-path resource
main-window
:force-rendering t)))
(t
(os-utils:open-link-with-program program resource :wait open-for-edit)))
(if open-for-edit
(error (_ "No program defined in configuration file to edit this kind of files."))
(os-utils:xdg-open resource)))))))

View File

@ -306,6 +306,13 @@
query
fragment)))
(defgeneric remove-fragment (iri))
(defmethod remove-fragment ((object iri))
(let ((copied (copy-iri object)))
(setf (uri:fragment copied) nil)
copied))
(defmethod normalize-path ((object iri))
(let ((clean-path (fs:normalize-path (uri:path object)))
(copy (copy-iri object)))

View File

@ -186,22 +186,26 @@
(flet ((edit (file)
(croatoan:end-screen)
(os-utils:open-with-editor file)))
(let ((program (swconf:link-regex->program-to-use resource)))
(if program
(cond
((swconf:use-editor-as-external-program-p program)
(edit resource))
((swconf:use-tinmop-as-external-program-p program)
(if open-for-edit
(edit resource)
(gemini-viewer:load-gemini-url resource
:give-focus-to-message-window
give-focus-to-message-window)))
(t
(os-utils:open-link-with-program program resource :wait open-for-edit)))
(if open-for-edit
(error (_ "No program defined in configuration file to edit this kind of files."))
(os-utils:xdg-open resource))))))
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource))
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
(let ((program (if (iri:absolute-url-p resource)
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
(swconf:link-regex->program-to-use resource))))
(if program
(cond
((swconf:use-editor-as-external-program-p program)
(edit resource))
((swconf:use-tinmop-as-external-program-p program)
(if open-for-edit
(edit resource)
(gemini-viewer:load-gemini-url resource
:give-focus-to-message-window
give-focus-to-message-window)))
(t
(os-utils:open-link-with-program program resource :wait open-for-edit)))
(if open-for-edit
(error (_ "No program defined in configuration file to edit this kind of files."))
(os-utils:xdg-open resource)))))))
(defun open-resource-with-tinmop-p (resource)
(alexandria:when-let ((program (swconf:link-regex->program-to-use resource)))

View File

@ -758,6 +758,7 @@
:make-iri
:iri-parse
:iri=
:remove-fragment
:normalize-path
:absolute-url-p
:ipv4-address-p