mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Fix regression in syntax highlighting of dark theme
This commit is contained in:
parent
9bcfc8ff1c
commit
9c08e902bd
3 changed files with 40 additions and 15 deletions
|
|
@ -31,12 +31,35 @@ section[data-pane="develop"] > div > * {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
#cm-container .cm-editor .cm-line:has(.yamlboundary) {
|
||||
#cm-container .cm-editor .cm-line:has(.ubol-boundary) {
|
||||
background-image: url('line-hor-dashed.png'), url('line-hor-dashed.png');
|
||||
background-position: left 3px, left calc(100% - 3px);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
#cm-container .cm-editor {
|
||||
color: var(--ink-1);
|
||||
}
|
||||
:root.dark #cm-container .cm-editor {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
#cm-container .cm-editor .cm-line .ubol-comment {
|
||||
color: #ba5300;
|
||||
}
|
||||
:root.dark #cm-container .cm-editor .cm-line .ubol-comment {
|
||||
color: #fa7000;
|
||||
}
|
||||
#cm-container .cm-editor .cm-line .ubol-keyword {
|
||||
color: #ae42be;
|
||||
}
|
||||
:root.dark #cm-container .cm-editor .cm-line .ubol-keyword {
|
||||
color: #ea59ff;
|
||||
}
|
||||
#cm-container .cm-editor .cm-line .ubol-literal {
|
||||
color: #168156;
|
||||
}
|
||||
:root.dark #cm-container .cm-editor .cm-line .ubol-literal {
|
||||
color: #1dae74;
|
||||
}
|
||||
#cm-container .cm-editor .cm-line.badline:not(.cm-activeLine) {
|
||||
background-color: color-mix(in srgb, var(--info3-ink) 15%, transparent 85%);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -557,35 +557,33 @@ class Editor {
|
|||
},
|
||||
token: (stream, state) => {
|
||||
if ( stream.sol() ) {
|
||||
if ( stream.match(/^---\s*$/) ) { return 'yamlboundary'; }
|
||||
if ( stream.match(/^# ---\s*$/) ) { return 'yamlboundary comment'; }
|
||||
if ( stream.match(/\.\.\.\s*$/) ) { return 'yamlboundary'; }
|
||||
if ( stream.match(/^---\s*$/) ) { return 'ubol-boundary'; }
|
||||
if ( stream.match(/^# ---\s*$/) ) { return 'ubol-boundary ubol-comment'; }
|
||||
if ( stream.match(/\.\.\.\s*$/) ) { return 'ubol-boundary'; }
|
||||
}
|
||||
const c = stream.peek();
|
||||
if ( c === '#' ) {
|
||||
if ( (stream.pos === 0 || /\s/.test(stream.string.charAt(stream.pos - 1))) ) {
|
||||
stream.skipToEnd();
|
||||
return 'comment';
|
||||
return 'ubol-comment';
|
||||
}
|
||||
}
|
||||
if ( stream.eatSpace() ) {
|
||||
return null;
|
||||
}
|
||||
if ( stream.eatSpace() ) { return null; }
|
||||
const { scope } = state;
|
||||
state.scope = 0;
|
||||
if ( scope === 0 && stream.match(/^[^:]+(?=:)/) ) {
|
||||
state.scope = 1;
|
||||
return 'keyword';
|
||||
return 'ubol-keyword';
|
||||
}
|
||||
if ( scope === 1 && stream.match(/^:(?: |$)/) ) {
|
||||
return 'punctuation';
|
||||
return 'ubol-punctuation';
|
||||
}
|
||||
if ( stream.match(/^- /) ) {
|
||||
return 'punctuation';
|
||||
return 'ubol-punctuation';
|
||||
}
|
||||
if ( this.editor.streamParserKeywords ) {
|
||||
if ( stream.match(this.editor.streamParserKeywords) ) {
|
||||
return 'literal';
|
||||
return 'ubol-literal';
|
||||
}
|
||||
}
|
||||
if ( stream.match(/^\S+/) ) {
|
||||
|
|
@ -598,7 +596,11 @@ class Editor {
|
|||
commentTokens: { line: '#' },
|
||||
},
|
||||
tokenTable: [
|
||||
'yamlboundary',
|
||||
'ubol-boundary',
|
||||
'ubol-keyword',
|
||||
'ubol-comment',
|
||||
'ubol-punctuation',
|
||||
'ubol-literal',
|
||||
],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 4bacc0ca79f3eb4c6e395bf54d3f5efe4da4e07c
|
||||
Subproject commit 0cd9b7a77cd166186ebdb483d6aac82f616685df
|
||||
Loading…
Reference in a new issue