Bug 130741 - Formulas getting broken after switching between visual and code editor.
Summary: Formulas getting broken after switching between visual and code editor.
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: ⁨خالد حسني⁩
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks: Formula-Editor Visual-Mode-of-Formula-Editor
  Show dependency treegraph
 
Reported: 2020-02-17 18:39 UTC by Anton Tsyganenko
Modified: 2024-06-19 21:28 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Tsyganenko 2020-02-17 18:39:45 UTC
Description:
After switching between visual and code editing, formulas are getting broken.

Steps to Reproduce:
1. set the cursor to the visual formula edit area, type "/a+b↓c+d", the code will be `{ { a + b } over { c + d } }`
2. swich to the code editor, make a change (for example, change "d" to "e")
3. switch to the visual area, set the cursor after the fraction and type a space, the code becomes `{ { a + b over c + e } ~ }`, however the formula still looks correctly.
4. switch back the code editor, make a change (for example, remove the tilde).


Actual Results:
The formula is now broken and looks like "a + (b/c) + e".

Expected Results:
The only change that occurs in code on step 3 is adding tilde, and the formula remains to look correctly after step 4, like "(a+b)/(c+e)"


Reproducible: Always


User Profile Reset: No



Additional Info:
Tested on LO 6.4.0.3 on Arch Linux, but I've been noticing this problem for at least a few months, so it may be much older.
Comment 1 Roman Kuznetsov 2020-02-20 10:02:07 UTC
What is a "visual formula edit area" in your description?

I think you just make changes by wrong way

Did you read that guide https://wiki.documentfoundation.org/images/a/aa/MathGuide-5.0-RU-Final.pdf?
Comment 2 Anton Tsyganenko 2020-02-21 14:17:22 UTC
I meant the preview window (окно предварительного просмотра).

Maybe I way trying to edit it in the wrong way, but the way of editing formulas in the instruction (page 22-23) looks strange (maybe out of date): when I click an element in the preview window (single or double click), cursor is being set to the preview window, not to the formula editor, as written in the guide.

Why this happens, if the preview window is not intended to edit formulas?
Comment 3 Buovjaga 2020-05-10 14:44:15 UTC
(In reply to Anton Tsyganenko from comment #0)
> Description:
> After switching between visual and code editing, formulas are getting broken.
> 
> Steps to Reproduce:
> 1. set the cursor to the visual formula edit area, type "/a+b↓c+d", the code

I don't know how to type ↓
I can't copy and paste it either.
Comment 4 Anton Tsyganenko 2020-05-10 14:46:10 UTC
(In reply to Buovjaga from comment #3)
> (In reply to Anton Tsyganenko from comment #0)
> > Description:
> > After switching between visual and code editing, formulas are getting broken.
> > 
> > Steps to Reproduce:
> > 1. set the cursor to the visual formula edit area, type "/a+b↓c+d", the code
> 
> I don't know how to type ↓
> I can't copy and paste it either.

I meant arrows on the keyboard.
Comment 5 Buovjaga 2020-05-10 15:47:46 UTC
Ok, repro on Linux and also version 3.3 on Windows

Arch Linux 64-bit
Version: 7.0.0.0.alpha1+
Build ID: e622420c0aa8116294e85c076ff2d8fc6131595f
CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5; 
Locale: en-US (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 10 May 2020
Comment 6 Mantas Kriaučiūnas 2020-07-23 16:07:13 UTC
Visual formula editor area can be used only if "Experimental features" are enabled in Tools->Options->Advanced
I can confirm this issue on LibreOffice 6.4.4.2, it would be nice to have it fixed and see enabled visual editor by default :)

Btw, I've found visual formula editor TODO:
https://opengrok.libreoffice.org/xref/core/starmath/visual-editor-todo
Comment 7 QA Administrators 2022-07-24 03:31:47 UTC Comment hidden (obsolete)
Comment 8 Commit Notification 2023-09-07 14:19:00 UTC
Khaled Hosny committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8c982bf86ff9ca5a4ed86505ec1133cc183f1b58

tdf#130741: Insert brackets around horizontal binary nodes more generously

It will be available in 24.2.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.
Comment 9 Roberto Salomon 2024-02-29 00:48:53 UTC
Thank you. Can confirm alignment problem is solved in 2.4.2.1.