From a7d7aa8555b3e842b86435b343fcd5b63a19abd0 Mon Sep 17 00:00:00 2001 From: cage Date: Wed, 16 Aug 2023 17:35:34 +0200 Subject: [PATCH] - added bookmarked URLs to the list of candidates for autocompletion. --- src/complete.lisp | 6 +++--- src/db.lisp | 5 +++++ src/package.lisp | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/complete.lisp b/src/complete.lisp index 3a53bb4..c03bec0 100644 --- a/src/complete.lisp +++ b/src/complete.lisp @@ -242,14 +242,14 @@ list af all possible candidtae for completion." (let ((actual-hint (maybe-remove-file-scheme hint))) (if (expand-iri-as-local-path-p actual-hint) (directory-complete actual-hint) - (when-let ((bag (remove-duplicates (funcall #'db:history-prompt->values - prompt) + (when-let ((bag (remove-duplicates (nconc (db:history-prompt->values prompt) + (db:bookmark-all-bookmarked-url)) :test #'string=))) (multiple-value-bind (matched-strings indices) (uri-matcher actual-hint bag) (when matched-strings (values matched-strings - nil ;for fuzzy search common prefix does + nil ;for fuzzy search common prefix does ;not makes sense; note also that ;setting this to nil will force ;selecting the first item in diff --git a/src/db.lisp b/src/db.lisp index 3d58df9..65853b6 100644 --- a/src/db.lisp +++ b/src/db.lisp @@ -3280,6 +3280,11 @@ days in the past" (query (select :* (from +table-bookmark+) (where (:is-null :section)))) (query (select :* (from +table-bookmark+) (where (:= :section section)))))) +(defun bookmark-all-bookmarked-url () + (remove-if-not (lambda (a) (iri:iri-parse a :null-on-error t)) + (mapcar #'second + (query (select :value (from +table-bookmark+)))))) + (defun bookmark-all () (query (select :* (from +table-bookmark+)))) diff --git a/src/package.lisp b/src/package.lisp index 5b9b0f8..59dbec0 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -1134,6 +1134,7 @@ :bookmark-description-for-complete :bookmark-all-sections :bookmark-all-grouped-by-section + :bookmark-all-bookmarked-url :bookmark-all :bookmark-exists-p :bookmark-delete