[Diff mode] Allow clicking on variables that are in modified text
-
Modify a spec, build the diff. For instance, click on the "Diff" link in the "Preview | Diff" section of https://github.com/WICG/turtledove/pull/1180. (I'm not sure how to do this from the command line, it doesn't seem to be documented -- maybe it's another tool and not Bikeshed that does this, or maybe not? I couldn't figure it out looking at the GitHub build log for that PR.)
-
Find a yellow section of modified text. You can use the "j" and "k" keys to quickly go to next and previous diffs.
-
Click on a variable referenced in the yellow text.
EXPECTED: All instances of that variable get highlighted, just like would happen for non-modified text.
RESULT: Nothing happens. However, if that variable is referenced somewhere outside the diff'd region, clicking on that instance will highlight all occurrences, including those in the diff'd region.
See https://github.com/speced/bikeshed/issues/2855 -- this may require changing the HTML diff service (which isn't in Bikeshed) to somehow avoid altering the mouseover effect for the diff elements it modifies. This bug probably can't be fixed via changes to Bikeshed code?
Yup, the diff service is totally unrelated to Bikeshed; it's https://services.w3.org/htmldiff. That service would need to change its diff styles.
Probably it wants to make the background change for ins/del dependent on whether an ancestor has data-var-color attribute, which is what Bikeshed uses to trigger variable highlights.
For example, something like:
var[data-var-color] ins.diff-new {
background: repeating-linear-gradient(135deg, var(--diff-new-bg) 0 3px, transparent 0 10px);
}
However, the behavior where clicking on a var inside a diff section doesn't work, that's fixable by me. I'm currently checking that the clicked element is the var, but when the diff content is applied, the var contents are wrapped in an ins, so clicking the text actually clicks the ins and fails to trigger the highlighting. That's fixable.