mirror of
https://github.com/kotaindah55/extended-markdown-syntax.git
synced 2026-07-22 05:38:06 +00:00
fix: remove short-circuting when offset is non-zero
Short-circuiting while offset is a non-zero value causes unexpected result when the parser intializes parsing. If it happens, the current context isn't obtained. Hence, tokens that intended to be resolved when facing the end of current line (i.e. due to current context being different with the previous one) may not be resolved.
This commit is contained in:
parent
f7376eea86
commit
04a88cb15a
1 changed files with 6 additions and 5 deletions
|
|
@ -174,7 +174,6 @@ export class ParserState {
|
|||
this.curCtx = ctx;
|
||||
}
|
||||
resolveContext() {
|
||||
if (this.offset) { return }
|
||||
while (this.cursorPos() == "before") { this.nextCursor() }
|
||||
this.setContext(this.getContext());
|
||||
let isSkip = false,
|
||||
|
|
@ -207,9 +206,11 @@ export class ParserState {
|
|||
toBeResolved = true;
|
||||
offset -= 1;
|
||||
}
|
||||
toBeResolved && this.queue.resolve(NonHighlightFormats, offset);
|
||||
includesHl && this.queue.resolve([Format.HIGHLIGHT], offset);
|
||||
isSkip && this.skipCursorRange();
|
||||
this.curCtx && this.nextCursor();
|
||||
if (!this.offset) {
|
||||
if (toBeResolved) { this.queue.resolve(NonHighlightFormats, offset) }
|
||||
if (includesHl) { this.queue.resolve([Format.HIGHLIGHT], offset) }
|
||||
}
|
||||
if (isSkip) { this.skipCursorRange() }
|
||||
if (this.curCtx) { this.nextCursor() }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue