1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

Fine tune visuals of CodeMirror's search feature

Added a dotted box around found text occurrences,
as just pale yellow to highlight the text is not
enough to visually distinguish from surrounding text.

Iterating through found text occurrences will now
ensure they are vertically positioned in the middle
of the editor.
This commit is contained in:
Raymond Hill 2020-08-04 10:14:38 -04:00
parent 59496cfa45
commit e44af458c0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 8 additions and 1 deletions

View File

@ -105,6 +105,9 @@ div.CodeMirror span.CodeMirror-matchingbracket {
.cm-search-widget .sourceURL[href=""] {
display: none;
}
.cm-searching {
border: 1px dotted black;
}
.CodeMirror-merge-l-deleted {
background-image: none;

View File

@ -345,7 +345,11 @@
if (!cursor.find(previous)) return;
}
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
const { clientHeight } = cm.getScrollInfo();
cm.scrollIntoView(
{ from: cursor.from(), to: cursor.to() },
clientHeight >>> 1
);
if (callback) callback(cursor.from(), cursor.to());
});
};