File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ pub enum Action {
4848 PrevTab ,
4949 NewTab ,
5050 CloseTab ( ConnectionId ) ,
51+ CloseCurrentTab ,
5152 SwitchTab ( ConnectionId ) ,
5253
5354 // Connection
Original file line number Diff line number Diff line change @@ -1743,6 +1743,17 @@ impl App {
17431743 self . connection_form . view_folder ( & path, & description) ;
17441744 }
17451745
1746+ Action :: CloseCurrentTab => {
1747+ if let Some ( id) = self . active_tab_id {
1748+ self . tabs . retain ( |t| t. id != id) ;
1749+ self . tab_bar . remove_tab ( id) ;
1750+ self . active_tab_id = self . tab_bar . active_tab ;
1751+ self . detail_panel . clear ( ) ;
1752+ if self . active_tab_id . is_none ( ) {
1753+ self . status_bar . set_disconnected ( ) ;
1754+ }
1755+ }
1756+ }
17461757 Action :: CloseTab ( id) => {
17471758 self . tabs . retain ( |t| t. id != id) ;
17481759 self . tab_bar . remove_tab ( id) ;
Original file line number Diff line number Diff line change @@ -209,6 +209,18 @@ fn build_sections(keymap: &Keymap) -> Vec<HelpSection> {
209209 keymap. hint( "focus_prev" ) . to_string( ) ,
210210 "Previous panel" . to_string( ) ,
211211 ) ,
212+ (
213+ keymap. hint( "next_tab" ) . to_string( ) ,
214+ "Next tab" . to_string( ) ,
215+ ) ,
216+ (
217+ keymap. hint( "prev_tab" ) . to_string( ) ,
218+ "Previous tab" . to_string( ) ,
219+ ) ,
220+ (
221+ keymap. hint( "close_tab" ) . to_string( ) ,
222+ "Close tab" . to_string( ) ,
223+ ) ,
212224 ( keymap. hint( "quit" ) . to_string( ) , "Quit" . to_string( ) ) ,
213225 (
214226 keymap. hint( "force_quit" ) . to_string( ) ,
Original file line number Diff line number Diff line change @@ -91,6 +91,9 @@ pub struct KeybindingConfig {
9191 pub save_connection : String ,
9292 pub switch_to_browser : String ,
9393 pub switch_to_profiles : String ,
94+ pub next_tab : String ,
95+ pub prev_tab : String ,
96+ pub close_tab : String ,
9497}
9598
9699impl Default for KeybindingConfig {
@@ -110,6 +113,9 @@ impl Default for KeybindingConfig {
110113 save_connection : "F10" . to_string ( ) ,
111114 switch_to_browser : "F1" . to_string ( ) ,
112115 switch_to_profiles : "F2" . to_string ( ) ,
116+ next_tab : "Ctrl+Right" . to_string ( ) ,
117+ prev_tab : "Ctrl+Left" . to_string ( ) ,
118+ close_tab : "Ctrl+w" . to_string ( ) ,
113119 }
114120 }
115121}
Original file line number Diff line number Diff line change @@ -199,6 +199,24 @@ impl Keymap {
199199 & defaults. switch_to_profiles,
200200 Action :: SwitchLayout ( ActiveLayout :: Profiles ) ,
201201 ) ,
202+ (
203+ "next_tab" ,
204+ & config. next_tab,
205+ & defaults. next_tab,
206+ Action :: NextTab ,
207+ ) ,
208+ (
209+ "prev_tab" ,
210+ & config. prev_tab,
211+ & defaults. prev_tab,
212+ Action :: PrevTab ,
213+ ) ,
214+ (
215+ "close_tab" ,
216+ & config. close_tab,
217+ & defaults. close_tab,
218+ Action :: CloseCurrentTab ,
219+ ) ,
202220 ] ;
203221
204222 for ( name, user_str, default_str, action) in bindings {
You can’t perform that action at this time.
0 commit comments