From a1eabde3a36b11fb3da2469b04f0b1a5b3d6dbe9 Mon Sep 17 00:00:00 2001 From: Panagiotis <27917356+panoschal@users.noreply.github.com> Date: Thu, 11 Mar 2021 19:14:04 +0200 Subject: [PATCH] fix: create a PillCandidatePart on the beginning of a part string --- src/editor/parts.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/editor/parts.ts b/src/editor/parts.ts index 67f6a2c0c5..ccd90da3e2 100644 --- a/src/editor/parts.ts +++ b/src/editor/parts.ts @@ -189,7 +189,13 @@ abstract class PlainBasePart extends BasePart { if (chr !== "@" && chr !== "#" && chr !== ":" && chr !== "+") { return true; } - // only split if the previous character is a space + + // split if we are at the beginning of the part text + if (offset === 0) { + return false; + } + + // or split if the previous character is a space // or if it is a + and this is a : return this._text[offset - 1] !== " " && (this._text[offset - 1] !== "+" || chr !== ":");