From 07d04f760af90ffe82a4b85c34831d0333c8765b Mon Sep 17 00:00:00 2001 From: cage Date: Wed, 10 Feb 2021 20:34:08 +0100 Subject: [PATCH] - [gemini] complete URL on command line matching substring in any position, not only at the start of the URL. --- src/complete.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/complete.lisp b/src/complete.lisp index 3a1dd04..89fdd95 100644 --- a/src/complete.lisp +++ b/src/complete.lisp @@ -102,6 +102,11 @@ completed) and the common prefix of the completion string." (lambda (a) (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)))) + (defun remove-if-hidden (candidates) (remove-if #'db:hidden-recipient-p candidates)) @@ -173,7 +178,7 @@ list af all possible candidtae for completion." (defun make-complete-gemini-iri-fn (prompt) (lambda (hint) - (when-let ((matched (remove-if-not (starts-with-clsr hint) + (when-let ((matched (remove-if-not (contains-clsr hint) (remove-duplicates (funcall #'db:history-prompt->values prompt) :test #'string=))))