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

Changed behavior of swap-window #1879

Closed
HalosGhost opened this issue Aug 20, 2019 · 7 comments
Closed

Changed behavior of swap-window #1879

HalosGhost opened this issue Aug 20, 2019 · 7 comments

Comments

@HalosGhost
Copy link

HalosGhost commented Aug 20, 2019

Issue description

With a build of tmux from git-master, swap-window has changed its behavior from the last major release. Namely, instead of the window being swapped and the focus following the window that was originall focused, the windows are swapped and focus changes to the window it was swapped with.

edit for clarity: suppose I have two windows in this state: [A]B ([] denoting focus). Previously, I would do swap-window -t +1 which would result in B[A] (A and B are swapped and A remains focused). When doing so now, the result is [B]A (this windows are swapped, but the focus stays in the first position, so it is no longer on A). Passing -d in addition does not seem to change the behavior at all.

I use tmux's windows similar to tabs, so being able to move a window multiple times is a common use-case for me. Now, I would either need to know how far I want to move the window right away, or I need to swap windows, switch focus, and repeat till I have the windows in the order I would like. If I am going about this the WrongWay™, and there is a preferred method for accomplishing this, I would be happy to switch.

Required information

  • Linux unknown
    • Archlinux rolling release, using tmux-git from the AUR
  • tmux next-3.1
  • tmux-256color / st-256color

Minimal configuration example:

bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-left swap-window -t -1
bind -n C-right swap-window -t +1

I am not able to post the logs at the moment (as I have work open in tmux for $DAYJOB, but I will try to remember to do this when I get home and can provide them:

@nicm
Copy link
Member

nicm commented Aug 23, 2019

The behaviour was fixed to what was intended (and what swap-pane does). Use -d to keep the current window the same.

@HalosGhost
Copy link
Author

HalosGhost commented Aug 23, 2019

@nicm, though that seems reasonable, passing -d does not appear to help. I have updated the original post with what is hopefully a more clear description of the behavior I am experiencing. If -d is meant to preserve the old behavior, then perhaps the bug is that -d does not work properly.

@nicm
Copy link
Member

nicm commented Aug 26, 2019

I think the change was wrong, please try this: x.diff.txt

@HalosGhost
Copy link
Author

@nicm, thank you for the suggestion and proposed patch. I will give it a shot here when I have a moment.

@HalosGhost
Copy link
Author

@nicm, indeed that patch solves the problem perfectly. It causes -d to operate as you suggest above (with the intended behavior now being the default when -d is not passed).

Would you like me to PR that change, or would you rather handle the patch yourself?

@nicm
Copy link
Member

nicm commented Aug 28, 2019

Applied now, thanks!

@nicm nicm closed this as completed Aug 28, 2019
jody-frankowski added a commit to jody-frankowski/dotfiles that referenced this issue Nov 27, 2019
IngoMeyer441 added a commit to IngoMeyer441/tmux-pain-control that referenced this issue Dec 12, 2019
Tmux changed the behavior of `swap-window` to keep the focus instead of
following the swapped window (s.
[tmux issue 1879](tmux/tmux#1879)). This
commit adds the `-d` switch to `swap-window` bindings to restore the old
behavior.
@lock
Copy link

lock bot commented Feb 24, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants