Skip to content

Commit

Permalink
Fix bug where windows 1 and 2 load reversed. Add Window.move_window()…
Browse files Browse the repository at this point in the history
…. Remove superfluous log msg
  • Loading branch information
tony committed Oct 31, 2013
1 parent e0e956f commit b94a396
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Here you can find the recent changes to tmuxp.
- [internal]: fix :meth:``Window.kill_window()`` target to
``session_id:window_index`` for compatibility and pass tests.
- [docs] [examples]: Example for ``start_directory``.
- [internal] fix bug where first and second window would load in mixed order
- [internal] :class:`Window.move_window()` for moving window.

2013-10-30
----------
Expand Down
2 changes: 1 addition & 1 deletion tmuxp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

import logging

__version__ = '0.0.29'
__version__ = '0.0.30'
23 changes: 21 additions & 2 deletions tmuxp/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ def kill_window(self):
Kill the current :class:`Window` object.
:param target_window: the ``target window``.
:type target_window: string
'''

proc = self.tmux(
Expand All @@ -266,6 +264,27 @@ def kill_window(self):

self.server._update_windows()

def move_window(self, destination):
'''
``$ tmux move-window``
move the current :class:`Window` object.
:param destination: the ``target window`` or index to move the window
to.
:type target_window: string
'''

proc = self.tmux(
'move-window',
'-s%s:%s' % (self.get('session_id'), self.get('window_index')),
'-t%s' % destination,
)

if proc.stderr:
raise Exception(proc.stderr)

self.server._update_windows()

def select_pane(self, target_pane):
'''
Expand Down
2 changes: 1 addition & 1 deletion tmuxp/workspacebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def iter_create_windows(self, s):
w1 = None
if i == int(1): # if first window, use window 1
w1 = s.attached_window()
w1.attached_pane().send_keys('la')
w1.move_window(99)
w = s.new_window(
window_name=window_name,
start_directory=wconf['start_directory'] if 'start_directory' in wconf else None,
Expand Down

0 comments on commit b94a396

Please sign in to comment.