@@ -25,12 +25,17 @@ interface TreeRow {
2525 ancestorContinues : boolean [ ] ;
2626}
2727
28+ export interface MuxMenuSelection {
29+ paneId : string ;
30+ inPool : boolean ;
31+ }
32+
2833export interface MuxMenuOptions {
2934 tui : TUI ;
3035 theme : Theme ;
3136 currentPaneId : string ;
3237 currentCwd : string ;
33- done : ( result : undefined ) => void ;
38+ done : ( result : MuxMenuSelection | undefined ) => void ;
3439}
3540
3641export class MuxMenu extends Container implements Focusable {
@@ -44,7 +49,7 @@ export class MuxMenu extends Container implements Focusable {
4449 private readonly theme : Theme ;
4550 private readonly currentPaneId : string ;
4651 private readonly currentCwd : string ;
47- private readonly done : ( result : undefined ) => void ;
52+ private readonly done : ( result : MuxMenuSelection | undefined ) => void ;
4853 private refreshTimer ?: ReturnType < typeof setInterval > ;
4954 private poolPanes = new Set < string > ( ) ;
5055 private readonly list : MuxList ;
@@ -135,7 +140,16 @@ export class MuxMenu extends Container implements Focusable {
135140 this . handleConfirmInput ( data ) ;
136141 return ;
137142 }
138- if ( data === "\r" || data === "\n" || data === "\u001b" || data === "q" ) {
143+ if ( data === "\r" || data === "\n" ) {
144+ const row = this . selectedRow ( ) ;
145+ if ( ! row || row . paneId === this . currentPaneId ) {
146+ this . done ( undefined ) ;
147+ return ;
148+ }
149+ this . done ( { paneId : row . paneId , inPool : this . poolPanes . has ( row . paneId ) } ) ;
150+ return ;
151+ }
152+ if ( data === "\u001b" || data === "q" ) {
139153 this . done ( undefined ) ;
140154 return ;
141155 }
@@ -260,6 +274,7 @@ class MuxList implements Component {
260274 } else {
261275 const sep = theme . fg ( "muted" , " · " ) ;
262276 const hints = [
277+ rawKeyHint ( "enter" , "switch" ) ,
263278 rawKeyHint ( "d" , "kill" ) ,
264279 rawKeyHint ( "D" , "kill all" ) ,
265280 rawKeyHint ( "tab" , "scope" ) ,
0 commit comments