Bug 66575 - Incorrect removal of last line in SmXMLExport::ExportTable
Summary: Incorrect removal of last line in SmXMLExport::ExportTable
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
4.2.0.0.alpha0+ Master
Hardware: All All
: medium normal
Assignee: Frédéric Wang
URL:
Whiteboard: target:4.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-04 07:54 UTC by Frédéric Wang
Modified: 2013-07-04 20:03 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
patch (1.49 KB, patch)
2013-07-04 15:18 UTC, Frédéric Wang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Wang 2013-07-04 07:54:02 UTC
SmXMLExport::ExportTable contains some code to remove the last line:

    //If the list ends in newline then the last entry has
    //no subnodes, the newline is superfulous so we just drop
    //the last node, inclusion would create a bad MathML
    //table
    if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
        --nSize;

This seems to be to avoid adding a row when doing e.g

"a newline
 b newline"

but that does not seem to work in 4.0 and master... Worse, it breaks things like

"binom a b"

In 4.0, you can do "binom {a} {b}" to avoid that, but after bug 66081 the two markup are equivalent.

Similarly, MathML export of

"stack{x ## y}"

is now broken in master (before bug 66081, the { } added to each cell was hiding that bug).
Comment 1 Frédéric Wang 2013-07-04 09:07:15 UTC
I've submitted a patch for review:

https://gerrit.libreoffice.org/#/c/4712/

> This seems to be to avoid adding a row when doing e.g
> 
> "a newline
>  b newline"
> 
> but that does not seem to work

It turned out that a dummy row was added for the sake of the visual editor and so this empty row was exported in the MathML output. The patch should fix that and avoids removing the line with binom/stack.

Tetscase for the visual editor (enable the "experimental features"): when doing

a newline
b newline

you should be able to move the cursor to a third line.
Comment 2 Frédéric Wang 2013-07-04 09:42:48 UTC
(In reply to comment #1)
> I've submitted a patch for review:
> 
> https://gerrit.libreoffice.org/#/c/4712/

The patch seems to break other things with single line formulas... please do not approve.

(I don't know how to comment or edit something on gerrit)
Comment 3 Commit Notification 2013-07-04 15:10:51 UTC
Frederic Wang committed a patch related to this issue.
It has been pushed to "master":

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

 fdo#66575 - MathML export: fix errors with newline, binom and stack.



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 4 Frédéric Wang 2013-07-04 15:18:41 UTC
Created attachment 82031 [details]
patch

Correct version that should have been pushed (sorry!)
Comment 5 Commit Notification 2013-07-04 19:33:42 UTC
Frederic Wang committed a patch related to this issue.
It has been pushed to "master":

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

fdo#66575 - MathML export: fix errors with newline, binom and stack.



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.