fix: fix mention popup not showing after a line break

This commit is contained in:
Jonathan Rainville 2021-04-01 14:02:37 -04:00 committed by Iuri Matias
parent a01e851070
commit 2e248d710d
1 changed files with 6 additions and 6 deletions

View File

@ -57,7 +57,7 @@ Item {
let cursorAtEnd = this.cursorPosition === filter.length;
let hasAtBeforeCursor = filter.charAt(this.cursorPosition - 1) === "@"
let hasWhiteSpaceBeforeAt = filter.charAt(this.cursorPosition - 2) === " "
let hasWhiteSpaceBeforeAt = filter.charAt(this.cursorPosition - 2) === " " || filter.charAt(this.cursorPosition - 2) === "\n"
let hasWhiteSpaceAfterAt = filter.charAt(this.cursorPosition) === " "
let hasWhiteSpaceBeforeCursor = filter.charAt(this.cursorPosition - 1) === " "
@ -66,11 +66,11 @@ Item {
}
if (filter === "@" ||
(hasAtBeforeCursor && hasWhiteSpaceBeforeAt && hasWhiteSpaceAfterAt) ||
(this.cursorPosition === 1 && hasAtBeforeCursor && hasWhiteSpaceAfterAt) ||
(cursorAtEnd && filter.endsWith("@") && hasWhiteSpaceBeforeAt)) {
this.lastAtPosition = this.cursorPosition - 1;
return true
(hasAtBeforeCursor && hasWhiteSpaceBeforeAt && hasWhiteSpaceAfterAt) ||
(this.cursorPosition === 1 && hasAtBeforeCursor && hasWhiteSpaceAfterAt) ||
(cursorAtEnd && filter.endsWith("@") && hasWhiteSpaceBeforeAt)) {
this.lastAtPosition = this.cursorPosition - 1;
return true
}
let filterWithoutAt = filter.substring(lastAtPosition + 1, this.cursorPosition)