mirror of https://codeberg.org/cage/tinmop/
- made input command history less messy
- adding a sequence of n equals entries count as one (no duplicate entries on top of the history); - removed duplicate for gemini history URL.
This commit is contained in:
parent
1710ac5b48
commit
c66a71881e
|
@ -471,6 +471,8 @@ open-message-link-window.input.selected.foreground = #FFB200
|
|||
|
||||
# gemini browser
|
||||
|
||||
gemini.current.url.prefix = "🌍 "
|
||||
|
||||
gemini.link.scheme.gemini.prefix = "→ "
|
||||
|
||||
gemini.link.scheme.other.prefix = "➶ "
|
||||
|
|
|
@ -174,7 +174,9 @@ 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)
|
||||
(funcall #'db:history-prompt->values prompt))))
|
||||
(remove-duplicates (funcall #'db:history-prompt->values
|
||||
prompt)
|
||||
:test #'string=))))
|
||||
(values matched (reduce-to-common-prefix matched)))))
|
||||
|
||||
(defun complete-chat-message (hint)
|
||||
|
|
20
src/db.lisp
20
src/db.lisp
|
@ -724,14 +724,24 @@ to the corresponding id in table +table-account+"
|
|||
(when-let ((user (user-id->user user-id)))
|
||||
(db-getf user :acct)))
|
||||
|
||||
(defun last-in-history (prompt)
|
||||
(let* ((query (select (:*
|
||||
(:as (fields (:max :id)) :max))
|
||||
(from :input-history)
|
||||
(where (:= :prompt prompt)))))
|
||||
(fetch-single query)))
|
||||
|
||||
(defun insert-in-history (prompt input)
|
||||
"insert an history entry with `prompt` and `input'"
|
||||
(when (string-not-empty-p input)
|
||||
(let* ((now (prepare-for-db (local-time-obj-now)))
|
||||
(insert-query (make-insert :input-history
|
||||
(:prompt :input :date-added)
|
||||
(prompt input now))))
|
||||
(query insert-query))))
|
||||
(let* ((last-inserted (last-in-history prompt)))
|
||||
(when (or (null last-inserted)
|
||||
(not (string= input (getf last-inserted :input))))
|
||||
(let* ((now (prepare-for-db (local-time-obj-now)))
|
||||
(insert-query (make-insert :input-history
|
||||
(:prompt :input :date-added)
|
||||
(prompt input now))))
|
||||
(query insert-query))))))
|
||||
|
||||
(defun next-in-history (min-id prompt)
|
||||
"Return the history entry with prompt `prompt` and id that is greater
|
||||
|
|
Loading…
Reference in New Issue