-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
When expanding collapsed tool output (clicking ... (N more lines)), syntax highlighting is missing. It appears erratically "bit by bit" when scrolling around. This is because JIT font-lock only fontifies visible portions lazily.
Root cause
pi--toggle-tool-output calls pi--insert-expanded-content which inserts markdown code fences but never calls font-lock-ensure. Compare with:
pi--finalize-streaming-message(line 1062) - callsfont-lock-ensure✓pi--insert-session-history(line 1814) - callsfont-lock-ensure✓
Implementation hints
Add font-lock-ensure after content insertion in pi--toggle-tool-output:
(defun pi--toggle-tool-output (button)
"Toggle between preview and full content for BUTTON."
(let* ((inhibit-read-only t)
;; ... existing bindings ...
)
(save-excursion
(when-let ((bounds (pi--find-tool-block-bounds)))
(goto-char (car bounds))
(forward-line 1)
(let ((content-start (point)))
(delete-region content-start (1+ btn-end))
(goto-char content-start)
(if expanded
(pi--insert-collapsed-content preview-content full-content lang hidden-count)
(pi--insert-expanded-content preview-content full-content lang hidden-count))
;; NEW: Ensure fontification after insertion
(font-lock-ensure content-start (point)))))))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working