Summary: | Input method / IME / ibus support doesn't seem to work well in KF5 version | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Eike Hein <hein> |
Component: | general | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | lbeltrame, simonandric5 |
Priority: | NOR | ||
Version: | Git | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
URL: | https://bugreports.qt-project.org/browse/QTBUG-41640 | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Eike Hein
2014-09-27 19:23:17 UTC
Addendum: A KF5-based testcase that works fine is e.g. Konversation, which uses KTextEdit (not KTextEditor) for its input line. It also works well with Konsole, which uses a custom text widget. It also works fine in KLineEdit's like Kate's own Find field. That's why I concluded the bug must be specific to the input handling in Kate's text widget. Another tip: If you can't get the ibus tray icon to work, the default shortcut to cycle through the input language list is Super+Space (i.e. Left Winkey+Space, usually). You still need to add Korean in ibus-setup first. Another note: I can also rule out font-related problems such as missing fonts or failing glyph substitution. My fontconfig is set up for my preferred monospace font to fall through[1] to Nanum Gothic Coding, which has all the required glyphs. But also when I select it directly, or other fonts like Noto Sans CJK KR, the behavior remains the same. The Konversation testcase is fine with all of those fonts. By implication, if you find yourself lacking Hangul-supporting fonts to test this: Your distro likely has the Nanum or Noto fonts packaged, both are suitable :). 1 = I recently wrote a related blog post, https://blogs.kde.org/2014/09/11/beyond-unicode-closing-gap-support-mixed-character-set-text-kde-workspaces Luca, can you try if this works any better with fcitx? I just installed KWrite 4.14.1 to test, and it works fine there. The QInputMethodEvent handling in KateViewInternal may have regressed somehow. Debug log from KateViewInternal::inputMethodEvent for the four keypresses: kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 0) commit "" preedit "ㅎ" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 1) commit "" preedit "하" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 1) commit "" preedit "한" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 2) commit "" preedit "" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 0) commit "한" preedit "" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 1) commit "" preedit "" replacement start 0 length 0 kate(3640)/default KateViewInternal::inputMethodEvent: Event: cursor (0, 1) commit "" preedit "" replacement start 0 length 0 I've been debugging this - first I followed all the insert stuff down to TextBuffer, but where it actually goes wrong is in the block starting at line 3686 in kateviewinternal.cpp that tries to style the pre-edit text. The QInputMethodEvent handed over contains three attributes, two text attributes and a cursor attribute. The second text attribute's QTextFormat has Qt::NoBrush as pen() - and so the text is rendered invisible. I looked at the source code of the ibus input method plugin in Qt to find out why this happens. The reason is that in ibus' D-Bus format there are distinct attribute types for foreground and background, which are converted into two distinct QTextFormats in the attribute list, which end up cancelling each other out. There's two ways to address this: a) Kate could try to merge the two QTextFormats. The problem there is that it technically can't know which attribute is the foreground and which the background, so there's no good way to decide on the right operand order for a formatFoo.merge(formatBar) call. b) Qt's Ibus input method plugin could smarten up and flatten all of the text attributes handed over by Ibus into a single QTextFormat attribute for the input event. Qt's docs for QInputMethodEvent state the following in the event of multiple text char formats for the same range: "If several are specified for any character in the string the behaviour is undefined." I suggest we simply ignore the second in that case. In this concrete situation it ends up being the background attribute, which we presumably don't care about anyway. I don't seem to have any issues with fcitx as IM here. I can input and predict (via "space") just fine, everything is displayed correctly. Opened a ticket at ibus: https://code.google.com/p/ibus/issues/detail?id=1745 And at Qt, since it appears ibus actually prefers it be tracked there now: https://bugreports.qt-project.org/browse/QTBUG-41640 I also had a look at the equivalent code in the Qt 4 plugin, and it merges all the ibus text attributes into a single QTextCharFormat just like we'd want ... Proposed Qt patch: https://codereview.qt-project.org/#/c/95964/ This was accepted upstream and included in Qt 5.4.0. |