tenseleyflow/fackr / 2311cad

Browse files

feat: add terminal tab keybindings

Add keybindings for terminal tab management (when terminal focused):
- Alt+T: Create new terminal tab
- Alt+Q: Close current tab (hides terminal if last)
- Alt+.: Next tab
- Alt+,: Previous tab
- Alt+1-9: Switch to specific tab
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
2311cad065543b5c2dae7790907289d90941e522
Parents
ef6efb7
Tree
6f50e2b

1 changed file

StatusFile+-
M src/editor/state.rs 37 0
src/editor/state.rsmodified
@@ -1427,6 +1427,43 @@ impl Editor {
14271427
                 self.terminal_resize_dragging = false;
14281428
                 return Ok(());
14291429
             }
1430
+
1431
+            // Terminal tab management keybindings (Alt + key)
1432
+            if key_event.modifiers.contains(KeyModifiers::ALT) {
1433
+                match key_event.code {
1434
+                    // Alt+T: New terminal tab
1435
+                    KeyCode::Char('t') => {
1436
+                        let _ = self.terminal.new_session();
1437
+                        return Ok(());
1438
+                    }
1439
+                    // Alt+Q: Close current tab
1440
+                    KeyCode::Char('q') => {
1441
+                        if self.terminal.close_active_session() {
1442
+                            self.terminal.hide();
1443
+                            self.terminal_resize_dragging = false;
1444
+                        }
1445
+                        return Ok(());
1446
+                    }
1447
+                    // Alt+.: Next tab
1448
+                    KeyCode::Char('.') => {
1449
+                        self.terminal.next_session();
1450
+                        return Ok(());
1451
+                    }
1452
+                    // Alt+,: Previous tab
1453
+                    KeyCode::Char(',') => {
1454
+                        self.terminal.prev_session();
1455
+                        return Ok(());
1456
+                    }
1457
+                    // Alt+1-9: Switch to specific tab
1458
+                    KeyCode::Char(c @ '1'..='9') => {
1459
+                        let idx = (c as usize) - ('1' as usize);
1460
+                        self.terminal.switch_session(idx);
1461
+                        return Ok(());
1462
+                    }
1463
+                    _ => {}
1464
+                }
1465
+            }
1466
+
14301467
             // Send all other keys to terminal
14311468
             let _ = self.terminal.send_key(&key_event);
14321469
             return Ok(());