From cf5e4d3d94fff9f0446951d0d71f045fc0d8c89f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 24 May 2019 12:38:19 +0200 Subject: [PATCH] make consecutive :/@/# separate pill candidates e.g. accept the first character always to start the autocompletion but after that refer to the plainpart logic to split up in new pill candidates. Also, don't allow merging adjacent parts. This makes sure that "@nonmatchingfoo @someuser" only matches "someuser" in the autocomplete. --- src/editor/parts.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/editor/parts.js b/src/editor/parts.js index ad50009d49..fbdd22d8bb 100644 --- a/src/editor/parts.js +++ b/src/editor/parts.js @@ -313,8 +313,16 @@ export class PillCandidatePart extends PlainPart { return this._autoCompleteCreator(updateCallback); } - acceptsInsertion(chr) { - return true; + acceptsInsertion(chr, i) { + if (i === 0) { + return true; + } else { + return super.acceptsInsertion(chr, i); + } + } + + merge() { + return false; } acceptsRemoval(position, chr) {