scroll 下,linuxqq-nt-bwrap 中,fcitx5 输入中途按 esc 取消,无法清除 preedit

如题。

版本:

sway-scroll 1.12.11-1
linuxqq-nt-bwrap 3.2.28_260429-1

设置了 ~/.config/qq-electron-flags.conf

--enable-features=UseOzonePlatform
--ozone-platform=wayland
--enable-wayland-ime

在 chromium 以及 vscode 当然没有这个问题。

KDE 没有这个问题。但 KDE 好像有专门的 fcitx5 前端,不太可比。

fcitx5-diagnose.txt (9.9 KB)

跟这个 Electron应用中fcitx5退出输入时进入异常状态 有关吗

应该是同一个问题,那感觉没辙啊。

但 KDE 为什么没问题?有没有什么 workaround 啊?

除了patch应用或合成器感觉没啥其他方法。kde不知道,或许你抓一下wayland debug日志看看它怎么弄的。不会是发了个空的zwp_text_input_v3::preedit_string吧..

要么就给preedit关了((反正我是从不开这个的

我的建议是移除 flags 让 linuxqq 用 xwayland,去和隔壁完全不支持 wayland 的难兄难弟 wechat 坐一桌(

刚刚 vibe 问了下 Deepseek。

fcitx5 代码中

    // Validate not empty and within wayland limit.
    if (preedit.textLength() > 0 &&
        preedit.textLength() < WaylandIMServerBase::safeStringLimit) {
        if (cursorStart < 0) {
            cursorStart = cursorEnd = preedit.textLength();
        }
        ic_->setPreeditString(preedit.toString().data(), cursorStart,
                              cursorEnd);
    }
    ic_->commit(serial_);

其中有判断 preedit.textLength() > 0ic_->setPreeditString 不会执行,导致清空的 preedit 没有同步上去。

Deepseek 这样说的,去除 > 0 特判后,试了一下感觉可行。

倒也是个方法。原来“清空preedit只发done”的逻辑也是输入法层面来做的。之前Minecraft也有这个问题,我竟没想到去直接patch ime。不过本质上其实还是应用的问题罢了。