Skip to content

Chat buffer does not use read-only and intangible text properties #161

@nehrbash

Description

@nehrbash

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions