Skip to content

Conversation

@amtoaer
Copy link
Contributor

@amtoaer amtoaer commented Jan 7, 2026

Closes #46084

I'm not very familiar with this part of the code, so I'm not sure if this is the right way to fix it.

During debugging, I discovered that marked_range_utf16 consistently stores an empty range representing the cursor position (e.g., 0..0, 1..1) instead of an actual marked range. This bug is caused by the range being empty.

In my testing, the IME starts working correctly as long as I change it to any non-empty range (e.g., 0..1). Although I suspect the correct value should probably be 0..marked_text.encode_utf16().count().

Before/After:

CleanShot.2026-01-07.at.10.36.51.mp4

Release Notes:

  • Fixed an issue where backspace fails to remove the last character of IME marked text in the terminal.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 7, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Jan 7, 2026
@maxdeviant maxdeviant changed the title terminal: fix last character of IME marked text fails to be deleted Jan 7, 2026
@reflectronic
Copy link
Member

I don't have a Mac to test with, but assuming my suggestion still fixes the issue, this looks good to me.

Ideally we would implement the rest of this interface properly (e.g. adding a 'virtual' cursor that lets you move around in the marked text) but this is a good improvement.

@amtoaer
Copy link
Contributor Author

amtoaer commented Jan 14, 2026

Thanks! I've adjusted the code following your suggestion and verified it's still working on Mac.

CleanShot.2026-01-14.at.11.28.27.mp4
@reflectronic reflectronic merged commit a126383 into zed-industries:main Jan 14, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

2 participants