Bug 156492

Summary: Alt+Enter in last (rightmost merged) cell in a table doesn't add paragraph below the table
Product: LibreOffice Reporter: tomasz.sztejka <Tomasz.Sztejka>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: buzea.bogdan, nemeth, stephane.guillou
Priority: medium    
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=156515
Whiteboard: target:24.2.0 target:7.6.1
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103100, 156767    
Attachments: writer document with three tables, of which middle one shows the problem.

Description tomasz.sztejka@polon-alfa.pl 2023-07-27 13:56:07 UTC
Created attachment 188592 [details]
writer document with three tables, of which middle one shows the problem.

The Alt+Enter combination pressed when cursor is at the end of a text in a right-bottom cell of a table is expected to add a paragraph below table.

This functionality is essential when there are two tables one after another, there is a heading below a table and etc. In all those cases adding a paragraph is critical.

There is however one case I know about in which it doesn't work.

Steps to reproduce:

Correct behavior:
1. Create a table 2x2.
2. Click in right-bottom cell.
3. Press Alt+Enter.
4. Observe that an empty paragraph is added.

Correct behavior:
1. Create a table 2x2.
2. Merge all cells in left most column into one cell.
3. Click in right-bottom cell.
4. Press Alt+Enter.
5. Observe that an empty paragraph is added.

Incorrect behavior:
1. Create a table 2x2.
2. Merge all cells in **right most** column into one cell.
3. Click in right-bottom cell (which is in fact the only cell in this column now after merging)
4. Press Alt+Enter.
5. Observe that an empty paragraph is NOT added.

User level work-around:
1.Click on the right-bottom cell.
2.Right-click and insert a row below.
3.Now You can use Alt-Enter there.
4.Delete inserted row.

Code problems suggestion:
When I click around at cells I can see in the status bar the cell coordinate like: "Table... B1" and "Table...B2".

In all cases when it works, I see "B2" what in this case represents right-bottom coordinate of 2x2 table.

In case however of merged cell the coordinate reports **left-top** corner of that merged cell, that is "Table B1". 

The code which recognizes the Alt+Enter should not base on cell coordinate only, but on cell bottom-right boundary.
Comment 1 LeroyG 2023-07-27 20:28:57 UTC
Can confirm with:

Version: 7.4.3.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 1; OS: Linux 5.14; UI render: default; VCL: gtk3
Locale: es-MX (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 danomois 2023-07-30 02:08:04 UTC
Moving to New as the bottom comment shows confirmed.
Comment 3 Stéphane Guillou (stragu) 2023-08-08 16:53:02 UTC
Same in OOo 3.3, so inherited.
Comment 4 Commit Notification 2023-08-10 16:50:18 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8258a70a7ca596a8ce5ff417f312a99a96694bed

tdf#156492 sw: fix alt-Enter in cells merged vertically

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 5 László Németh 2023-08-10 16:51:19 UTC
Fixed in master, started back-port to 7.6.

@Tomasz & all: many thanks for the bug report and QA!
Comment 6 Commit Notification 2023-08-14 09:14:29 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/7dbecdd63c292ba28aa5bb7143be5b0560f38c4e

tdf#156492 sw: fix alt-Enter in cells merged vertically

It will be available in 7.6.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.