Riey / kime

Korean IME
GNU General Public License v3.0
503 stars 53 forks source link

chrome+wayland text selection bug #668

Open keighrim opened 4 months ago

keighrim commented 4 months ago

First off, here's my environment.

OS: Arch Linux x86_64
Kernel: 6.8.5-arch1-1
DE: KDE Plasma 6.0.3
WM: KWin (Wayland)

# pacman -Qs kime
local/kime-git 3.0.2.r9.gf82ce41-1
    Korean IME
local/kime-git-debug 3.0.2.r9.gf82ce41-1
    Detached debugging symbols for kime-git

$ git  --git-dir ~/.cache/yay/kime-git/kime-git show  | head -3
commit f82ce419f697d4f836e79bf6c3de074f35f96f23
Author: Janghyub Seo <jhyub06@gmail.com>
Date:   Mon Apr 8 14:56:28 2024 +0900

I had been using kime + chrome + xwayland for a while and it served me fine w.r.t. Hangul typing experience, but found that there was a PR (#659 ) recently merged for a better support for wayland native protocols, so I tried to install upstream (kime-git AUR package) and tested out. kime works pretty well in general with wayland-native chrome (--ozone-platform=wayland --enable-wayland-ime), but not perfectly. I found two (one somewhat critical and one minor-ish) problems related to text selection, and I 'll try to describe them here. (They are observed in both English and Hangul modes)

  1. pressing a non-character key when text is selected deletes the selected text
    • reproduce steps:
      1. run chrome on wayland
      2. put the cursor in a text form in a web page
      3. type in some text, then select a portion of the input text by mouse drag
      4. hit any of shift, ctrl, alt, super (or arrow keys)
    • expected:
      • nothing happens to the text, since the pressed key should not send any actual character
    • observed:
      • all the selected text is deleted
    • notes:
      1. most critically, this bug effectively disables 1) shift+arrow to select text by keyboard, and 2) ctrl-c to copy-to-clipboard the selected text.
      2. this somehow also messes up the undo stack, and I cannot "undo" deletions happened before two previous "bugs".
  2. "auto completion" of the top suggestion in chrome address bar not work
    • reproduce steps:
      1. run chrome on wayland
      2. put the cursor in the address bar
      3. start typing some keyword, chrome will give you suggestions, "auto-completing" the top one after the current cursor as selected text. Here's a screenshot of the address bar with suggestions when I typed you. image
      4. hit enter to pick the top suggestion
    • expected:
      • chrome goes to the webpage or shows search results of the top suggestion - in the screenshot case, I expect hitting enter will bring me to youtube.com page.
    • observed:
      • chrome shows the search results of the exact keyword I typed - in the screenshot case, I actually landed on google search results for you.
    • workaround:
      • I can hit a down arrow to explicit pick the top suggestion and then hit enter to go to youtube.com

I'm not sure these are chrome bugs or kime bugs (or an unfixable technical or political limitation of the current wayland IM landscape). If this is indeed a chrome/chromium problem, could you point me to the right direction so that I can open a ticket on the chrome side?

Thanks for the great work by the way!

Jhyub commented 4 months ago

I think the first one might be a chromium issue, because I failed to reproduce it in alacritty. Still not really sure because it's a terminal emulator and might have special processing when it comes to text selection.
I was able to reproduce both issues on chromium.

ASerinYellsNotCute commented 4 months ago

Currently unable to reproduce on latest clean installs of kime-git, brave-bin. Environment is Arch Linux. (6.8.8-arch1-1)

Note that I don't have much time to test this. It seems like I can't reproduce issues based on what @keighrim said.

keighrim commented 4 months ago

Just tested with brave, and got exactly the same errors

OS: Arch Linux x86_64
Kernel: 6.8.8-arch1-1
Shell: bash 5.2.26
DE: KDE Plasma 6.0.4
WM: KWin (Wayland)
Terminal: konsole 24.2.2

---

$ pacman -Qs kime
local/kime-git 3.0.2.r9.gf82ce41-1
    Korean IME
local/kime-git-debug 3.0.2.r9.gf82ce41-1
    Detached debugging symbols for kime-git

$ git  --git-dir ~/.cache/yay/kime-git/kime-git show  | head -3
commit f82ce419f697d4f836e79bf6c3de074f35f96f23
Author: Janghyub Seo <jhyub06@gmail.com>
Date:   Mon Apr 8 14:56:28 2024 +0900

$ pacman -Qs brave
local/brave-bin 1:1.65.126-1
    Web browser that blocks ads and trackers by default (binary release)

$ cat ~/.config/brave-flags.conf 
--ozone-platform=wayland 
--enable-wayland-ime 

@ASerinYellsNotCute could you please confirm your brave is running on wayland, not x11/xwayland?
(visit brave://gpu/ and search for "ozone platform")

ASerinYellsNotCute commented 4 months ago

Just tested with brave, and got exactly the same errors

OS: Arch Linux x86_64
Kernel: 6.8.8-arch1-1
Shell: bash 5.2.26
DE: KDE Plasma 6.0.4
WM: KWin (Wayland)
Terminal: konsole 24.2.2

---

$ pacman -Qs kime
local/kime-git 3.0.2.r9.gf82ce41-1
    Korean IME
local/kime-git-debug 3.0.2.r9.gf82ce41-1
    Detached debugging symbols for kime-git

$ git  --git-dir ~/.cache/yay/kime-git/kime-git show  | head -3
commit f82ce419f697d4f836e79bf6c3de074f35f96f23
Author: Janghyub Seo <jhyub06@gmail.com>
Date:   Mon Apr 8 14:56:28 2024 +0900

$ pacman -Qs brave
local/brave-bin 1:1.65.126-1
    Web browser that blocks ads and trackers by default (binary release)

$ cat ~/.config/brave-flags.conf 
--ozone-platform=wayland 
--enable-wayland-ime 

@ASerinYellsNotCute could you please confirm your brave is running on wayland, not x11/xwayland? (visit brave://gpu/ and search for "ozone platform")

Seems like I have misunderstood. It shows up "X11", not wayland. Sorry for the hesitation.