Bug 135063 - Calc column width auto fit not working when selection active outside column
Summary: Calc column width auto fit not working when selection active outside column
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 139482 (view as bug list)
Depends on:
Blocks: Cell-Management
  Show dependency treegraph
 
Reported: 2020-07-22 23:41 UTC by falecomoadilson
Modified: 2024-01-02 13:44 UTC (History)
3 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 falecomoadilson 2020-07-22 23:41:22 UTC
Description:
When I have a Calc spreadsheet with multiple filled columns (3 columns) without adjustment, if I select one column (column B) and double click between columns header (A and B or C and D) to auto fit column width to content, the column not fit properly.

Steps to Reproduce:
1. Create a Calc spreadsheet with 3 filled columns without adjustment to their content;
2. Select one column (column B) and double click between columns header (A and B or C and D) to auto fit column width to content.

Actual Results:
The column don't auto fit to it content, only selected column fit properly.

Expected Results:
The column auto fit to it content.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.0.0.2 (x86)
Build ID: c01aa64b6c3d89ebe5fe69c28c7adb24eb85249c
Threads da CPU: 8; SO: Windows 10.0 Build 19041; Realizador da interface: Skia/Vulkan; VCL: win
Locale: pt-BR (pt_BR); Interface: pt-BR
Calc: threaded
Comment 1 m_a_riosv 2021-01-07 19:18:03 UTC
*** Bug 139482 has been marked as a duplicate of this bug. ***
Comment 2 Buovjaga 2021-11-26 14:48:48 UTC
NEW per duplicate
Comment 3 Mike Kaganski 2023-03-17 07:53:39 UTC
Possibly this is the consequence of the *intended* behavior, that selection defines the width. The idea is, that you can select (selection is not equal to focusing!) a cell or a cell range, and the auto-fit feature will consider the cells in the selection, ignoring cells outside. Note that when you select column B, and try to auto-fit column A, there is no cells in A that in the selection -> no cells must be taken into account, hence the width resets to a default.

Note also, that the discussed feature is broken since 4.1 (bug 148008).

Regardless of the bug 148008, I don't know if the behavior discussed here is bad, or is it actually reasonable and logical in the frame of the feature. IMO, it looks logical: a selection is present, and has no cells to consider for this column -> use a default. OTOH, in the same case, "-> use the widest cell" would be also a viable option...

Note that, no matter how this should resolve, the other case, when an *empty* cell in A is selected, A should continue to reset to a default.
Comment 4 Mike Kaganski 2023-03-17 09:54:21 UTC
*IIF* this is decided to be changed, here's a code pointer:

ScColumn::GetOptimalColWidth in sc/source/core/data/column2.cxx

When an existing selection doesn't cover the column in question, aMarkedSpans stays empty. The change could be to generalize the '"Select" the entire column if no selection exists' code to all cases when aMarkedSpans is empty after the previous check.
Comment 5 Stéphane Guillou (stragu) 2023-12-28 16:01:57 UTC
(noting that Mike fixed the bug 148008 regression for 7.5.3+ and 7.6.0+.)

Copying UX/Design team to decide if this is working as expected, or if something needs to change.

I agree that it is surprising that nothing happens when trying to optimize the column width if a selection outside the resized column is active.
In my opinion, this feature should only be active if part of the column being resized are selected.
Comment 6 Stéphane Guillou (stragu) 2023-12-28 16:05:27 UTC
(In reply to Stéphane Guillou (stragu) from comment #5)
> nothing happens when trying to optimize
> the column width if a selection outside the resized column is active.
(or resets to the default width if its width differs)
Comment 7 Heiko Tietze 2024-01-02 13:44:36 UTC
I think double-click between the column headers should trigger the optimal width function- and behave the same consequently. In fact you can use the command for multiple selections but not double click, neither the selection nor any other column.