From 5bb933761568982b0e60621577038450bc3dc2bf Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 26 May 2026 15:57:11 -0500 Subject: feat(comments): dim read-only comments so they read as disabled A comment you can't edit only had a grey heading, and the grey (`shadow`) was light enough to blend with the body text of your own comments. Now the read-only overlay covers the whole comment subtree, heading and body, so the comment recedes as a unit. And `pearl-readonly-comment` uses a darker background-aware grey (gray40 on a dark theme, gray60 on light, `shadow` as the fallback). Editable comments keep the heading-only overlay so your own comment text stays normal-colored, with the green heading as the "this one's yours" cue. --- tests/test-pearl-comment-editing.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/test-pearl-comment-editing.el b/tests/test-pearl-comment-editing.el index 29a5236..b8b4af4 100644 --- a/tests/test-pearl-comment-editing.el +++ b/tests/test-pearl-comment-editing.el @@ -257,6 +257,30 @@ (should (eq 'pearl-editable-comment (face-on "^\\*\\*\\*\\*\\* Me"))) (should (eq 'pearl-readonly-comment (face-on "^\\*\\*\\*\\*\\* Them")))))) +(ert-deftest test-pearl-highlight-readonly-comment-dims-its-body () + "A read-only comment's body carries the grey overlay so the whole comment reads +as disabled; an editable comment's body is left uncovered so its text reads +normally (only its heading is colored)." + (test-pearl--in-org + (concat "*** TODO [#B] Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\nBody.\n" + "**** Comments\n" + "***** Me — 2026-05-24T09:00:00.000Z\n" + ":PROPERTIES:\n:LINEAR-COMMENT-ID: c1\n:LINEAR-COMMENT-AUTHOR-ID: u-me\n:END:\nmine body\n" + "***** Them — 2026-05-24T10:00:00.000Z\n" + ":PROPERTIES:\n:LINEAR-COMMENT-ID: c2\n:LINEAR-COMMENT-AUTHOR-ID: u-other\n:END:\ntheirs body\n") + (pearl--apply-comment-highlights "u-me") + (cl-flet ((face-at (pat) + (goto-char (point-min)) + (re-search-forward pat) + (goto-char (match-beginning 0)) + (let ((ov (cl-find-if (lambda (o) (overlay-get o 'pearl-comment)) + (overlays-at (point))))) + (and ov (overlay-get ov 'face))))) + ;; the other person's comment body is dimmed with the read-only face + (should (eq 'pearl-readonly-comment (face-at "theirs body"))) + ;; my own comment body is left uncovered (its heading carries the green) + (should (null (face-at "mine body")))))) + (ert-deftest test-pearl-update-org-highlights-comments-on-bulk-render () "The bulk render colors comment headings, so a list-issues fetch shows editability without a follow-up refresh. Regression: highlighting ran only on -- cgit v1.2.3