@@ -1191,21 +1191,22 @@ def detach_window(self, *args):
11911191 'Choose a tab to move the window to' ,
11921192 ''
11931193 ]
1194+ fmt = '{} {}'
11941195 tab_id_map = {}
11951196 current_tab = self .active_tab
11961197 for i , tab in enumerate (self .all_tabs ):
11971198 if tab is not current_tab :
11981199 tab_id_map [i + 1 ] = tab .id
1199- lines .append ('{} {}' .format (i + 1 , tab .title ))
1200+ lines .append (fmt .format (i + 1 , tab .title ))
12001201 new_idx = len (tab_id_map ) + 1
12011202 tab_id_map [new_idx ] = 'new'
1202- lines .append ('{} {}' .format (new_idx , 'New tab' ))
1203+ lines .append (fmt .format (new_idx , 'New tab' ))
12031204 new_idx = len (tab_id_map ) + 1
12041205 tab_id_map [new_idx ] = None
1205- lines .append ('{} {}' .format (new_idx , 'New OS Window' ))
1206+ lines .append (fmt .format (new_idx , 'New OS Window' ))
12061207
12071208 def done (data , target_window_id , self ):
1208- done .tab_id = tab_id_map [int (data ['match' ][0 ].partition (' ' )[0 ])]
1209+ done .tab_id = tab_id_map [int (data ['match' ][0 ].strip (). partition (' ' )[0 ])]
12091210
12101211 def done2 (target_window_id , self ):
12111212 tab_id = done .tab_id
@@ -1220,7 +1221,7 @@ def done2(target_window_id, self):
12201221 self ._move_window_to (window = target_window , target_tab_id = tab_id )
12211222
12221223 self ._run_kitten (
1223- 'hints' , args = ('--type=regex' , r'--regex=(?m)^\d+ .+$' ,),
1224+ 'hints' , args = ('--ascending' , '-- type=regex' , r'--regex=(?m)^\s* \d+ .+$' ,),
12241225 input_data = '\r \n ' .join (lines ).encode ('utf-8' ), custom_callback = done , action_on_removal = done2 )
12251226
12261227 def detach_tab (self , * args ):
0 commit comments