Bug 104211 - Fails to save previous state for undo when I `Import MathML from clipboard`
Summary: Fails to save previous state for undo when I `Import MathML from clipboard`
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: MathML
  Show dependency treegraph
 
Reported: 2016-11-28 02:36 UTC by Mark Stenglein
Modified: 2022-07-15 03:44 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
content is <mytext>Unsinn</mytext> (23 bytes, application/mathml+xml)
2017-01-03 22:00 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Stenglein 2016-11-28 02:36:49 UTC
Description:
In Writer, while editing a formula, if you use the `Import MathML from clipboard` function, it clears the entire contents of the formula and does not allow you to undo any wrong usage of this function.

In my particular case, I was trying to get a specific element that I didn't know the exact syntax for in LibreOffice's syntax, so I copied the specific language in MathML, and it wiped the entire contents of the formula. It's a bit annoying to have to retype it all.

I am running the latest version, and have not tested to see if it also does this in other builds.

Steps to Reproduce:
1.Insert>Object>Formula
2.Type in something to show in the formula on screen.
3.Copy some xml-ish text into your clipboard `<test>Test</test>` should do nicely.
4.Tools>Import MathML from Clipboard

Actual Results:  
As described, it clears the entire formula and does not let you use the `undo` feature to get anything back.

Expected Results:
I would expect to be able to undo this operation and get my formula back.


Reproducible: Always

User Profile Reset: No

Additional Info:
Technically this causes you to lose data (the last few minutes of typing into the formula) but I wouldn't really consider this anywhere near Critical. So normal it is, it should be fixed.


User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0
Comment 1 Mark Stenglein 2016-11-28 03:08:48 UTC
After thinking about it for a few minutes, I feel like it might be simple enough to fix by just running whatever code is run when you click out of the formula that saves the formula into the Writer document.

I'm not familiar with the LibreOffice code base so I can't get too specific, but I feel like if this were run before the `Import MathML from clipboard` it would give the History log a checkpoint to return to in case that function has unexpected behavior for the user.

I'm a college student so I don't have a _huge_ amount of time to play with to dive into the code base, but I might be able to look specifically at it soon...ish.
Comment 2 V Stuart Foote 2016-11-28 15:45:39 UTC
Hmm, not sure about this...

Yes, the control-Z step backward does not apply consistently to actions with an OLE object. But, the Math module Undo/Redo controls retain change details on reopening the OLE.

As is I can not reproduce with LO 5.2.3.3 or 5.3.0beta1 using STR here.

And I was able to import actual MathML fro clipboard, or import a MathML 2.0 formula, and then edit and revert (multiple Undo/Redo) within the Writer document with the OLE Math module opened.

And of course considerable utility with complex formulas to work outside of Writer, composing the formula(s) first in Math module and then inserting the objects from file (.odf or .mml) into the manuscript.
Comment 3 Regina Henschel 2016-11-28 16:55:06 UTC
The error is not, that there is no undo. But the error is, that the command window is erased. If the clipboard is not convertible, then nothing should happen, especially the command window should not be changed at all. That works, if the clipboard is simple text, which do not look like XML, for example. So I think, it is indeed a bug.

I have no immediate solution and currently not enough time beside my daily job, therefore I will not assign the bug to me.

@Mark Stenglein: For you current task, you should consider to open a separate formula document and first test, if the import works, before you actually insert it in your formula.

Import works, if you have got a valid MathML fragment, including the namespace attribute with value "http://www.w3.org/1998/Math/MathML". Then it is inserted at cursor position and you get an undo.
Comment 4 Regina Henschel 2017-01-03 22:00:06 UTC
Created attachment 130127 [details]
content is <mytext>Unsinn</mytext>

The error is not part of the new feature "Import MathML from Clipboard" but exists in other scenarios too.

Download the attachment Unsinn.mml
Have a formula in the Command Window.
Goto Tools > Import Formula.
Select the file "Unsinn.mml" and set the filter explicitly to "Math ML 2.0 (*.mml)".
Open.

Notice, that the current formula is erased in this scenario too and here too no undo action was created.
Comment 5 QA Administrators 2018-01-04 03:35:21 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2020-07-14 04:03:04 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2022-07-15 03:44:08 UTC
Dear Mark Stenglein,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug