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

PreeditHandler: update preedit string when it's empty #1174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liangqi
Copy link

@liangqi liangqi commented Feb 5, 2025

See also https://bugreports.qt.io/browse/QTBUG-127995 , Deleted character appears again when switching languages (Mozc / IBus)

Description

Deleted character appears again when switching languages (Mozc / IBus).

Issue IDs

N/A

Steps to test new behaviors (if any)

  • OS: [Ubuntu 24.04 x11]
  • Steps:
    1. Japanese - Mozc, Heragana, a -> あ, for example, 3 times, then backspace 3 times
    2. Super+Space to switch to English, for example, the last あ was committed.

Copy link

google-cla bot commented Feb 5, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@liangqi
Copy link
Author

liangqi commented Feb 5, 2025

CLA fixed with c61b828.

@hiroyuki-komatsu
Copy link
Collaborator

Thank you for your PR with references. They are very helpful for us.

IbusTextWrapper text = ComposePreeditText(output.preedit());
engine->UpdatePreeditTextWithMode(&text, CursorPos(output));
// |text| is released by ibus_engine_update_preedit_text.
if (!output.has_preedit()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have an explicit path when output does not have preedit.
How about this one?

bool PreeditHandler::Update(IbusEngineWrapper *engine,
                            const commands::Output &output) {
  if (!output.has_preedit()) {
    IbusTextWrapper empty_text("");
    engine->UpdatePreeditTextWithMode(&empty_text, 0);
    engine->HidePreeditText();
    return true;
  }
  IbusTextWrapper text = ComposePreeditText(output.preedit());
  engine->UpdatePreeditTextWithMode(&text, CursorPos(output));
  // |text| is released by ibus_engine_update_preedit_text.
  return true;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, done in 6c1ddfa .

See also https://bugreports.qt.io/browse/QTBUG-127995 , Deleted
character appears again when switching languages (Mozc / IBus)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants