Bug 160226 - Math visual mode: Clicking on visual elements (i.e. fraction) completely destroys your formula structure
Summary: Math visual mode: Clicking on visual elements (i.e. fraction) completely dest...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.2 target:24...
Keywords: bibisected, bisected
: 161471 161506 161532 162390 162515 162721 162947 (view as bug list)
Depends on:
Blocks: Visual-Mode-of-Formula-Editor
  Show dependency treegraph
 
Reported: 2024-03-16 06:30 UTC by george
Modified: 2024-09-13 13:16 UTC (History)
14 users (show)

See Also:
Crash report or crash signature:


Attachments
Using Libre Math's visual elements destroys formula structure (270.51 KB, image/jpeg)
2024-03-16 06:48 UTC, george
Details

Note You need to log in before you can comment on or make changes to this bug.
Description george 2024-03-16 06:30:21 UTC
Description:
While typing a formula, if you click on a visual element i.e. a fraction, the fraction is inserted in the formula in the wrong place instead of the cursor's current position.

Steps to Reproduce:
1. start typing a formula
2. click on a visual element (i.e. a fraction)


Actual Results:
3. The visual element you clicked is inserted at the beginning of the formula an not at the current cursor's position

Expected Results:
The visual element you clicked should be inserted at the current cursor's position (as it was happening prior to 24.x.x version)


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: el-GR (en_US.UTF-8); UI: en-US
Ubuntu package version: 4:24.2.1~rc2-0ubuntu0.22.04.1~lo1
Calc: threaded
Comment 1 george 2024-03-16 06:48:15 UTC
Created attachment 193137 [details]
Using Libre Math's visual elements destroys formula structure
Comment 2 V Stuart Foote 2024-03-16 12:05:56 UTC
Confirmed. The element insertion does not track the Visual mode cursor, and resulting node is misplaced. 

Version: 24.2.1.2 (X86_64) / LibreOffice Community
Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

You can revert to non-visual command input window. Done from Tools -> Options -> LibreOffice Math -> Settings panel. Uncheck the now default 'Enable Visual Editing'
Comment 3 george 2024-03-16 12:20:13 UTC
(In reply to V Stuart Foote from comment #2)
> Confirmed. The element insertion does not track the Visual mode cursor, and
> resulting node is misplaced. 
> 
> Version: 24.2.1.2 (X86_64) / LibreOffice Community
> Build ID: db4def46b0453cc22e2d0305797cf981b68ef5ac
> CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL:
> win
> Locale: en-US (en_US); UI: en-US
> Calc: CL threaded
> 
> You can revert to non-visual command input window. Done from Tools ->
> Options -> LibreOffice Math -> Settings panel. Uncheck the now default
> 'Enable Visual Editing'

thank you for this workaround.

I now realize that using this "visual mode" I can type inside the "visual" window, which works fine. But if I use the "latex" editor and then click on visual element then it is misplaced.
Comment 4 Stéphane Guillou (stragu) 2024-03-17 10:41:53 UTC
No repro in 7.6 with experimental mode turned on:

Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Reproduced in 24.2.1:

Version: 24.2.1.1 (X86_64) / LibreOffice Community
Build ID: 359ef544e625d2ffbfced462ab37bd593ca85fa7
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

So it's a regression.
Comment 5 Stéphane Guillou (stragu) 2024-03-18 02:11:53 UTC
As I understand it, this was done on purpose with:

commit ee187f6ed7873f3ebc1f845a4384a84713be1e9c
author	Khaled Hosny 	Tue Sep 05 20:24:13 2023 +0300
committer	خالد حسني 	Tue Sep 05 20:28:34 2023 +0200
starmath: Always insert using SmCursor when inline editing is enabled
Choosing which code path based on which widget has focus is not a very
good idea, and leads to unreliable UI tests as each code path inserts
the text slightly differently (one code path inserts plain text then
parses the whole equation again, while the other parses the new text
then inserts the parsed node directly).
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156578

Khaled, any chance this could be handled better? I assume more users than us 3 will perceive this as a bug. Jumping between visual and syntax editing with the help of the Elements sidebar is to be expected, in my opinion.
Comment 6 Heiko Tietze 2024-03-18 08:32:40 UTC
Seems the cursor does not follow textual input. If you enter content in the document the elements are inserted at the cursor position. => bug
Comment 7 ⁨خالد حسني⁩ 2024-03-19 20:45:51 UTC
At this point I think we should flip the default back to disable visual editing. It seems to be more trouble than it is worth it without someone invested in fixing these issues. I don’t have a working LO build setup, though, so someone else has to do it.
Comment 8 Stéphane Guillou (stragu) 2024-03-20 02:33:00 UTC
Thanks, Khaled.
Xisco, what do you think?

- 2d47c824cd31294899fa24989b3d7bd4f98dcdee: Visual mode made default + option to turn it off, in which Khaled did note: "If it turns to be a disaster, we can flip the option and disable it by default."
- ee187f6ed7873f3ebc1f845a4384a84713be1e9c: Always insert using SmCursor.

Instead of reverting everything, we can default to Visual mode off but keep it out of experimental, and this report can stay open.
Comment 9 V Stuart Foote 2024-03-20 11:40:32 UTC
(In reply to Stéphane Guillou (stragu) from comment #8)

> ...
> Instead of reverting everything, we can default to Visual mode off but keep
> it out of experimental, and this report can stay open.

+1, reasonable to keep it graduated but not as default mode (using the new checkbox on Tools -> Options -> LO Math -> Settings). 

And Visual mode still needs a lot of documentation effort as for bug 159989 which until then likely will result in more avoidable issues being reported.
Comment 10 Buovjaga 2024-06-08 10:31:12 UTC
*** Bug 161471 has been marked as a duplicate of this bug. ***
Comment 11 V Stuart Foote 2024-06-11 11:21:47 UTC
*** Bug 161506 has been marked as a duplicate of this bug. ***
Comment 12 V Stuart Foote 2024-08-08 00:09:49 UTC
*** Bug 162390 has been marked as a duplicate of this bug. ***
Comment 13 V Stuart Foote 2024-08-18 22:42:28 UTC
*** Bug 162515 has been marked as a duplicate of this bug. ***
Comment 14 Pit Hauge 2024-08-21 15:53:46 UTC
Switching this option on or off is a good idea, but it should be possible also in LO Writer where LO Math can be used.
Comment 15 V Stuart Foote 2024-08-21 16:52:16 UTC
(In reply to Pit Hauge from comment #14)
> Switching this option on or off is a good idea, but it should be possible
> also in LO Writer where LO Math can be used.

Not the best idea. In Writer when an OLE formula has been/or is being inserted--while the OLE exposes the full sm Math module Formula UI the module with focus is still Writer.

Such that Tools -> Options comes up on the Writer configuration, not the sm LibreOffice Math option panels.  So user can't get to the Settings -> 'Enable visual editing' checkbox while in a Writer module.

That and there are other sm formula editor configurations that should probably not be available while not fully working in the Math module.

It would be nice to record a org.openoffice.Office.Math/Misc stanza into user Profile, and support a cross module edit from Tools -> Options -> Advanced -> Expert Configuration.  

But urgency will fade when/if the Visual mode is reverted to no longer be default.
Comment 16 Heiko Tietze 2024-08-22 08:06:30 UTC
*** Bug 161532 has been marked as a duplicate of this bug. ***
Comment 17 Heiko Tietze 2024-08-22 08:59:47 UTC
https://gerrit.libreoffice.org/c/core/+/172241 switches the option off by default. But I wonder if this is rather a band-aid than a solution for this issue.
Comment 18 V Stuart Foote 2024-08-22 13:25:24 UTC
(In reply to V Stuart Foote from comment #15)
> ...
> It would be nice to record a org.openoffice.Office.Math/Misc stanza into
> user Profile, and support a cross module edit from Tools -> Options ->
> Advanced -> Expert Configuration.  
> ...

Oops, missed that stanza is already there 'InlineEditEnable', available to modify in User profile (registrymodifications.xcu) or search in Expert Configuration.

But at 25.2.0 will again be set disabled by default.

@Heiko, will you be backporting to 24.8.1/8.2? And maybe also 24.6.2?
Comment 19 V Stuart Foote 2024-08-22 13:40:06 UTC
(In reply to Heiko Tietze from comment #17)
>... But I wonder if this is rather a band-aid than a solution for this
> issue.

Definitely! The sm Visual editor (aka "in-line" sm editing mode) has needed work for a long time since introduced [1]. Khaled poked at it during his last active stint but still a lot to be done, likewise for sm in general dating back to its beginnings at StarOffice 5 [2]. We'd kept it suppressed as Experimental, Khaled brought it out and set it default at 24.2.0 for better exposure--maybe not the best results.

=-ref-=
[1] https://opengrok.libreoffice.org/history/core/starmath/visual-editor-todo
[2] https://www.mail-archive.com/dev@sw.openoffice.org/msg00200.html
Comment 20 Commit Notification 2024-08-26 08:39:29 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cd2eba5c698081355d51c491398119f38068bfb2

Related tdf#160226 - Math inline editing Off by default

It will be available in 25.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 21 Heiko Tietze 2024-08-26 08:40:38 UTC
Not fixed... just off by.
Comment 22 V Stuart Foote 2024-09-01 17:39:11 UTC
*** Bug 162721 has been marked as a duplicate of this bug. ***
Comment 23 Commit Notification 2024-09-03 06:50:59 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/149ca1e0a8123b8722ecb74f6f5e8e5080ce6052

Related tdf#160226 - Math inline editing Off by default

It will be available in 24.8.2.

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 24 Commit Notification 2024-09-03 09:53:52 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/ca43a2434520338224b9d3dacc45af242fe5ad55

Related tdf#160226 - Math inline editing Off by default

It will be available in 24.2.7.

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 25 Commit Notification 2024-09-06 12:14:38 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "libreoffice-24-8-1":

https://git.libreoffice.org/core/commit/c4f69dd0896223a8f9350443df658cc9cb9b5e3f

Related tdf#160226 - Math inline editing Off by default

It will be available in 24.8.1.

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 26 V Stuart Foote 2024-09-13 13:16:03 UTC
*** Bug 162947 has been marked as a duplicate of this bug. ***