Fix mentioning blank display names
If the display name of a user is blank (e.g. just a space character), autocomplete it as a user ID. If the display name starts or ends with whitespace, trim it.
This commit is contained in:
parent
fbf6e48b5b
commit
fc6827807c
1
TODO.md
1
TODO.md
|
@ -1,6 +1,5 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- save usersCompleted in state.json
|
|
||||||
- refresh server list button
|
- refresh server list button
|
||||||
|
|
||||||
- global presence control
|
- global presence control
|
||||||
|
|
|
@ -70,7 +70,7 @@ HListView {
|
||||||
function accept() {
|
function accept() {
|
||||||
if (currentIndex !== -1) {
|
if (currentIndex !== -1) {
|
||||||
const member = model.get(currentIndex)
|
const member = model.get(currentIndex)
|
||||||
usersCompleted[member.id] = member.display_name
|
usersCompleted[member.id] = member.display_name.trim()
|
||||||
usersCompletedChanged()
|
usersCompletedChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ HListView {
|
||||||
if (autoOpen) autoOpenCompleted = true
|
if (autoOpen) autoOpenCompleted = true
|
||||||
|
|
||||||
const member = model.get(currentIndex)
|
const member = model.get(currentIndex)
|
||||||
const replacement = member.display_name || member.id
|
const replacement = member.display_name.trim() || member.id
|
||||||
|
|
||||||
replaceCompletionOrCurrentWord(replacement)
|
replaceCompletionOrCurrentWord(replacement)
|
||||||
replacementStart = textArea.cursorPosition - replacement.length
|
replacementStart = textArea.cursorPosition - replacement.length
|
||||||
|
@ -154,7 +154,7 @@ HListView {
|
||||||
|
|
||||||
if (root.currentIndex !== -1) {
|
if (root.currentIndex !== -1) {
|
||||||
const member = root.model.get(root.currentIndex)
|
const member = root.model.get(root.currentIndex)
|
||||||
const repl = member.display_name || member.id
|
const repl = member.display_name.trim() || member.id
|
||||||
end = root.wordToComplete.start + repl.length
|
end = root.wordToComplete.start + repl.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user