Skip to content

tmuxp assertion error with tmux master (pane index) #172

@kcwu

Description

@kcwu

after tmux/tmux@00cf5fb
the pane index may change after window split.

If there are two panes and their ids are 0 and 1. If calling libtmux's split_window() without specifying "target", libtmux will split pane 0. The result indexes are 0,1,2. Which means, new pane's id is 1 and previous pane's id changed from 1 to 2.

In old version, the indexes are 0,2,1.

With this change, all tmuxp sessions, with more than 2 panes in the same window, are probably all broken.

$ cat test.yaml                                                                                                                                                                                                                                                                     session_name: test
windows:
        - window_name: test
          panes:
                  - echo 1
                  - echo 2
                  - echo 3
                  - echo 4
$ tmuxp load test.yaml
[Loading] /usr/local/google/home/kcwu/tmuxp/test.yaml
Traceback (most recent call last):
  File "/home/kcwu/.local/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp', 'console_scripts', 'tmuxp')()
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/kcwu/.local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/kcwu/src/tmuxp/tmuxp/cli.py", line 484, in command_load
    load_workspace(config[-1], **tmux_options)
  File "/home/kcwu/src/tmuxp/tmuxp/cli.py", line 260, in load_workspace
    builder.build()
  File "/home/kcwu/src/tmuxp/tmuxp/workspacebuilder.py", line 178, in build
    for p, pconf in self.iter_create_panes(w, wconf):
  File "/home/kcwu/src/tmuxp/tmuxp/workspacebuilder.py", line 290, in iter_create_panes
    assert(int(p.index) == int(pindex))
AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions