Skip to content

Commit

Permalink
Adding back the search scrollbar highlights after moving through sear…
Browse files Browse the repository at this point in the history
…ch results (#2910)

Fixes #2903

After a previous fix with the search highlighting, I broke the search scrollbar highlights showing where in the note search matches were when traversing through search results.

This fixes that issue by ensuring it appears even when going through search results.
  • Loading branch information
sandymcfadden authored May 28, 2021
1 parent 104e2a4 commit 14ef91a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/note-content-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class NoteContentEditor extends Component<Props> {
contentDiv = createRef<HTMLDivElement>();
decorations: string[] = [];
matchesInNote: [] = [];
overviewRuler = {
color: '#3361cc',
position: Editor.OverviewRulerLane.Full,
};

state: OwnState = {
content: '',
Expand Down Expand Up @@ -443,10 +447,7 @@ class NoteContentEditor extends Component<Props> {
matches.push({
options: {
inlineClassName: 'search-decoration',
overviewRuler: {
color: '#3361cc',
position: Editor.OverviewRulerLane.Full,
},
overviewRuler: this.overviewRuler,
},
range: {
startLineNumber: start.lineNumber,
Expand Down Expand Up @@ -1137,12 +1138,18 @@ class NoteContentEditor extends Component<Props> {
if (match.range === range) {
decoration = {
range: match.range,
options: { inlineClassName: 'selected-search' },
options: {
inlineClassName: 'selected-search',
overviewRuler: this.overviewRuler,
},
};
} else {
decoration = {
range: match.range,
options: { inlineClassName: 'search-decoration' },
options: {
inlineClassName: 'search-decoration',
overviewRuler: this.overviewRuler,
},
};
}
newDecorations.push(decoration);
Expand Down

0 comments on commit 14ef91a

Please sign in to comment.