From d41b146c518ba92eb8a2509cfc114fef68223275 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 27 Dec 2022 15:22:14 +0100 Subject: [PATCH] Fixes #236 --- web/cm_plugins/hide_mark.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/cm_plugins/hide_mark.ts b/web/cm_plugins/hide_mark.ts index 7c5f90be..219c4003 100644 --- a/web/cm_plugins/hide_mark.ts +++ b/web/cm_plugins/hide_mark.ts @@ -93,10 +93,15 @@ export function hideHeaderMarkPlugin() { return; } + const spacePos = line.indexOf(" "); + if (spacePos === -1) { + // Not complete header + return; + } widgets.push( invisibleDecoration.range( from, - from + line.indexOf(" ") + 1, + from + spacePos + 1, ), ); },