1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-06-05 01:09:17 +02:00

- added command 'print-mentions';

- highlight mentions in message window.
This commit is contained in:
cage
2022-11-17 14:03:03 +01:00
parent 47cf19d773
commit 8206500f7a
5 changed files with 36 additions and 1 deletions

View File

@@ -376,6 +376,8 @@
(define-key "|" #'send-message-to-pipe *thread-keymap*)
(define-key "M" #'print-mentions *thread-keymap*)
;; message window keymap
(define-key "up" #'message-scroll-up *message-keymap*)

View File

@@ -129,6 +129,10 @@ color-regexp = "[012][0-9]:[0123456][0-9]" cyan bold
#color-regexp = "your-username" #ff00ff bold
# mentions
color-regexp = "@[a-zA-Z0-9]+ " cyan
# gemini colorization
# header level 1

View File

@@ -1568,6 +1568,7 @@
:help-apropos-event
:redraw-window-event
:send-to-pipe-event
:print-mentions-event
:function-event
:with-enqueued-process
:dispatch-program-events))
@@ -2953,7 +2954,8 @@
:file-explorer-edit-file
:file-explorer-upload-mirror
:file-explorer-download-mirror
:clear-cache))
:clear-cache
:print-mentions))
(defpackage :scheduled-events
(:use

View File

@@ -1678,6 +1678,29 @@
(tui:with-print-error-message
(os-utils:send-to-pipe data command))))
(defclass print-mentions-event (program-event) ())
(defmethod process-event ((object print-mentions-event))
(let* ((thread-window specials:*thread-window*)
(mentions (thread-window::mentions thread-window))
(message-window specials:*message-window*))
(if mentions
(labels ((print-mention (notification)
(format nil "type: ~a from ~a"
(tooter:kind notification)
(tooter:account-name (tooter:account notification))))
(make-rows (mentions)
(mapcar (lambda (mention)
(make-instance 'mention
:fields (list :original-object mention)
:normal-text (print-mention mention)
:selected-text (print-mention mention)))
mentions)))
(line-oriented-window:update-all-rows message-window (make-rows mentions))
(windows:win-clear message-window)
(windows:draw message-window))
(ui:info-message (_ "No mentions")))))
;;;; general usage
(defclass function-event (program-event) ())

View File

@@ -3373,3 +3373,7 @@ gemini client certificates!)."
children))))))))
(ask-string-input #'on-input-complete
:prompt (format nil (_ "Delete cache? [y/N] ")))))
(defun print-mentions ()
"Print the mentions"
(push-event (make-instance 'print-mentions-event)))