fix: fix mention popup not showing after a line break
This commit is contained in:
parent
a01e851070
commit
2e248d710d
|
@ -57,7 +57,7 @@ Item {
|
||||||
|
|
||||||
let cursorAtEnd = this.cursorPosition === filter.length;
|
let cursorAtEnd = this.cursorPosition === filter.length;
|
||||||
let hasAtBeforeCursor = filter.charAt(this.cursorPosition - 1) === "@"
|
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 hasWhiteSpaceAfterAt = filter.charAt(this.cursorPosition) === " "
|
||||||
let hasWhiteSpaceBeforeCursor = filter.charAt(this.cursorPosition - 1) === " "
|
let hasWhiteSpaceBeforeCursor = filter.charAt(this.cursorPosition - 1) === " "
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter === "@" ||
|
if (filter === "@" ||
|
||||||
(hasAtBeforeCursor && hasWhiteSpaceBeforeAt && hasWhiteSpaceAfterAt) ||
|
(hasAtBeforeCursor && hasWhiteSpaceBeforeAt && hasWhiteSpaceAfterAt) ||
|
||||||
(this.cursorPosition === 1 && hasAtBeforeCursor && hasWhiteSpaceAfterAt) ||
|
(this.cursorPosition === 1 && hasAtBeforeCursor && hasWhiteSpaceAfterAt) ||
|
||||||
(cursorAtEnd && filter.endsWith("@") && hasWhiteSpaceBeforeAt)) {
|
(cursorAtEnd && filter.endsWith("@") && hasWhiteSpaceBeforeAt)) {
|
||||||
this.lastAtPosition = this.cursorPosition - 1;
|
this.lastAtPosition = this.cursorPosition - 1;
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
let filterWithoutAt = filter.substring(lastAtPosition + 1, this.cursorPosition)
|
let filterWithoutAt = filter.substring(lastAtPosition + 1, this.cursorPosition)
|
||||||
|
|
Loading…
Reference in New Issue