1
0
Fork 0

- added 'eval-command';

- added docstrings for scroll lock related functions.
This commit is contained in:
cage 2021-10-08 14:35:40 +02:00
parent f9f5a868b3
commit 76676f2d2f
3 changed files with 28 additions and 5 deletions

View File

@ -173,9 +173,11 @@
(define-key "M-up" #'pass-focus-on-top)
(define-key "M-l" #'message-window-lock-scrolling)
(define-key "M-s l" #'message-window-lock-scrolling)
(define-key "M-u" #'message-window-unlock-scrolling)
(define-key "M-s u" #'message-window-unlock-scrolling)
(define-key "M-e" #'eval-command)
;; focus

View File

@ -2705,7 +2705,8 @@
:gempub-library-window-close
:gempub-open-file
:message-window-lock-scrolling
:message-window-unlock-scrolling))
:message-window-unlock-scrolling
:eval-command))
(defpackage :scheduled-events
(:use

View File

@ -2276,9 +2276,29 @@ gemini page the program is rendering."
(gemini-viewer:load-gemini-url iri-to-open :give-focus-to-message-window t)))
(defun message-window-lock-scrolling ()
"Lock automatic scrolling of message window"
(setf (message-window:adjust-rows-strategy specials:*message-window*)
#'line-oriented-window:adjust-rows-noop))
#'line-oriented-window:adjust-rows-noop)
(info-message (_ "Message window scrolling locked")))
(defun message-window-unlock-scrolling ()
"Allow automatic scrolling of the message window to always show the
last line (the one on the bottom of the text; useful for chats, for
example)."
(setf (message-window:adjust-rows-strategy specials:*message-window*)
#'line-oriented-window:adjust-rows-select-last))
#'line-oriented-window:adjust-rows-select-last)
(info-message (_ "Message window scrolling unlocked")))
(defun eval-command ()
"Eval (execute) a lisp form. (e.g '(ui:notify \"foo\")' )"
(flet ((on-input-completed (query)
(push-event (make-instance 'function-event
:payload
(lambda ()
(tui:with-notify-errors
(db-utils:with-ready-database (:connect nil)
(with-input-from-string (stream query)
(funcall (compile nil
`(lambda () ,(read stream))))))))))))
(ui:ask-string-input #'on-input-completed
:prompt (format nil (_ "eval: ")))))