Description: SurroundingText capability is used by some input method like fcitx, ibus... It's broken in kf5 vcl but still works in the gtk mode. Steps to Reproduce: 1. Install fcitx5-unikey and run it 2. With fcitx5-unikey, in Libre Writer, type: g[space][backspace]ias Actual Results: gía Expected Results: giá Reproducible: Always User Profile Reset: No Additional Info: .
(In reply to trmdi from comment #0) > Steps to Reproduce: > 1. Install fcitx5-unikey and run it Can you please explain in more detail what "run it" means, i.e. how to (set it up if necessary and) run it? I have installed package "fcitx5-unikey" in Debian testing, but I don't see any obvious executable to just run in the 'dpkg -L fcitx5-unikey' output, so maybe this needs to be set up and run in a certain way with the fcitx framework that I know little about? A step-by-step description to do so would be very helpful here.
1) Install fcitx5-unikey 2) Open Fcitx5 and find and add Unikey to current input 3) Run im-config, choose fcitx5, and set fcitx5 to auto start 4) Log out and log in, Ctrl + Space switch im to Unikey and type in LibreOffice Fcitx5 similar ibus
Thanks, I can reproduce the described difference between the gtk3 VCL plugin on the one side and kf5 or qt6 on the other side. However, this doesn't look LibreOffice-specific to me, since I can reproduce the same with other Gtk/Qt-based applications: * When I type "g[space][backspace]ias" in gedit (based on gtk), this results in "giá". * When I type "g[space][backspace]ias" in kate or Konsole (Qt-based), I get "gía". Therefore, I tend to think that this is probably rather an issue in either Qt or the fcitx Qt integration (package "libfcitx5-qt1"?) instead of LibreOffice and would suggest to report that there instead. Closing as NOTOURBUG for now due to these observations, but this can of course be reopened if other findings suggest that something actually needs to be done on LO side. Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: gtk3 Locale: en-GB (en_GB.UTF-8); UI: en-US Calc: threaded Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb) Locale: en-GB (en_GB.UTF-8); UI: en-US Calc: threaded Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: qt6 (qfont+xcb) Locale: en-GB (en_GB.UTF-8); UI: en-US Calc: threaded
(In reply to Michael Weghorn from comment #3) > Therefore, I tend to think that this is probably rather an issue in either > Qt or the fcitx Qt integration (package "libfcitx5-qt1"?) instead of > LibreOffice and would suggest to report that there instead. i.e., probably here: https://github.com/fcitx/fcitx5-qt/issues (or https://bugreports.qt.io for the Qt case)
(In reply to Michael Weghorn from comment #3) > Thanks, I can reproduce the described difference between the gtk3 VCL plugin > on the one side and kf5 or qt6 on the other side. > > However, this doesn't look LibreOffice-specific to me, since I can reproduce > the same with other Gtk/Qt-based applications: > > * When I type "g[space][backspace]ias" in gedit (based on gtk), this results > in "giá". > > * When I type "g[space][backspace]ias" in kate or Konsole (Qt-based), I get > "gía". > > Therefore, I tend to think that this is probably rather an issue in either > Qt or the fcitx Qt integration (package "libfcitx5-qt1"?) instead of > LibreOffice and would suggest to report that there instead. > > Closing as NOTOURBUG for now due to these observations, but this can of > course be reopened if other findings suggest that something actually needs > to be done on LO side. > > > Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community > Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 > CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: gtk3 > Locale: en-GB (en_GB.UTF-8); UI: en-US > Calc: threaded > > Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community > Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 > CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb) > Locale: en-GB (en_GB.UTF-8); UI: en-US > Calc: threaded > > Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community > Build ID: d640bfe7767292c8a89de57d378dd752a8ec8342 > CPU threads: 12; OS: Linux 6.0; UI render: default; VCL: qt6 (qfont+xcb) > Locale: en-GB (en_GB.UTF-8); UI: en-US > Calc: threaded Konsole doesn't support that, but Kate does. The SurroundingText capability need support from the app. So I opened this request here to get the support from LibreOffice's kf5 vcl.
> When I type "g[space][backspace]ias" in kate or Konsole (Qt-based), I get "gía". Probably something's wrong with your setup. It does support that here on my openSUSE Tumbleweed, Kate 22.12.0
Created attachment 184243 [details] working in Kate
The issue for libreoffice is that, although it implements the surrounding support. Like: https://github.com/LibreOffice/core/blob/d57836db76fcf3133e6eb54d264c774911015e08/vcl/qt5/QtWidget.cxx#L893 It doesn't seem to notify input method about surrounding changes, which is usually done with QWidget::updateMicroFocus(), or call QGuiApplication::inputMethod()->update(FLAGS). ``` void QWidget::updateMicroFocus() { // updating everything since this is currently called for any kind of state change if (this == QGuiApplication::focusObject()) QGuiApplication::inputMethod()->update(Qt::ImQueryAll); } ``` I can only find libreoffice's qt implementation notifies about cursor rectangle change at https://github.com/LibreOffice/core/blob/d57836db76fcf3133e6eb54d264c774911015e08/vcl/qt5/QtWidget.cxx#L628
While it is possible to implement a polling like logic. Retrieving surrounding text is an expensive query, so I'd prefer libreoffice to notify the change instead of letting input method poll it. Also, the implementation itself seems not working properly. Even if I tried to hack fcitx5-qt to poll the surrounding text by explicitly query the object, it return value for inputMethodQuery(Qt::ImSurroundingText) is still QVariant(Invalid). So despite of adding qApp->inputMethod()->update(Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition) to a proper place maybe also check if this lcl_retrieveSurrounding actually works. https://github.com/LibreOffice/core/blob/d57836db76fcf3133e6eb54d264c774911015e08/vcl/qt5/QtWidget.cxx#L897 Gtk counterpart seems to use a different approach for retrieving surrounding https://github.com/LibreOffice/core/blob/83485052e6cac574754191c59371dbc41383b810/vcl/unx/gtk3/gtkframe.cxx#L5824
(In reply to trmdi from comment #6) > Probably something's wrong with your setup. It does support that here on my > openSUSE Tumbleweed, Kate 22.12.0 Indeed, was apparently some problem with my setup, since I was using the same Kate version. It works now. Interestingly, I explicitly have to unset GTK_IM_MODULE (or set it to an empty string) because GTK_IM_MODULE=fcitx breaks the LO Writer use case with gtk3 (still works with Calc or gedit, though...). (In reply to Xuetian Weng from comment #9) > While it is possible to implement a polling like logic. Retrieving > surrounding text is an expensive query, so I'd prefer libreoffice to notify > the change instead of letting input method poll it. > > Also, the implementation itself seems not working properly. Even if I tried > to hack fcitx5-qt to poll the surrounding text by explicitly query the > object, it return value for inputMethodQuery(Qt::ImSurroundingText) is still > QVariant(Invalid). > > So despite of adding qApp->inputMethod()->update(Qt::ImSurroundingText | > Qt::ImCursorPosition | Qt::ImAnchorPosition) to a proper place maybe also > check if this lcl_retrieveSurrounding actually works. > https://github.com/LibreOffice/core/blob/ > d57836db76fcf3133e6eb54d264c774911015e08/vcl/qt5/QtWidget.cxx#L897 > > Gtk counterpart seems to use a different approach for retrieving surrounding > https://github.com/LibreOffice/core/blob/ > 83485052e6cac574754191c59371dbc41383b810/vcl/unx/gtk3/gtkframe.cxx#L5824 Thank you so much, this is extremely helpful! I have experimented a bit locally and have had a first quick-and-dirty version that somewhat works (but breaks other things), but needs more work for a proper solution.