charmbracelet/bubbletea

IME input in wrong position

Bryan2333 opened this issue · 1 comments

Describe the bug
Candidate window of input method is at wrong position on Linux. The window is always at the left bottom side of the application.

Setup
Please complete the following information along with version numbers, if applicable.

  • OS: Arch Linux with KDE Plasma Wayland
  • Shell: fish
  • Terminal Emulator: konsole
  • Terminal Multiplexer: none

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repository
  2. Build the example like textinput, textarea
  3. Run the program
  4. Try to use input method like Fcitx5.

Source Code
Just the provided example code

Expected behavior
The candidate box following the cursor.

Screenshots
Screenshot_20231128_164927.webp

Additional context

Thanks for the report! This appears to be happening because Bubble Tea keeps the cursor in the lower left position while the various input types in Bubbles render a virtual (simulated) cursor. To solve for this we'll need some changes to the renderer, a low level cursor API, and some updates in Bubbles.

Related: charmbracelet/bubbles#361

Additional reference (see "What Can Program Authors Do Today?" near the end): https://mitchellh.com/writing/grapheme-clusters-in-terminals