@@ -353,20 +353,116 @@ def display_message(
353353 self .cmd ("display-message" , cmd )
354354 return None
355355
356+ def kill (
357+ self ,
358+ all_except : t .Optional [bool ] = None ,
359+ ) -> None :
360+ """Kill :class:`Pane`.
361+
362+ ``$ tmux kill-pane``.
363+
364+ Examples
365+ --------
366+ Kill a pane:
367+ >>> pane_1 = pane.split_window()
368+
369+ >>> pane_1 in window.panes
370+ True
371+
372+ >>> pane_1.kill()
373+
374+ >>> pane_1 not in window.panes
375+ True
376+
377+ Kill all panes except the current one:
378+ >>> pane.window.resize(height=100, width=100)
379+ Window(@1 1...)
380+
381+ >>> one_pane_to_rule_them_all = pane.split_window()
382+
383+ >>> other_panes = pane.split_window(
384+ ... ), pane.split_window()
385+
386+ >>> all([p in window.panes for p in other_panes])
387+ True
388+
389+ >>> one_pane_to_rule_them_all.kill(all_except=True)
390+
391+ >>> all([p not in window.panes for p in other_panes])
392+ True
393+
394+ >>> one_pane_to_rule_them_all in window.panes
395+ True
396+ """
397+ flags : t .Tuple [str , ...] = ()
398+
399+ if all_except :
400+ flags += ("-a" ,)
401+
402+ proc = self .cmd (
403+ "kill-pane" ,
404+ * flags ,
405+ )
406+
407+ if proc .stderr :
408+ raise exc .LibTmuxException (proc .stderr )
409+
410+ return None
411+
356412 """
357413 Commands ("climber"-helpers)
358414
359415 These are commands that climb to the parent scope's methods with
360416 additional scoped window info.
361417 """
362418
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+
363452 def select_pane (self ) -> "Pane" :
364453 """Select pane.
365454
366- To select a window object asynchrously. If a ``pane`` object exists
367- and is no longer longer the current window, ``w.select_pane()``
368- will make ``p`` the current pane.
455+ Notes
456+ -----
457+ .. deprecated:: 0.30
458+
459+ Deprecated in favor of :meth:`.select()`.
369460 """
461+ warnings .warn (
462+ "Pane.select_pane() is deprecated in favor of Pane.select()" ,
463+ category = DeprecationWarning ,
464+ stacklevel = 2 ,
465+ )
370466 assert isinstance (self .pane_id , str )
371467 pane = self .window .select_pane (self .pane_id )
372468 if pane is None :
@@ -376,9 +472,12 @@ def select_pane(self) -> "Pane":
376472 def split_window (
377473 self ,
378474 attach : bool = False ,
379- vertical : bool = True ,
380475 start_directory : t .Optional [str ] = None ,
381- percent : t .Optional [int ] = None ,
476+ vertical : bool = True ,
477+ shell : t .Optional [str ] = None ,
478+ size : t .Optional [t .Union [str , int ]] = None ,
479+ percent : t .Optional [int ] = None , # deprecated
480+ environment : t .Optional [t .Dict [str , str ]] = None ,
382481 ) -> "Pane" : # New Pane, not self
383482 """Split window at pane and return newly created :class:`Pane`.
384483
@@ -392,13 +491,22 @@ def split_window(
392491 specifies the working directory in which the new pane is created.
393492 percent: int, optional
394493 percentage to occupy with respect to current pane
494+
495+ Notes
496+ -----
497+ .. deprecated:: 0.28.0
498+
499+ ``percent=25`` deprecated in favor of ``size="25%"``.
395500 """
396501 return self .window .split_window (
397502 target = self .pane_id ,
398- start_directory = start_directory ,
399503 attach = attach ,
504+ start_directory = start_directory ,
400505 vertical = vertical ,
506+ shell = shell ,
507+ size = size ,
401508 percent = percent ,
509+ environment = environment ,
402510 )
403511
404512 """
0 commit comments