Description
Step 1: Provide a summary of your problem
I created a yaml config with five panes in layout main-horizontal (although main-vertical also breaks). When I tried to run it it failed with the following exception:
Traceback (most recent call last):
File "/home/abraham/.local/bin/tmuxp", line 8, in <module>
sys.exit(cli.cli())
File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/abraham/.local/lib/python3.10/site-packages/tmuxp/cli/load.py", line 573, in command_load
load_workspace(config[-1], **tmux_options)
File "/home/abraham/.local/lib/python3.10/site-packages/tmuxp/cli/load.py", line 418, in load_workspace
_load_attached(builder, detached)
File "/home/abraham/.local/lib/python3.10/site-packages/tmuxp/cli/load.py", line 159, in _load_attached
builder.build()
File "/home/abraham/.local/lib/python3.10/site-packages/tmuxp/workspacebuilder.py", line 268, in build
for p, pconf in self.iter_create_panes(w, wconf):
File "/home/abraham/.local/lib/python3.10/site-packages/tmuxp/workspacebuilder.py", line 420, in iter_create_panes
p = w.split_window(
File "/usr/lib/python3.10/site-packages/libtmux/window.py", line 533, in split_window
raise exc.LibTmuxException(pane_cmd.stderr, self._info, self.panes)
libtmux.exc.LibTmuxException: (['no space for new pane'], {'session_name': 'foo', 'session_id': '$15', 'window_id': '@36', 'window_name': 'bash', 'window_width': '80', 'window_height': '24', 'window_layout': 'd96b,80x24,0,0,89', 'window_panes': '1', 'window_index': '0', 'window_flags': '*', 'window_active': '1', 'window_bell_flag': '0', 'window_activity_flag': '0', 'window_silence_flag': '0'}, [Pane(%89 Window(@36 0:bash, Session($15 foo))), Pane(%90 Window(@36 0:bash, Session($15 foo))), Pane(%91 Window(@36 0:bash, Session($15 foo))), Pane(%92 Window(@36 0:bash, Session($15 foo)))])
Step 2: Provide tmuxp details
also my console window is 213x51
Step 3: Describe the problem:
layout is not loaded, session is partially formed but not attached, exception is thrown.
Steps to reproduce:
I created this minimal config file that reproduces the issue:
session_name: foo
windows:
- focus: 'true'
layout: main-horizontal
panes:
- focus: 'true'
shell_command:
- echo 1
- echo 2
- echo 3
- echo 4
- echo 5
Observed Results:
A python exception
Expected Results:
A nicely built main-horizontal layout
Thoughts
Of course if I build the layout by hand it works, because I'm a human and I know that if I split the same pane over and over again, since every new pane is half the size of the previous one then soon my panes will be too small. So I resize them a little bit before splitting again, then adjust the final size.
Perhaps the algorithm for building the layout could do that. I think it is possible to know the final size of everything just from the layout, the amount of panes and the window size.