Bug 157533 - Unpredictable cursor and keyboard behaviour after deselecting a math formula
Summary: Unpredictable cursor and keyboard behaviour after deselecting a math formula
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0 target:24.2.5
Keywords:
Depends on:
Blocks: Writer-Tables Cell-Management Authors
  Show dependency treegraph
 
Reported: 2023-09-30 16:55 UTC by internet657-84eddea134
Modified: 2024-10-31 09:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Provides an example of the bug described here (40.63 KB, application/vnd.oasis.opendocument.text)
2023-09-30 21:04 UTC, internet657-84eddea134
Details

Note You need to log in before you can comment on or make changes to this bug.
Description internet657-84eddea134 2023-09-30 16:55:08 UTC
Description:
When deselecting a math formula that is the first element of a line in a table cell, the keyboard is unresponsive and the cursor cannot be moved using the arrow keys, unless I use the mouse to reposition it.

Steps to Reproduce:
1. Create a new table with the Default Style.
2. Insert a math formula at the start of any line, whether on the first line of the cell, after an explicit line break or a line break caused by word wrapping.
3. Press "Escape" once to exit the math formula editor. The math formula is now selected.
4. Press "Escape" once more.

Actual Results:
The cursor is now positioned at the start of a line, before the formula, and cannot be moved using the keybord (using the arrow keys).
Pressing "Enter" puts you back into the formula editor.
Pressing "Delete" puts you at the start of the document.
Other keyboard keys seem to have no effect.

Expected Results:
The cursor should be positioned after the formula, and be responsive to keyboard inputs.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
More generally, the cursor shows very erratic behaviour.

Normally, after deselecting a math formula by pressing "Escape", the cursor should be placed *after* the math formula, and the cursor should be responsive to keyboard inputs.

Outside tables, the expected behaviour sometimes happens. Other times however, unrelated to whether the formula is the first element of a line and depending on the formula’s content or position, the cursor is placed before the formula after deselecting the formula, but the cursor is still responsive to keyboard inputs, and the "Enter" and "Delete" keys behave normally (as opposed to the behaviour described here in "Actual Results").

Inside any table, after deselecting a formula that is *not* positioned at the start of a line, the cursor will be placed before the formula, whereas it should be placed after. The cursor remains responsive to keyboard inputs however, and the "Enter" and "Delete" keys behave normally (as opposed to the behaviour described here in "Actual Results").

Inside tables with style "None", after deselecting a math formula that is at the start of a line, the cursor is repositioned at the end of the previous table cell. The keyboard behaves normally.

Inside tables with style "Default", after deselecting a math formula that is at the start of a line, the problem described here happens.

Version: 7.6.1.2 (X86_64) / LibreOffice Community
Build ID: f5defcebd022c5bc36bbb79be232cb6926d8f674
CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL threaded
Comment 1 m_a_riosv 2023-09-30 20:49:02 UTC
Please attach a sample file.
Comment 2 internet657-84eddea134 2023-09-30 21:04:09 UTC
Created attachment 189916 [details]
Provides an example of the bug described here

Done.
Comment 3 m_a_riosv 2023-09-30 21:35:49 UTC
Reproducible with:
Version: 7.6.1.2 (X86_64) / LibreOffice Community
Build ID: f5defcebd022c5bc36bbb79be232cb6926d8f674
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
and
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5e9c8d21874eea8cb5adf2ecab1905295af2308f
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded Jumbo
Comment 4 Commit Notification 2024-06-05 08:05:56 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3e0650fb166cac116a43f6ce5d03bd69830e37b8

tdf#157533 sw: fix cursor position deselecting formula in table

It will be available in 24.8.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 5 László Németh 2024-06-05 08:09:40 UTC
Fixed all the test cases of the report.

@internet657-84eddea134@yahoo.com and m_a_riosv: thanks for the report and handling the issue!
Comment 6 László Németh 2024-06-05 08:10:38 UTC
Note: it seems, deselecting neighbouring objects has still the same problem. I suggest to file it in a new bug.
Comment 7 László Németh 2024-06-05 08:12:00 UTC
Commit description:

tdf#157533 sw: fix cursor position deselecting formula in table

Fix lost cursor by deselecting formula object anchored as
character as single content of table cells. In this case, the
cursor was positioned inside the frame of the formula,
disappeared in a flash.

Fix also bad cursor position by deselecting formula object
anchored as character at beginning of text lines in table
content.

Follow-up to commit 014e5f559a9acf319af24c721dbe6b0bc3bc5882
"tdf#161360 sw: fix cursor position deselecting image in table".
Comment 8 Commit Notification 2024-06-05 09:15:11 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#157533 sw: fix cursor position deselecting formula in table

It will be available in 24.2.5.

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.