From a9c836cd35ba42ef81fedf76bf0a8708b917a802 Mon Sep 17 00:00:00 2001 From: kotaindah55 Date: Sat, 8 Feb 2025 22:45:02 +0200 Subject: [PATCH] feat: assign blkStart at the initialization --- src/editor-mode/parser/ParserState.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/editor-mode/parser/ParserState.ts b/src/editor-mode/parser/ParserState.ts index 6d4eabd..2bfea24 100644 --- a/src/editor-mode/parser/ParserState.ts +++ b/src/editor-mode/parser/ParserState.ts @@ -31,6 +31,15 @@ export class ParserState { this.cursor = this.tree.cursor(); this.settings = config.settings; this.nextCursor(); + // if previous line is a blank line or the + // current line is the first line, then the current one + // should be a block start + let prevLine = this.prevLine; + if (prevLine) { + this.blkStart = isBlankLine(prevLine); + } else { + this.blkStart = true; + } if ( (!this.lastToken || this.lastToken.to < this.line.from) && this.lineStr[0] == "!" && this.offset < 11