Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout shenanigans may crash zellij #1350

Open
Tracked by #1568
raphCode opened this issue Apr 26, 2022 · 2 comments
Open
Tracked by #1568

Layout shenanigans may crash zellij #1350

raphCode opened this issue Apr 26, 2022 · 2 comments
Labels
layout issues related to the layout system stability Issues in relation to stability

Comments

@raphCode
Copy link
Contributor

raphCode commented Apr 26, 2022

Like already reported in #1289, doing some evil stuff with the layout may lead to some trouble:

  1. create a 3x3 layout with the splits aligned (unequal pane sizes are fine)
  2. resize the panes directly touching the center pane (von Neumann neighborhood 🤓). This "locks up" some of the split lines:
  • top one left
  • left one down
  • bottom one right
  • right one up
  1. close the panes in the 4 corners
  2. close the center pane
Screenshots of the layout these steps should create

After resizing (2.):
image
After closing the corner panes (3.):
image

Zellij is then in an unstable state:

  1. The UI still shows the closed center pane
  2. Trying to type something without changing the pane focus crashes zellij
  3. Switching between different tabs freezes content where the center pane used to be
  4. resizing the terminal windows flickers the pane tiling: it switches rapidly between two splits

The panic of 2.:

Error occurred in server:

  × Thread 'screen' panicked.
  ├─▶ Originating Thread(s)
  │   	1. stdin_handler_thread: AcceptInput
  │   	2. screen_thread: WriteCharacter
  │
  ├─▶ At zellij-server/src/tab/mod.rs:835:60
  ╰─▶ called `Option::unwrap()` on a `None` value
@raphCode raphCode changed the title Layout shenanigangs may crash zellij Layout shenanigans may crash zellij Apr 26, 2022
@a-kenji a-kenji added stability Issues in relation to stability layout issues related to the layout system labels Apr 26, 2022
@imsnif
Copy link
Member

imsnif commented Apr 29, 2022

What would the right thing to do here be? Open a new pane in its place?

@raphCode
Copy link
Contributor Author

raphCode commented Apr 29, 2022

Good question, but keeping users from closing panes might be a bad experience.

In observation 4, the layout engine even has found a solution:
image
The problem is that the continuous vertical center split flickers around when resizing the terminal window. Making the layout engine decide on a single split position would be okay for me.

Alternatives solutions which are fine:

  • the analogous layout with the common split line running horizontally
  • a completely symmetric solution is a 2x2 layout with aligned splits.
    This might be the most logical, because you arrive at that solution when shrinking the center pane to zero size. The surrounding panes grow towards each other like a closing aperture:
    image
    Also this leaves users with the most freedom because they can continue resizing in any direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layout issues related to the layout system stability Issues in relation to stability
Projects
None yet
Development

No branches or pull requests

3 participants