1
0
Fork 0

Compare commits

...

2 Commits

Author SHA1 Message Date
cage c66a71881e - 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.
2021-01-27 20:31:18 +01:00
cage 1710ac5b48 - added feature to allow users ro configure symbols rendered for each toot visibility level in main window. 2021-01-24 16:15:42 +01:00
6 changed files with 71 additions and 8 deletions

View File

@ -434,6 +434,17 @@ message-window.account.unlocked.mark.value = " 🔓"
# message-window.attachment-header.value = " attachment "
# below the text printed for toot's visibility level: public,
# unlisted, private or direct
message-window.visibility.public = "🌐"
message-window.visibility.unlisted = "🔓"
message-window.visibility.private = "🔒"
message-window.visibility.direct = "📧"
# this is the window that allow to browse the attachments of a message
open-attach-window.background = black
@ -460,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 = "➶ "

View File

@ -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)

View File

@ -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* ((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))))
(query insert-query))))))
(defun next-in-history (min-id prompt)
"Return the history entry with prompt `prompt` and id that is greater

View File

@ -223,12 +223,19 @@
as-text))
as-text)))
(defun visibility->mark (visibility)
(let ((mapping (swconf:message-windows-visibility-marks)))
(db-getf mapping
(make-keyword (string-upcase visibility))
:default visibility
:only-empty-or-0-are-null t)))
(defun message-original->text-header (message-row)
(let* ((date-format (swconf:date-fmt swconf:+key-message-window+))
(username (db:row-message-username message-row))
(display-name (db:row-message-user-display-name message-row))
(creation-time (db:row-message-creation-time message-row))
(visibility (db:row-message-visibility message-row))
(visibility (visibility->mark (db:row-message-visibility message-row)))
(lockedp (db-utils:db-not-nil-p (db:row-lockedp message-row)))
(locked-mark (swconf:message-window-account-locking-status-mark lockedp))
(encoded-date (db-utils:encode-datetime-string creation-time))

View File

@ -1125,6 +1125,7 @@
:message-window-unlocked-account-mark
:message-window-account-locking-status-mark
:message-window-line-mark-values
:message-windows-visibility-marks
:message-window-attachments-header
:form-style
:background

View File

@ -340,6 +340,11 @@
link
creation-time
access-time
visibility
public
unlisted
private
direct
quote
h1
h2
@ -956,6 +961,31 @@
+key-line-position-mark+
+key-background+)))
(defun message-window-visibility-mark (visibility-level)
(access:accesses *software-configuration*
+key-message-window+
+key-visibility+
visibility-level))
(defmacro gen-visibility-mapping-marks (visibility-level)
`(defun ,(format-fn-symbol t "message-window-visibility-~a-mark" visibility-level) ()
(message-window-visibility-mark ,visibility-level)))
(gen-visibility-mapping-marks "public")
(gen-visibility-mapping-marks "unlisted")
(gen-visibility-mapping-marks "private")
(gen-visibility-mapping-marks "direct")
(defun message-windows-visibility-marks ()
(list :public (message-window-visibility-public-mark)
:unlisted (message-window-visibility-unlisted-mark)
:private (message-window-visibility-private-mark)
:direct (message-window-visibility-direct-mark)))
(defun message-window-attachments-header ()
(values (access:accesses *software-configuration*
+key-message-window+