Bug 166714 - Make uno:SetOptimalColumnWidthDirect (shift+alt+left/right) consider the whole column
Summary: Make uno:SetOptimalColumnWidthDirect (shift+alt+left/right) consider the whol...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
25.2.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-24 23:00 UTC by Bene-Jázem
Modified: 2025-06-19 07:41 UTC (History)
2 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 Bene-Jázem 2025-05-24 23:00:16 UTC
Description:
<shift><alt><left or right> adjust column width to cell content. GREAT!!!

BUT

It could check all selection range and adjust the column to their largest content.

Steps to Reproduce:
1. select a range
2. press key combination

Actual Results:
adjust column width to first selected sell content

Expected Results:
adjust column width to largest cell content in selection


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 20; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR
Debian package version: 4:25.2.3-2
Calc: CL threaded
Comment 1 nobu 2025-05-25 12:28:34 UTC
Alt+Shift+Arrow Key:
 Optimizes the column width or row height based on the current cell.

It behaves as stated in the help.

You can register the features you want yourself.
Optimal Column Width, Direct  (.uno:SetOptimalColumnWidthDirect)
Comment 2 Olivier Hallot 2025-05-27 00:49:47 UTC
"Double-click right column separator in column headers" is what you want.

https://help.libreoffice.org/master/en-US/text/shared/01/SetOptimalColumnWidth.html?&DbPAR=CALC&System=UNIX

If you need a specific keyboard shortcut, please customize your keyboard and assign command .uno:SetOptimalColumnWidth to your preferred keyboard combination.

See: https://help.libreoffice.org/master/en-US/text/shared/01/06140200.html?DbPAR=SHARED#bm_id2322763
Comment 3 Heiko Tietze 2025-06-02 08:35:11 UTC
I think this is at least worth a discussion.

STR: A1 = "Lorem ipsum dolor", A2 = "Lorem ipsum dolor est" -> running the function on A1 increases the column to the with of the first string, running it on the A2 to this string. If you select A1:A2 starting from A1 it still considers the length of A1.

While the function works on the current cell it might iterate through all cells and works on the whole column. But maybe it is a bug (in the documentation as well) since the fucntion SetMarkedWidthOrHeight() calls MarkToMulti(). And double click on the header calls the same function from SetEntrySize(). Eike, could you please add your wisdom.

To be considered, what should happen if multiple columns are selected? If the function works not per cell but column doesn't it mean to respond to selections?

Ultimately I tend to disagree with the enhancement request, if it's not a bug, and keep the function simple. Double-click on the column header works as expected.
Comment 4 Heiko Tietze 2025-06-10 08:52:43 UTC
(In reply to Olivier Hallot from comment #2)
> "Double-click right column separator in column headers" is what you want.
Which means you don't agree with the enhancement request. Back to Uncomfirmed...
Comment 5 Heiko Tietze 2025-06-19 07:41:06 UTC
We discussed the topic in the design meeting. While double-click interaction at the header works nicely for the whole column, the envisioned change adds capability to size for only a portion. In addition, it is how Excel works (while it has no active cell in case of multi-selection). So we support the request.