1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-30 00:39:54 +01:00

- fixed crash when 'contains-clsr' is called

This function called cl-ppcre:create-scanner  but if the argument to
  this function can not be interpreted  as a valid regex (e.g "["), an
  error is signalled.

  This error is now captured and the string passed to 'create-scanner'
  is used as a mere sequence not a regular expression.

- [gemini] fixed bug that prevented a page to be reloaded;
- [gemini] use cache, if possible, when opening a gemini url.
This commit is contained in:
cage 2021-04-03 11:14:58 +02:00
parent 6690a1b6f7
commit f1c8ec0ec1
3 changed files with 14 additions and 6 deletions

View File

@ -103,9 +103,14 @@ completed) and the common prefix of the completion string."
(text-utils:string-starts-with-p hint a)))
(defun contains-clsr (hint)
(let ((scanner (cl-ppcre:create-scanner hint)))
(lambda (a)
(cl-ppcre:scan scanner a))))
(handler-case
(let ((scanner (cl-ppcre:create-scanner hint)))
(lambda (a)
(cl-ppcre:scan scanner a)))
(error ()
(let ((scanner (cl-ppcre:create-scanner `(:sequence ,hint))))
(lambda (a)
(cl-ppcre:scan scanner a))))))
(defun remove-if-hidden (candidates)
(remove-if #'db:hidden-recipient-p candidates))

View File

@ -536,7 +536,7 @@
(certificate nil)
(certificate-key nil)
(use-cached-file-if-exists nil)
(do-nothing-if-exists-in-db t))
(do-nothing-if-exists-in-db nil))
(labels ((get-user-input (hide-input url prompt)
(multiple-value-bind (actual-iri host path query port fragment)
(gemini-client:displace-iri (iri:iri-parse url))
@ -743,7 +743,7 @@
(defun open-gemini-stream-window ()
(let* ((low-level-window (make-croatoan-window :enable-function-keys t)))
(setf *gemini-streams-window*
(setf *gemini-streams-window*
(make-instance 'gemini-streams-window
:top-row-padding 0
:title (_ "Current gemini streams")
@ -760,7 +760,8 @@
(defun load-gemini-url (url &key
(priority program-events:+standard-event-priority+)
(give-focus-to-message-window t))
(give-focus-to-message-window t)
(use-cached-file-if-exists nil))
"Load `url', that is a web resource or a local file. This function
can be used only when the event polling is enabled (e.g. from user
command) otherwise te actual code to get the resource will never be
@ -768,5 +769,6 @@ executed."
(let* ((event (make-instance 'program-events:gemini-request-event
:give-focus-to-message-window give-focus-to-message-window
:priority priority
:use-cached-file-if-exists use-cached-file-if-exists
:url url)))
(program-events:push-event event)))

View File

@ -1779,6 +1779,7 @@ open-message-link-window:open-message-link"
"Ask for a gemini address and try to load it"
(flet ((on-input-complete (url)
(gemini-viewer:load-gemini-url url
:use-cached-file-if-exists t
:priority program-events:+maximum-event-priority+)))
(let ((prompt (gemini-open-url-prompt)))