Bug 95096 - ibus keyboarding solution - kmfl characters are not "swallowed" for cell in row with "table in table"
Summary: ibus keyboarding solution - kmfl characters are not "swallowed" for cell in r...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0 target:5.0.4 target:7.1.0
Keywords: bibisected, regression
Depends on:
Blocks: VCL-Scheduler
  Show dependency treegraph
 
Reported: 2015-10-15 19:04 UTC by Justin L
Modified: 2020-10-29 19:01 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
most places on page2 crash. Page1 content does not crash (859.50 KB, application/msword)
2015-10-15 19:04 UTC, Justin L
Details
minimal document demonstrating the bugs (9.16 KB, application/vnd.oasis.opendocument.text)
2015-10-23 05:35 UTC, Justin L
Details
backtrace from gdb - following the steps in comment 5. (7.44 KB, text/plain)
2017-10-20 06:05 UTC, Justin L
Details
writerTableDebug.txt: output of debugging lines showing different coordinates (3.66 KB, text/plain)
2020-10-28 08:04 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2015-10-15 19:04:55 UTC
Created attachment 119649 [details]
most places on page2 crash.  Page1 content does not crash

Several related problems
1.)  Writer exits with an exclamation mark OK box.  (ibus kmfl sequence like ;a turning into ä) because somehow the text context is lost.
2.)  Not all of the characters are swallowed up when 3 or more characters make up a kmfl sequence.  Each character is deleted one at a time, and when the text context is lost, further deletes are dropped.

This is a hard bug to test because it requires something like KMFL keyboards configured.
Comment 1 Justin L 2015-10-16 19:17:37 UTC
submitted patch to resolve #1:  https://gerrit.libreoffice.org/19414 tdf#95096 avoid invalid cursor position exception

I'm still trying to track down #2.  Somehow the text is getting invalidated, and so the remaining "delete character" commands are dropped because the string context has become invalidated.
Comment 2 Justin L 2015-10-17 09:09:09 UTC
problem #2 appears when there is a table in table somewhere in that row.

On page 1, all of the text is in a table-in-table.  That means that for those rows, there is not another table somewhere in the row - it is already the "inside" row.

On Page 2, the pictures were place inside a table-in-table.  So the text was in the "outside" row, and thus affected.

Removing the table-in-tables in a row allows ibus kmfl to swallow all the composing characters anywhere in that row.
Comment 3 Justin L 2015-10-17 10:29:13 UTC
for the record: #1 was bibisected to a week's worth of "catch uncaught exceptions".  #2 showed up when OOo accessibility code was imported, so neither of those two are helpful in discovering a complete fix.

This is such an unlikely combination that it likely isn't worth putting more effort into it.
Comment 4 Commit Notification 2015-10-17 11:56:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d9cf47449e88032803aa4fa3429cd607a074d5ad

tdf#95096 avoid invalid cursor position exception

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Justin L 2015-10-23 05:35:38 UTC
Created attachment 119897 [details]
minimal document demonstrating the bugs

Steps to reproduce part #2:

First, you must have something like ibus/kmfl setup with GE keyboard.
(see  bug 91641) as well as using LO patched for problem #1.

-open the test .odt and turn on the GE keyboard
-in the "working cells", type ;;~a.  Notice that this sequence all converts to ä̃
-in the "broken cell", type ;;~a.  Notice that only ~ is deleted, and ;; remains behind.
Comment 6 Justin L 2015-10-23 05:49:58 UTC
I'm running pretty stuck on resolving part#2. I have some SAL_WARN debugging set up on gerrit (https://gerrit.libreoffice.org/19415)

Visibly, the problem is that a kmfl character composing sequence (like ;;~a for ä̃) doesn't delete all of the composing sequence in a table cell when the row contains a table-in-table.  Code-wise, the problem is something like the accessible PortionData loses the focus after the first character is deleted, and thus the two remaining signalIMDeleteSurrounding calls do nothing because they can't find the focus/cursor context.  The problem apparently comes from external layout calls - it doesn't seem to be a logic failure in the direct code path.

Potential fix concepts are a.) locking outside changes until ibus's 3xdelete + add character is done, b.) preventing loss of focus / requiring FocusWin to actually have a focused portion, or c.) falling back to cursor position if no portion has the focus.
Comment 7 Commit Notification 2015-10-27 11:29:52 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9f008e2ae5e9d090ca011e5a6146e221e6799531&h=libreoffice-5-0

tdf#95096 avoid invalid cursor position exception

It will be available in 5.0.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Justin L 2015-12-09 13:54:30 UTC Comment hidden (no-value)
Comment 9 Robinson Tryon (qubit) 2015-12-14 04:50:44 UTC Comment hidden (obsolete)
Comment 10 Justin L 2016-02-10 10:21:43 UTC Comment hidden (no-value)
Comment 11 Björn Michaelsen 2016-04-19 14:27:06 UTC
(In reply to Justin L from comment #8)
> same "not swallowing composing characters" problem in Writer's comments.  Bibisected back to LO 3.5.
(In reply to Justin L from comment #10)
> part2 (table-in-table kmfl) was working today in 5.2dev.

Is there anything left in this bug? Aka not a dupe of bug 91641 as per comment #8, not "part2" as per comment #10 and not fixed by commit d9cf47449e88032803aa4fa3429cd607a074d5ad?

Please describe what is still open as I have lost track. => NEEDINFO
Also please update version as appropriate (comment #8 suggests this is maybe 3.5?)
Comment 12 Justin L 2016-05-10 14:06:10 UTC
This bug is still a problem - best described by Comment 5.

ignore Comment8: common problem for many different reasons. This bug not connected to others AFAIK.
ignore Comment 10: Poor testing on my part - only fixed for "two character" sequences.

I bibisected the "two character" sequence "fix" (from Comment 10) way back to 2015-03-06 and a series of commits by Tobias Madl related to Idle/Timer handling.  That makes sense.  I just noticed that if I SLOWED DOWN my typing, then a two-character sequence ALWAYS was properly swallowed, but if I typed them very fast it wasn't working until Tobias' changes.

The four character sequence is still not swallowed completely, although Tobias' changes did help with that too.  Before his changes I could never get it to swallow more the two characters.  I can now get three characters swallowed, but never four.

Set version to 4.3: Bibisected problem #2 to commit 76c549eb01dcb7b5bf28a271ce00e386f3d388ba - "Integrate branch of IAccessible2" Nov 29 2013.
Comment 13 Justin L 2017-10-20 06:05:34 UTC
Created attachment 137130 [details]
backtrace from gdb - following the steps in comment 5.

visually, the ";;" remained on screen and the ~a had already been "swallowed" by the time the assert halted everything.

Tested with Ubuntu 16.04 and LO 6.0alpha1.
Comment 14 QA Administrators 2018-10-21 02:50:56 UTC Comment hidden (obsolete, spam)
Comment 15 Justin L 2020-06-17 15:54:33 UTC
Since LO 6.3, even the "Working Cells" from comment 5 are not working, due to commit d5b50e74ee822e1c8402e3044e14799e47907ff8
Author: Miklos Vajna on Mon Sep 16 21:15:28 2019 +0200

    tdf#105330 sw: fix lost cursor on undoing nested table insert
    
    This is a regression from commit
    e4509eea8fc7c07ddff48edf0d4c015c2663d896 (n#751313 SwCallLink: avoid
    redrawing complete rows without nested tables, 2012-04-20), though
    manual testing shows that the underlying problem has been addressed in
    the meantime, so this can be reverted.
    
    Over time, some poor tests started to depend on the new behavior so
    adapt them as necessary:
    
    1) Change back test added in commit
    075fc0c0a34875adf2833e5933b4982b9443a373 (testcase for fdo#38414,
    2014-03-18) to its original form, that was changed to an export test in
    commit 086550313260d9fa45b91dc705b21bb9b51ce0b8 (move round-tripables to
    ooxmlexport, 2016-10-07), as the export of that document still results
    in data loss of cell content, just happened to pass so far.
    
    2) Explicitly calculate content of text frames in two more tests, which
    just hoped that by the time they assert, the layout is ready already
    (but now that the missing notification is restored, it happens that the
    first pass of the layout doesn't create them; only a later pass, invoked
    by Idle, which doesn't run during cppunit tests).
Comment 16 Justin L 2020-10-27 19:12:48 UTC
This bug is mostly being resolved with the fixes for bug 137620.

However, if I enter a second composed character, it starts deleting items from the front of the paragraph.  I'll do a bit more debugging testing tomorrow I hope to try to clarify exactly what is happening. It seems to only be happening with certain three-sequence characters (like .;o to form  ọ̈  )
Comment 17 Justin L 2020-10-28 08:04:35 UTC
Created attachment 166789 [details]
writerTableDebug.txt: output of debugging lines showing different coordinates

(In reply to Justin L from comment #16)
The use of the fullstop is the key here. The fullstop restarts the coordinate numbering position - but the delete context doesn't restart.
Comment 18 Caolán McNamara 2020-10-28 10:54:37 UTC
we probably need a "proper" DeleteSurroundingText implementation for SwEditWin
Comment 19 Commit Notification 2020-10-28 17:20:30 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1b40a48bdfd1e73dc41394bd914e9ec417458a2d

tdf#95096 add a DeleteSurroundingText to SwEditWin

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.