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

The execution order of delete_surrounding_text() and commit_text() gets jumbled #2570

Closed
ShikiOkasaka opened this issue Oct 8, 2023 · 4 comments

Comments

@ShikiOkasaka
Copy link

ShikiOkasaka commented Oct 8, 2023

Which distribution and version?:
Ubuntu 23.10 and Fedora 39 Beta

Which desktop environment and version?:
GNOME 45.0

Which session type?:
Wayland with GTK_IM_MODULE=ibus
X11

Note: Without GTK_IM_MODULE=ibus, IBus.Engine.get_surrounding_text() returns text positions in octets not in the number of characters on Wayland.

Which application and version?:
gnome-text-editor 45.0
gtk4-demo-application 4.12.3

IBus version?:
IBus 1.5.29-rc1 using IBus Python API for IBus.Engine

Issue description:
The execution order of delete_surrounding_text() and commit_text() appears to be jumbled in gnome-text-editor and gtk4-demo-application.

Steps to reproduce:

  1. Enter text "123" in the text editor.
  2. Execute delete_surrounding_text(-1, 1) and then commit_text(IBus.Text.new_from_string('ABC'))
  3. The remaining text should be "12ABC" but you'll get "123AB".

With gedit, you can get "12ABC" as expected.

This steps can be tested by adding the code like below to engine.py:

        if keyval == keysyms.Return:
            self.delete_surrounding_text(-1, 1)
            self.commit_text(IBus.Text.new_from_string('ABC'))
            return True

On Wayland, this steps work as expected if GTK_IM_MODULE=ibus is not defined.

Can you reproduce your problem when you restart ibus-daemon? (yes / no):
yes

Do you see any errors when you run ibus-daemon with the verbose option?:
no

Can you reproduce your problem with a new user account instead of the current your account? (yes / no):
yes

@fujiwarat
Copy link
Member

I made the patch.
I hope Fedora 39 will be released next week.

@FiestaLake

This comment was marked as off-topic.

@fujiwarat
Copy link
Member

Although your patch does reduce the occurrence of the bug, libhangul/ibus-hangul#118 still occurs sometimes. Is this bug different so that I need to open a separate thread?

Don't comment about ibus 1.5.28 and also your issue isn't relative with surrounding text.

fujiwarat added a commit that referenced this issue Nov 9, 2023
DeleteSurroundingText also can be delayed sending to IBus clients.
Now surrounding D-Bus methods are added to PostProcessKeyEvent.

Fixes: 38f09c6

BUG=#2570
@fujiwarat fujiwarat modified the milestones: 1.5.30, 1.5.29 Nov 9, 2023
@fujiwarat
Copy link
Member

I decided to commit this fix to 1.5.29-rc2.

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

No branches or pull requests

3 participants