zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
20.8k stars 638 forks source link

Automatic tile reflow (not triggered?) lose space on quitting crafted layout #3174

Open Zykino opened 6 months ago

Zykino commented 6 months ago

2. Issues with the Zellij UI / behavior / crash

Issue description

On my "IDE" setup, the editor was on top left, stacked panes on the right and compiler at the bottom. The layout below takes inspiration but simplify it. image

Minimal reproduction

1) Load this layout, that I’m (I do it as a secondary tab from the first one)

layout {
    tab {
        pane size=1 borderless=true {
            plugin location="zellij:compact-bar"
        }
        pane split_direction="vertical" {
            pane split_direction="horizontal" {
                pane edit=""
                pane {
                    size 10 // <- passing this in percentage fix the issue by resizing this pane to take the whole vertical space
                }
            }
            pane
        }
    }
}

2) Close the edit pane -> ISSUE 1: The panes are not reflowed so the space is "lost" -> ISSUE 1 Bonus: Switching tab and going back to this one do not redraw in the space 3) Close one of the other panes -> ISSUE 2: Still no redraw -> ISSUE 3: The focus is a bit strange here, I think it goes to the last pane but it is not highlighted -> ISSUE 3 Bonus/fix: When only 1 pane is still open, switching tab and coming back to this one finally redraw the pane that now takes the whole page -> ISSUE 4: If you close all tabs without switching tab, the terminal close even if the other tab should still be opened

Maybe there are others sides effect that I did not see?

Other relevant information

I think the nested vertical/horizontal panes and the fixed size (in lines/rows) conflict in the re-tiling of panes. Not respecting either of this rules is fine to me.

I just tried: Re-opening a pane (new shell or editor) use the empty space. So… I’m not sure how to react to it. Some part of me like the fact that layout can be recovered exactly. But the ISSUE 3 and 4 are still very problematic.

Zykino commented 6 months ago

Just thinking about it now: A solution may be to "open a fake pane" (or a plugin?) at the spot where zellij don’t know what to place.

In that pane I would write something like:

This place is not possible to reflow because of this constraints: 1) Pane 2 is fixed at 10 rows 2) Pane 2 and Pane 3 are on should be spited vertically

Select this pane and type the number of the rule you wish to relax. Or open a new pane that will take this place.

It is the most elegant way that I found to let the user keep their layout because they accidentally close a pane, or accept the reflow and direct it a bit. At least it should fix the issues I pointed:

This fake pane (or plugin unrecoverable tile) cannot be closed (or re-open automatically if needed) but is replaced if a new pane is created.

What do you think about this idea? I like the plugin idea so it may be replaced with an automatic action (or the default one is automatic and maybe someone will implement the one I proposed here)