File tree Expand file tree Collapse file tree 3 files changed +46
-6
lines changed Expand file tree Collapse file tree 3 files changed +46
-6
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ Split window (create a new pane):
140140``` python
141141>> > pane = window.split_window()
142142>> > pane = window.split_window(attach = False )
143- >> > pane.select_pane ()
143+ >> > pane.select ()
144144Pane(% 3 Window(@ 1 1 :... , Session($ 1 ... )))
145145>> > window = session.new_window(attach = False , window_name = " test" )
146146>> > window
Original file line number Diff line number Diff line change @@ -311,14 +311,14 @@ For one, arguments such as `attach=False` can be omittted.
311311
312312This gives you the {class}` Pane ` along with moving the cursor to a new window. You
313313can also use the ` .select_* ` available on the object, in this case the pane has
314- {meth}` Pane.select_pane () ` .
314+ {meth}` Pane.select () ` .
315315
316316``` python
317317>> > pane = window.split_window(attach = False )
318318```
319319
320320``` python
321- >> > pane.select_pane ()
321+ >> > pane.select ()
322322Pane(% 1 Window(@ 1 ... :... , Session($ 1 ... )))
323323```
324324
Original file line number Diff line number Diff line change @@ -416,13 +416,53 @@ def kill(
416416 additional scoped window info.
417417 """
418418
419+ def select (self ) -> "Pane" :
420+ """Select pane.
421+
422+ Examples
423+ --------
424+ >>> pane = window.attached_pane
425+ >>> new_pane = window.split_window()
426+ >>> pane.refresh()
427+ >>> active_panes = [p for p in window.panes if p.pane_active == '1']
428+
429+ >>> pane in active_panes
430+ True
431+ >>> new_pane in active_panes
432+ False
433+
434+ >>> new_pane.pane_active == '1'
435+ False
436+
437+ >>> new_pane.select()
438+ Pane(...)
439+
440+ >>> new_pane.pane_active == '1'
441+ True
442+ """
443+ proc = self .cmd ("select-pane" )
444+
445+ if proc .stderr :
446+ raise exc .LibTmuxException (proc .stderr )
447+
448+ self .refresh ()
449+
450+ return self
451+
419452 def select_pane (self ) -> "Pane" :
420453 """Select pane.
421454
422- To select a window object asynchrously. If a ``pane`` object exists
423- and is no longer longer the current window, ``w.select_pane()``
424- will make ``p`` the current pane.
455+ Notes
456+ -----
457+ .. deprecated:: 0.30
458+
459+ Deprecated in favor of :meth:`.select()`.
425460 """
461+ warnings .warn (
462+ "Pane.select_pane() is deprecated in favor of Pane.select()" ,
463+ category = DeprecationWarning ,
464+ stacklevel = 2 ,
465+ )
426466 assert isinstance (self .pane_id , str )
427467 pane = self .window .select_pane (self .pane_id )
428468 if pane is None :
You can’t perform that action at this time.
0 commit comments