I just wanted to bring attention that Emacs has text properties to guard non-editable regions with the read-only text property. I would guess it would be desirable if most of the chat buffer would be guarded by read only. It seems like this was at one point attempted? Saw this commented out ;; (setq-local buffer-read-only loading) and there are several references to inhibit-read-only t so it looks mostly set up. I think when implemented you should be able to remove all these advice-add calls.
;; TODO is there a better way to do that?
(advice-add 'delete-char :around #'eca-chat--key-pressed-deletion)
(advice-add 'backward-kill-word :around #'eca-chat--key-pressed-deletion)
(when (featurep 'evil)
(advice-add 'evil-delete-backward-word :around #'eca-chat--key-pressed-deletion)
(advice-add 'evil-delete-back-to-indentation :around #'eca-chat--key-pressed-deletion)
(advice-add 'evil-delete-whole-line :around #'eca-chat--key-pressed-deletion)
(advice-add 'evil-delete-char :around #'eca-chat--key-pressed-deletion)
(advice-add 'evil-delete :around #'eca-chat--key-pressed-deletion)
(advice-add 'evil-delete-backward-char :around #'eca-chat--key-pressed-deletion))
Similarly, the cursor-intangible text property (or cursor-intangible-mode) would stop point from landing inside purely decorative spans. I am mainly thinking about the area around the prompt prefix. after scrolling past the page break the cursor could jump right to the prompt area.
I just wanted to bring attention that Emacs has text properties to guard non-editable regions with the
read-onlytext property. I would guess it would be desirable if most of the chat buffer would be guarded by read only. It seems like this was at one point attempted? Saw this commented out;; (setq-local buffer-read-only loading)and there are several references toinhibit-read-only tso it looks mostly set up. I think when implemented you should be able to remove all theseadvice-addcalls.Similarly, the
cursor-intangibletext property (orcursor-intangible-mode) would stop point from landing inside purely decorative spans. I am mainly thinking about the area around the prompt prefix. after scrolling past the page break the cursor could jump right to the prompt area.