Description of problem:
When editing formulas with placeholders (<?>) in LibreOffice (Writer, Impress), the formula is not updated after replacing the placeholder with a value, not even after leaving the formula editor. It requires activating and just leaving the formula editor again (double-clicking on the formula object and pressing ESC without editing) to trigger repaint.
The problem appears after updating gtk3 to version 3.24.25-2.fc33 and disappears when gtk3 is downgraded to version 3.24.23-1.fc33.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Launch LibreOffice Writer to create a new empty document
3. enter <?> in the text-based formula editor
4. press ESC to leave the formula editor (should render a formula with a single box)
5. double-click on the formula object to activate formula editor
6. click on the box in the formula (pre-selects the <?> characters)
7. enter 1 replacing the (pre-selected) <?> characters (formula is not retained)
8. press ESC to leave the formula editor (formula is not repainted)
9. double-click on the formula object to activate formula editor again
10. press ESC to leave the formula editor (the formula is repainted now)
The formula is not repainted either after replacing <?> with 1, or (at the latest) after leaving the formula editor.
The formula is repainted after replacing <?> with 1.
The expected results were the actual results prior to upgrading gtk3 to version 3.24.25-2.fc33. The current situation complicates use of LibreOffice during distance teaching math, which relied on presentations with pre-defined formulas containing placeholders.
Anything special in the way libreoffice interact with input methods?
looks to me starmath has a reparse+repaint timer which is started on keypress events, but doesn't trigger for input engine ones
For context, I've done some changes in GtkIMContextSimple. My initial suspicion here was that I maybe inadvertently changed the event stream you see by filtering out different press or release events, but so far, I haven't seen anything obvious.
Do you see anything that has changed in those events to cause this to break from gtk 3.24.23 to 3.24.24 ?
Looks like we deliver single key strokes received through IM as keyevents for some legacy reason, but we don't do this if we got a preedit-end signal. In gtk 3.24.23 we don't get one of those so we deliver the IM single letter as a keyevent (and math starts its timer) in 3.24.5 we get a preedit-end and deliver as a IM command instead and math doesn't start its timer in that case. Its hard to argue that math shouldn't reparse its input if it was modified via IM so https://gerrit.libreoffice.org/c/core/+/111488 to do that and that would make this work.
The change that seems to make a different I guess is 85d34932f3888caecd4b50dcfce530c8b82a7a5b in gtk where gtk_im_context_simple_commit_char in the past emitted preedit-end only conditionally and now calls gtk_im_context_simple_commit_string which always emits preedit-end
aha. thanks for the detective work! et me see if I can make sure that we only emit preedit-end if there actually was preedit
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/323 should fix this.