Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication: Autocompletion Improvement for Tagging Users and Channels #72

Closed
FelberMartin opened this issue Oct 24, 2024 · 4 comments · Fixed by #76
Closed

Communication: Autocompletion Improvement for Tagging Users and Channels #72

FelberMartin opened this issue Oct 24, 2024 · 4 comments · Fixed by #76
Assignees
Labels
improvement Minor improvements, no new functionality

Comments

@FelberMartin
Copy link
Collaborator

FelberMartin commented Oct 24, 2024

Bug

Current behaviour
When typing a tagging ("#" or "@") character and my search term, the autocompletion list is shown as expected. After typing a space character, the list is still shown and I have to close it manually by tapping outside of the list.
image

Expected behaviour
After typing a space, the autocompletion list should not be shown anymore.

Update: This behaviour is intended for tagging users with the first and surname. See comments below

UI Enhancement

The autocompletion list currently is partly drawn over the Preview and Edit buttons and could visually be more separated from the rest of the UI.
image

@FelberMartin FelberMartin added bug Something isn't working improvement Minor improvements, no new functionality labels Oct 24, 2024
@FelberMartin FelberMartin self-assigned this Oct 24, 2024
@FelberMartin
Copy link
Collaborator Author

FelberMartin commented Oct 24, 2024

I just looked into the code and found the behaviour that I described as a bug, seems to be intentional. At least the code communicates that a tag continues over a single whitespace and only the second whitespace terminates it.

private fun CharSequence.indexOfLastWhileTag(tagChars: List<Char>): Int? {
var foundWhitespace = false
for (index in lastIndex downTo 0) {
val currentChar = this[index]
if (currentChar.isWhitespace() && foundWhitespace) {
return index + 1
} else if (currentChar in tagChars) {
return index
} else if (currentChar.isWhitespace()) {
foundWhitespace = true
}
}
return if (isEmpty()) null else 0
}
/**
* Takes characters until the end of the string or a second whitespace has been found
*/
private fun String.takeWhileTag(): String {
var foundWhitespace = false
for (index in indices) {
val currentChar = this[index]
if (currentChar.isWhitespace() && foundWhitespace) {
return substring(0, index)
} else if (currentChar.isWhitespace()) {
foundWhitespace = true
}
}
return this
}

@TimOrtel Do you know what the reasoning for this behaviour was?

In the WebApp the Autocompletion disappears after typing the first space. On iOS the behaviour is different again, there the Autocompletion does not disappear at all until you click a entry from the list. But I assume this can be considered a bug (@anian03) ?

@anian03
Copy link
Member

anian03 commented Oct 24, 2024

In the WebApp the Autocompletion disappears after typing the first space. On iOS the behaviour is different again, there the Autocompletion does not disappear at all until you click a entry from the list. But I assume this can be considered a bug (@anian03) ?

From what I know on iOS this was intentional at the time because we had no way of knowing where the cursor is, and we assumed the user still wanted to pick an exercise. But I agree with you that we should also consider changing this on iOS as well.

My take on the single whitespace: Some people might search for an exercise using # name-here, and a freestanding hashtag is unlikely to occur in a message anyways, so this makes some sense

@TimOrtel
Copy link
Contributor

Pretty sure it is because when tagging people they have a space between first name and last name.

@FelberMartin
Copy link
Collaborator Author

After going to sleep I just realised that, thanks for the hint :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Minor improvements, no new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants