diff --git a/package-lock.json b/package-lock.json index bea5e14..f40f782 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@openwebwork/codemirror-lang-pg", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@openwebwork/codemirror-lang-pg", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "license": "MIT", "dependencies": { "@codemirror/language": "^6.10.2", diff --git a/package.json b/package.json index 0a33e5a..d6e8f75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openwebwork/codemirror-lang-pg", - "version": "0.0.1-beta.16", + "version": "0.0.1-beta.17", "description": "PG language support for CodeMirror", "author": "The WeBWorK Project", "license": "MIT", diff --git a/src/pgml-parse.ts b/src/pgml-parse.ts index 82e888f..61dbbf2 100644 --- a/src/pgml-parse.ts +++ b/src/pgml-parse.ts @@ -379,14 +379,14 @@ export class PGMLParse { const type = BlockDefs[token.substring(0, 1)]?.type; let block = this.block; if (block && block.type === type) { - block.to += block.token?.length ?? 1; + block.to += token.length; this.Terminate(); return; } while (block?.type !== 'root') { if (block && block.prev?.type === type) { this.End(`end of ${type ?? ''}`, block); - block.to += block.token?.length ?? 1; + block.to += token.length; this.Terminate(); return; } diff --git a/src/pgml.ts b/src/pgml.ts index f25c4d9..b61f2af 100644 --- a/src/pgml.ts +++ b/src/pgml.ts @@ -336,7 +336,7 @@ const pgmlFormat = (block: Item, offset: number): Element[] => { const lastChild = block.stack?.at(-1); if (lastChild instanceof Item && block.to === lastChild.to) children.push(elt(Type.PGMLError, block.to + offset, block.to + offset)); - else children.push(elt(Type.EmphasisMark, block.to - (block.token?.length ?? 1) + offset, block.to + offset)); + else children.push(elt(Type.EmphasisMark, children.slice(-1)[0].to, block.to + offset)); return [ elt( block.type === 'bold' ? Type.StrongEmphasis : Type.Emphasis,