Skip to content

Commit

Permalink
Make ctrl-f more usable on submissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Nov 15, 2023
1 parent 3170dc5 commit ed6771f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/assets/javascripts/components/annotations/line_of_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ export class LineOfCode extends ShadowlessLitElement {

for (const range of this.ranges) {
const substring = this.code.substring(range.start, range.start + range.length);
// replace every non-whitespace character with a non-breaking space
const nonSearchableSubstring = substring.replace(/\S/g, "\u00a0");
if (!range.annotations.length) {
backgroundLayer.push(substring);
tooltipLayer.push(substring);
backgroundLayer.push(nonSearchableSubstring);
tooltipLayer.push(nonSearchableSubstring);
} else {
backgroundLayer.push(html`<d-annotation-marker .annotations=${range.annotations}>${substring}</d-annotation-marker>`);
tooltipLayer.push(html`<d-annotation-tooltip .annotations=${range.annotations}>${substring}</d-annotation-tooltip>`);
backgroundLayer.push(html`<d-annotation-marker .annotations=${range.annotations}>${nonSearchableSubstring}</d-annotation-marker>`);
tooltipLayer.push(html`<d-annotation-tooltip .annotations=${range.annotations}>${nonSearchableSubstring}</d-annotation-tooltip>`);
}
}

Expand Down

0 comments on commit ed6771f

Please sign in to comment.