Skip to content

Conversation

@ouchadam
Copy link
Contributor

Fixes #3449 Leftover characters when inserting emojis by text.

This was a really strange issue, it seemed to only affect single character look ups eg :a but didn't affect all emojis equally, :z worked without issue. There's no obvious place where we're incorrectly manipulating the message text content and replacing the replace with a delete + insert also fixed the issue... perhaps some lingering spans in some cases?

  • Also fixed the emoji replacement always using the last : by taking into account the current cursor position
BEFORE INSERT EMOJI AFTER INSERT EMOJI
before-emoji-text after-emoji-text
BEFORE POSITION AFTER POSITION
before-emoji-position after-emoji-position

- not entirely sure why this works but replacing the replace with separate delete + insert commands allows the previous query to be fully removed
@github-actions
Copy link

github-actions bot commented Nov 26, 2021

Unit Test Results

  66 files  ±0    66 suites  ±0   52s ⏱️ -8s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 7b691cc. ± Comparison against base commit 5401583.

♻️ This comment has been updated with latest results.

Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those 2 fixes. Just a small comment about a comment :)

override fun onPopupItemClicked(editable: Editable, item: String): Boolean {
// Detect last ":" and remove it
var startIndex = editable.lastIndexOf(":")
var startIndex = editable.subSequence(0, editText.selectionStart).lastIndexOf(":")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update the comment above?

Copy link
Contributor Author

@ouchadam ouchadam Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmarty bmarty merged commit 173ccc6 into develop Nov 29, 2021
@bmarty bmarty deleted the feature/adm/typing-emoji-leftovers branch November 29, 2021 10:32
@Bubu
Copy link
Contributor

Bubu commented Nov 29, 2021

Thank you so much for fixing this ❤️!

This has been driving me nuts for such a long time (and I never really could find reliable reproduction steps)... 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emoji autocompleter sometimes leaves search string after replacement

4 participants