aardappel / treesheets

TreeSheets : Free Form Data Organizer (see strlen.com/treesheets)
zlib License
2.58k stars 193 forks source link

Cell content does not follow cell widening after narrowing #592

Closed noyannus closed 8 months ago

noyannus commented 8 months ago

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 commented 8 months ago

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.

aardappel commented 8 months ago

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)

noyannus commented 8 months ago

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.

aardappel commented 8 months ago

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.

noyannus commented 8 months ago

Ah! Thank you.