Skip to content

refactor(floating_panes): updating tile-pane and float-pane to use new layout mechanics.#5188

Open
daneofmanythings wants to merge 2 commits into
tmux:floating_panesfrom
daneofmanythings:fp--tile-float-pane-update
Open

refactor(floating_panes): updating tile-pane and float-pane to use new layout mechanics.#5188
daneofmanythings wants to merge 2 commits into
tmux:floating_panesfrom
daneofmanythings:fp--tile-float-pane-update

Conversation

@daneofmanythings

@daneofmanythings daneofmanythings commented Jun 10, 2026

Copy link
Copy Markdown
Member

(WIP)

I am updating tile-pane and float-pane to use the new layout logic system. Once this is solid, I will be moving the functionality into the other existing commands.

I will detail here how I plan on accomplishing this (bugs are still being squashed). Note that function names can be changed; they were made hastily to get coding.

Given that we would like to be able to restore floating layout geometry, some new state needs to be added to struct layout_cell to track this. It was previously added to struct window_pane. I am not certain adding four new fields is the correct approach, but it is the simplest for now.

When a tiled pane is "floated":

  1. Any previous geometry is fetched from the layout cell.
  2. The geometry it occupies in the tiled layout needs to be reclaimed by either a sibling, or in the case that it is the last tiled pane in the parent, a sibling of the parent reclaims the geometry (example: splitw; splitw -h; floatp -t2; floatp -t1). This is currently being done in layout_cell_remove_tile.
  3. The floating geometry needs to be determined using a combination of provided arguments, stored dimensions, and defaults in a priority of that order. I broke out some logic to reuse the argument parsing. This is happening in layout_cell_floating_args.
  4. The expected layout and pane touch-ups happen.

When a floating pane is "tiled":

  1. The floating dimensions are saved in the layout cell.
  2. A neighbour is selected from layout_cell_get_neighbour (a neighbour is a sibling that exists in the tiled layout). Since floating panes now have meaningful layout positions, this will restore the pane to its previous position.
  3. We perform a "split" (two functions have been broken out of layout_split_pane to reuse logic) in place and recursively resize siblings/parents as necessary to make room. This is happening in layout_cell_insert_tile. None of the old tiled dimensions are stored nor used for this calculation. There is no guarantee of consistent layout state between floating and tiling, so the simplest thing to do is a 50/50 split of the parents type. Logic can be added in the future to track IF the state hasn't changed, the old tiling dimensions can be used.
  4. The expected layout and pane touch-ups happen.

A lot of the PR so far is pulling out existing logic into their own functions for reuse with two new workhorse functions layout_cell_remove_tile and layout_cell_insert_tile. I am anticipating using these in the logic to hide/show panes, which is why they aren't local to the tile/float commands.

Let me know if ya'll have any thoughts or questions on what I have here. The code is still being debugged, so is less useful to look at, but don't hesitate to provide feedback anyway. Thanks!

@nicm @mgrant0

@github-project-automation github-project-automation Bot moved this to Not Started in All Issues & PRs Jun 10, 2026
@daneofmanythings daneofmanythings moved this from Not Started to In Progress in All Issues & PRs Jun 10, 2026
@daneofmanythings daneofmanythings force-pushed the fp--tile-float-pane-update branch from 696cc30 to 5d81c9e Compare June 10, 2026 20:44
@daneofmanythings daneofmanythings changed the title (WIP) updating tile-pane and float-pane to use new layout mechanics. refactor(floating_panes): updating tile-pane and float-pane to use new layout mechanics. Jun 10, 2026
@daneofmanythings

Copy link
Copy Markdown
Member Author

Okay, I believe I have gotten it to a testable point. Things I am unsure about:

  • It seems nice to be able to update the dimensions of floating geometry whilst not having to specify everything. Previously stored geometry is used where no args specify otherwise. The solution I came up with is to reuse the logic from layout_get_floating_cell. I'm not sure I like how it ended up. I can't seem to lock down layout_get_floating_cell; it has been on a journey.
  • The naming of some functions, primarily layout_insert_tile and layout_remove_tile. They handle giving up, and taking back tiling dimensions on float/tile operations, and will be used to do a similar thing with hide/show.

@daneofmanythings daneofmanythings marked this pull request as ready for review June 10, 2026 20:54
@daneofmanythings daneofmanythings moved this from In Progress to For Review in All Issues & PRs Jun 10, 2026
@nicm

nicm commented Jun 10, 2026

Copy link
Copy Markdown
Member

@mgrant0 should look at this preferably :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: For Review

Development

Successfully merging this pull request may close these issues.

2 participants