treesheets icon indicating copy to clipboard operation
treesheets copied to clipboard

Cell content does not follow cell widening after narrowing

Open noyannus opened this issue 1 year ago • 2 comments

After decreasing column widh, some content does not widen when the width is increased again. In the example below, between the first and the second image, the column has been narrowed, then widened. The text in cell 1 did not rewrap.

The same can be observed in nested cells.

On Kubuntu

Fresh file:

Screenshot_20240104_115753

Decreased width, then increased:

Screenshot_20240104_115901

Other file w/dummy text:

Screenshot_20240113_151310-1

Cutting out the text and either typing or pasting fresh text inherits the narrow text width.

F9 the cell into a nested sub-cell gives the text the full width (but that ruins the layout).

Seen with

TreeSheets Jan  7 2024, Uses wxWidgets 3.3.0
on
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-14-generic (64-bit)
Graphics Platform: X11

and

Treesheets Dec 18 2023, Uses wxWidgets 3.3.0
on 
System: Linux Mint 21.2 Cinnamon
Kernel: 5.15.0-91-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 
Desktop: Cinnamon 5.8.4
tk: GTK 3.24.33 
wm: muffin 
dm: LightDM 
Distro: Linux Mint 21.2 Victoria 
base: Ubuntu 22.04 jammy

noyannus avatar Jan 13 '24 15:01 noyannus

Update: this does not happen consistently.

And a question: is the right border of a subcell anchored with an absolute value to the right border of its parent? When narrowing the parent, the distance between borders remains constant, which can lead to very slim child cells.

noyannus avatar Jan 13 '24 21:01 noyannus

The column width is per grid column. Cell 1 and Cell 2 are in different columns.

The narrowing/widening operates on the current column and all nested columns beneath it. So I am guessing what happened is that it was narrowed with Cell 1 or the parent of Cell 2 selected, then widened while only Cell 2 is selected. The end result is as intended.

If something else is happening, can you give an exact repro (including what cells were selected at time of operation)

aardappel avatar Jan 15 '24 18:01 aardappel

Ah, so. I had the expectation (ingrained from use of many other apps) that a content would always flow to fill the full available width.

Just for curiosity: what is the benefit of empty areas as in cell 1, second image? A full width auto-reflow would free vertical space and improve overviews, ISTM.

Thank you for the assistance and this useful app!

Closing as resolved.

noyannus avatar Jan 17 '24 16:01 noyannus

There is no particular advantage.

I guess layout is a single pass algorithm, and the available width is not known at the start. Any cell could make the actual rendered width wider and thus give more visual space to cells before it that have already been layouted.

"column width" is based on characters, but the rendering is based on pixels derived from text width, so can be wildly different esp with unicode chars.

The only way to do what you expect is a two pass algorithm, where thus the pixel text width of everything is computed twice, which is fairly expensive.

aardappel avatar Jan 17 '24 16:01 aardappel

Ah! Thank you.

noyannus avatar Jan 18 '24 09:01 noyannus