mike-fabian / ibus-typing-booster

ibus-typing-booster is a completion input method for faster typing
https://mike-fabian.github.io/ibus-typing-booster/
Other
232 stars 16 forks source link

In WhatsApp and Telegram (used in Firefox) in the middle of the message, when a new word is being started, the first character disappears #473

Closed mike-fabian closed 11 months ago

mike-fabian commented 11 months ago
          While the initial `É` problem is fixed, Mike, from time to time, again on Firefox Web WhatsApp, in the middle of the message, when a new word is being started, the first character disappears. 

That occurs with not accented first characters, and I have not, until now, devised a systematic way of reproducing the issue.

The issue does not occur when using Chrome.

Originally posted by @psads-git in https://github.com/mike-fabian/ibus-typing-booster/issues/471#issuecomment-1845442219

mike-fabian commented 11 months ago

Happens even more often on Telegram.

mike-fabian commented 11 months ago

Video using WhatsApp: https://github.com/mike-fabian/ibus-typing-booster/issues/471#issuecomment-1845542884

psads-git commented 11 months ago

It appears that some randomness commands the occurrence of the issue, Mike: Sometimes, it occurs very often while writing a same message.

mike-fabian commented 11 months ago

I think I have a fix/workaround.

My current fix/workaround is already an improvement, the first character of a new word now never seems to vanish in WhatsApp and Telegram when using in Firefox.

But, when the input becomes empty after a commit and a prediction should appear because the option

Minimum numbers of chars for completion  [   0]

is used (The problem reported here seems to occur only when that option is used), then sometimes that prediction does not appear.

That is already much better then when first characters of new words disappear, with my current fix/workaround, one sometimes does not get a prediction when there should be one, that is not nice but not as bad as a typed character disappearing.

mike-fabian commented 11 months ago

Video showing the remaining problem in Telegram. About every second time, the prediction which should appear when the input is empty does not appear. It is not exactly every second time, just on the average about every second time:

https://github.com/mike-fabian/ibus-typing-booster/assets/2330175/39de3cec-ad5c-4684-97a3-ae0d0c85a71f

psads-git commented 11 months ago

Yes, I agree with you that the workaround, although not the best solution, is much better than the current status quo.

Maybe, another workaround is to pass that option from 0 to 1.

psads-git commented 11 months ago

Yet, another workaround is to use Chrome instead of Firefox! ;-)

mike-fabian commented 11 months ago

Yes, I agree with you that the workaround, although not the best solution, is much better than the current status quo.

Maybe, another workaround is to pass that option from 0 to 1.

But we want to be able to continue to use 0 for that option.

mike-fabian commented 11 months ago

Now I have improved my workaround to also show the predictions on empty input always when they should be shown. Test builds for ibus-typing-booster-2.24.6 are here:

https://copr.fedorainfracloud.org/coprs/mfabian/ibus-typing-booster/builds/

mike-fabian commented 11 months ago

Seems to work with ibus-typing-booster-2.24.6:

https://github.com/mike-fabian/ibus-typing-booster/assets/2330175/9492e152-361c-4e8b-ab5c-d335c7875172

psads-git commented 11 months ago

Thanks, Mike. It appears that it is working properly, but, maybe, we should wait for longer to make sure the issues does not reappear.

psads-git commented 11 months ago

There is an innocuous side-effect: The suggested word is repeated in gedit, Mike. That does not affect the usability of ibus-typing-booster at all.

Please, see the attached video.

https://github.com/mike-fabian/ibus-typing-booster/assets/75945439/cb87c81f-27ef-48d7-bb74-08843b462df8

mike-fabian commented 11 months ago

You mean this temporary duplication of the word uma here?:

Screenshot

psads-git commented 11 months ago

Yes, Mike. That is innocuous though.

mike-fabian commented 11 months ago

Before the fix/workaround for this issue here I did the following when the word uma was in preedit and a space was typed:

But in this procedure, the preedit is update twice during the same key event. That causes sometimes disappearing characters in WhatsApp and Telegram. If the preedit is updated twice in quick succession, WhatsApp and Telegram trigger a callback to do_reset() which may cause characters to be lost.

Now I do only this:

I.e. I omitted the first update of the preedit to empty directly after the commit. So now the word uma is committed, but the preedit still contains the word uma (shown underlined!) and the commit causes the preedit to move to the right of the committed word. So now you see umauma where the second, underline uma is the preedit. Now the other stuff is done

That takes some time and during that time the underlined preedit containing uma stays visible. Then, when that work is done, the preedit is updated:

And the old preedit containing uma vanishes.

Before I had an update to an empty preedit immediately after the commit, in the next line in the source code where the commit really happend. Therefore, the preedit was shown as empty (i.e. invisible) while doing the extra stuff after the commit:

But now it is

So with the new code, it takes too much time until everything is done and the preedit is updated to the final result at last. I cannot make that work inbetween faster, so I wonder what I could do here.

Doing fewer updates of the preedit seems generally like a good idea. Not only because of WhatsApp and Telegram in Firefox, similar problems sometimes occur when using Gnome Wayland because of problems in Mutter. When doing ibus actions like

then Mutter sometimes changes the order of the events or looses some of the events. I.e. when committing text and then forwarding a space, the order might be reversed in Mutter and the result may be text instead of the desired text. Committing text and then committing ` instead of forwarding the space key does not work either because Mutter then ignores the first commit completely and one just gets . First appending the space totextand then committingtext ` in one single action makes it work.

Overall I got the impression that it is good to do as few of these ibus actions as possible during the processing of one key event.

I don’t like that old preedit lingering around so long.

But I have no idea what I can do here. Updating the preedit again directly after the commit brings back the problem in WhatsApp and Telegram and maybe also causes problems in Mutter (Gnome Wayland) and maybe in other places as well.

Doing many ibus actions during processing one key event should work, but what can I do when there are applications where it doesn't work?

Doing as few such ibus actions as possible during one key event reduces the likelyhood that something can go wrong. If there is only one action, it cannot be overwritten by another action or change order with another action.

So fewer actions makes it more reliable, but fewer update preedits may cause a wrong preedit linger for longer causing this very irritating flicker.

psads-git commented 11 months ago

That is really an intricate problem, Mike! Personally, I do not mind the duplicated umauma.

mike-fabian commented 11 months ago

Even with Minimum chars for completion [ 1] the old preedit is sometimes visible for a short moment after committing with space. Although in that case it is extremely short, the only work which is done in that case after the commit is the recording to the user database which is very fast. So it is not very obvious and sometimes even fast enough to be invisible.

But predicting the next word when using Minimum chars for completion [ 0] is more work and takes long enough that the lingering of the old preedit is often quite clearly visible.

mike-fabian commented 11 months ago

That is really an intricate problem, Mike! Personally, I do not mind the duplicated umauma.

Yes, I think if I only have the choice between loosing characters or reversing order in some applications and some visual distraction by a preedit which stays too long, I choose the visual distraction.

Better some visual distraction which does not harm other than hurt the eyes than a clearly wrong result.

If I could make the prediction of the next word faster, this would become less visible. But looking at the code to predict the next word, I see no obvious way to make it faster.

mike-fabian commented 11 months ago

Fix included in https://github.com/mike-fabian/ibus-typing-booster/releases/tag/2.24.10in