Skip to content

Commit

Permalink
fix(TokenClassification): Display characters between tokens words (#1418
Browse files Browse the repository at this point in the history
)

This PR fixes the display of characters between duplicate words or when the suffix matches the following word in the Token Classifier

Closes #1414
Closes #1383

(cherry picked from commit 97ffc64)
  • Loading branch information
leiyre authored and frascuchon committed Apr 25, 2022
1 parent 35efceb commit a08cd7b
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -65,17 +65,10 @@ export default {
const start = recordHasEmoji
? indexOf(this.record.text, token, startPosition)
: this.record.text.indexOf(token, startPosition);
const nextStart = recordHasEmoji
? indexOf(
this.record.text,
this.record.tokens[index + 1],
startPosition
)
: this.record.text.indexOf(
this.record.tokens[index + 1],
startPosition
);
const end = start + (recordHasEmoji ? length(token) : token.length);
const nextStart = recordHasEmoji
? indexOf(this.record.text, this.record.tokens[index + 1], end)
: this.record.text.indexOf(this.record.tokens[index + 1], end);
const charsBetweenTokens = this.record.text.slice(end, nextStart);
let highlighted = false;
for (let highlight of searchKeywordsSpans) {
Expand Down

0 comments on commit a08cd7b

Please sign in to comment.