mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-02 09:46:38 +00:00
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…
x
Reference in New Issue
Block a user