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 = {
|
||||
...defaultHighlightOptions,
|
||||
|
@ -443,12 +443,18 @@ export class Row {
|
||||
}
|
||||
|
||||
for (const keyword of keywords) {
|
||||
if (i + strlen(keyword) < this.rsize) {
|
||||
// Skip keywords that can't fit in the current line
|
||||
if (i + strlen(keyword) >= this.rsize) {
|
||||
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);
|
||||
if (maybeHighlight.isSome()) {
|
||||
|
Loading…
Reference in New Issue
Block a user