Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pi-coding-agent-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ When nil (the default), only the visible text is copied."
:type 'boolean
:group 'pi-coding-agent)

(defcustom pi-coding-agent-extension-status-faces nil
"Alist mapping extension status keys to faces in the header line.
Keys are extension status keys as strings. Values are face symbols or face
attribute plists accepted by `propertize'."
:type '(alist :key-type string :value-type sexp)
:group 'pi-coding-agent)

(defcustom pi-coding-agent-quit-without-confirmation nil
"Whether `pi-coding-agent-quit' skips confirmation for a live process.
When non-nil, quitting a session never asks whether a running pi process
Expand Down Expand Up @@ -1646,7 +1653,12 @@ Returns extension statuses joined with \" · \", or empty string."
(if (null ext-status)
""
(mapconcat (lambda (pair)
(pi-coding-agent--header-escape-text (cdr pair)))
(let* ((key (car pair))
(text (pi-coding-agent--header-escape-text (cdr pair)))
(face (cdr (assoc key pi-coding-agent-extension-status-faces))))
(if face
(propertize text 'face face)
text)))
ext-status
" · ")))

Expand Down
13 changes: 13 additions & 0 deletions test/pi-coding-agent-ui-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,19 @@ Buffer is read-only with `inhibit-read-only' used for insertion.
"Hot-tail turn count defaults to 3 headed turns."
(should (= 3 pi-coding-agent-hot-tail-turn-count)))

(ert-deftest pi-coding-agent-test-extension-status-faces-propertize-by-key ()
"Extension status faces are applied by status key."
(let ((pi-coding-agent-extension-status-faces
'(("mempalace" . (:foreground "#c6a0f6")))))
(let ((result (pi-coding-agent--header-format-extension-status
'(("solveit-mode" . "⚡ concise")
("mempalace" . "⌂ MemPalace · Global")))))
(should (equal (substring-no-properties result)
"⚡ concise · ⌂ MemPalace · Global"))
(should-not (get-text-property 0 'face result))
(should (equal (get-text-property (string-match-p "⌂" result) 'face result)
'(:foreground "#c6a0f6"))))))

(ert-deftest pi-coding-agent-test-kill-ring-save-strips-by-default ()
"kill-ring-save strips hidden markup by default."
(pi-coding-agent-test--with-chat-markup "Hello **bold** world"
Expand Down