Tweak highlighting for keywords
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
This commit is contained in:
parent
21d26ede6c
commit
6101132a15
@ -117,6 +117,9 @@ export class JavaScriptFile extends AbstractFileType {
|
|||||||
'^',
|
'^',
|
||||||
'~',
|
'~',
|
||||||
'!',
|
'!',
|
||||||
|
'.',
|
||||||
|
',',
|
||||||
|
';',
|
||||||
];
|
];
|
||||||
public readonly hlOptions: HighlightingOptions = {
|
public readonly hlOptions: HighlightingOptions = {
|
||||||
...defaultHighlightOptions,
|
...defaultHighlightOptions,
|
||||||
|
@ -443,11 +443,17 @@ export class Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const keyword of keywords) {
|
for (const keyword of keywords) {
|
||||||
if (i + strlen(keyword) < this.rsize) {
|
// Skip keywords that can't fit in the current line
|
||||||
const nextChar = this.rchars[i + strlen(keyword)];
|
if (i + strlen(keyword) >= this.rsize) {
|
||||||
if (!isSeparator(nextChar)) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
// Check the character after the keyword
|
||||||
|
// if it is not a 'separator' character,
|
||||||
|
// we must be highlighting the middle of something else
|
||||||
|
const nextChar = this.rchars[i + strlen(keyword)];
|
||||||
|
if (!isSeparator(nextChar)) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const maybeHighlight = this.highlightStr(i, keyword, hl_type);
|
const maybeHighlight = this.highlightStr(i, keyword, hl_type);
|
||||||
|
Loading…
Reference in New Issue
Block a user