thunderbird-patch-review

Easy-to-use patch review interface for Thunderbird

Contribute: ~marcc/thunderbird-review-plugin@lists.sr.ht

git clone git://mccd.space/thunderbird-patch-review

commit d0bfbc768602369cfb77be7be3bd752baac64fd9
parent 710660cf500e3f3b67d8e218f1d429e33b450ee9
Author: Pi Agent <agent@pi.local>
Date:   Sat, 18 Jul 2026 13:53:40 +0200

review: only hide the clicked line's own readonly comment

findReadonly walked every following sibling and returned the first
.readonly, so opening a new editor on a line with no comment grabbed
some later line's saved comment and hid it for the duration of the
editor. A line's comment row is always its immediate next sibling
(renderFileTable appends it right after the line row), so only check
that one.

Diffstat:
Mextension/review/review.js | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/extension/review/review.js b/extension/review/review.js
@@ -364,13 +364,13 @@ function toggleEditor(lineRow, loc) {
   tr.querySelector("textarea").focus();
 }
 
+// A line's readonly comment row, if any, is always the element immediately
+// after it (renderFileTable appends the comment row right after the line
+// row). Only that one belongs to this line — walking further would grab some
+// later line's comment and hide the wrong card.
 function findReadonly(lineRow) {
-  let el = lineRow.nextElementSibling;
-  while (el) {
-    if (el.classList.contains("readonly")) return el;
-    el = el.nextElementSibling;
-  }
-  return null;
+  const next = lineRow.nextElementSibling;
+  return next && next.classList.contains("readonly") ? next : null;
 }
 
 function openGeneralEditor(anchorEl, triggerBtn) {