Skip to content

Commit 9685b60

Browse files
committed
fmt
1 parent 7d91538 commit 9685b60

File tree

4 files changed

+29
-37
lines changed

4 files changed

+29
-37
lines changed

src/app/input.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ impl Editor {
5858
tracing::trace!("is_toggle_capture (F9)={}", is_toggle_capture);
5959
if is_toggle_capture {
6060
self.keyboard_capture = !self.keyboard_capture;
61-
tracing::info!(
62-
"Toggled keyboard_capture to {}",
63-
self.keyboard_capture
64-
);
61+
tracing::info!("Toggled keyboard_capture to {}", self.keyboard_capture);
6562
if self.keyboard_capture {
6663
self.set_status_message(
6764
"Keyboard capture ON - all keys go to terminal (F9 to toggle)".to_string(),

src/app/mod.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,11 +1733,7 @@ impl Editor {
17331733
.iter()
17341734
.position(|&id| id == buffer_id)
17351735
.unwrap_or(0);
1736-
let replacement_idx = if current_idx > 0 {
1737-
current_idx - 1
1738-
} else {
1739-
1
1740-
};
1736+
let replacement_idx = if current_idx > 0 { current_idx - 1 } else { 1 };
17411737
let replacement_buffer = current_split_tabs[replacement_idx];
17421738

17431739
// Remove buffer from this split's tabs
@@ -1811,11 +1807,7 @@ impl Editor {
18111807
.iter()
18121808
.position(|&id| id == buffer_id)
18131809
.unwrap_or(0);
1814-
let replacement_idx = if current_idx > 0 {
1815-
current_idx - 1
1816-
} else {
1817-
1
1818-
};
1810+
let replacement_idx = if current_idx > 0 { current_idx - 1 } else { 1 };
18191811
let replacement_buffer = split_tabs[replacement_idx];
18201812

18211813
// Remove buffer from this split's tabs
@@ -1824,7 +1816,9 @@ impl Editor {
18241816
}
18251817

18261818
// Update the split to show the replacement buffer
1827-
let _ = self.split_manager.set_split_buffer(split_id, replacement_buffer);
1819+
let _ = self
1820+
.split_manager
1821+
.set_split_buffer(split_id, replacement_buffer);
18281822

18291823
self.set_status_message("Tab closed".to_string());
18301824
}
@@ -2581,7 +2575,11 @@ impl Editor {
25812575
/// - Syncing file explorer
25822576
///
25832577
/// Use this instead of calling set_active_split directly when switching focus.
2584-
pub(super) fn focus_split(&mut self, split_id: crate::model::event::SplitId, buffer_id: BufferId) {
2578+
pub(super) fn focus_split(
2579+
&mut self,
2580+
split_id: crate::model::event::SplitId,
2581+
buffer_id: BufferId,
2582+
) {
25852583
let previous_split = self.split_manager.active_split();
25862584
let previous_buffer = self.active_buffer(); // Get BEFORE changing split
25872585
let split_changed = previous_split != split_id;

src/input/commands.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,8 @@ pub fn get_all_commands() -> Vec<Command> {
999999
},
10001000
Command {
10011001
name: "Toggle Keyboard Capture".to_string(),
1002-
description: "Lock all keyboard input to terminal (bypass editor shortcuts)".to_string(),
1002+
description: "Lock all keyboard input to terminal (bypass editor shortcuts)"
1003+
.to_string(),
10031004
action: Action::ToggleKeyboardCapture,
10041005
contexts: vec![KeyContext::Terminal],
10051006
custom_contexts: vec![],

tests/e2e/terminal.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,7 @@ fn test_session_restore_terminal_active_buffer() {
10661066
fn test_keyboard_capture_toggle() {
10671067
use tracing_subscriber::EnvFilter;
10681068
let _ = tracing_subscriber::fmt()
1069-
.with_env_filter(
1070-
EnvFilter::from_default_env().add_directive(tracing::Level::TRACE.into()),
1071-
)
1069+
.with_env_filter(EnvFilter::from_default_env().add_directive(tracing::Level::TRACE.into()))
10721070
.with_test_writer()
10731071
.try_init();
10741072

@@ -1092,16 +1090,12 @@ fn test_keyboard_capture_toggle() {
10921090
harness.render().unwrap();
10931091
harness.assert_screen_contains("Command:");
10941092
// Close the command palette
1095-
harness
1096-
.send_key(KeyCode::Esc, KeyModifiers::NONE)
1097-
.unwrap();
1093+
harness.send_key(KeyCode::Esc, KeyModifiers::NONE).unwrap();
10981094
harness.render().unwrap();
10991095

11001096
// Toggle keyboard capture ON with F9
11011097
tracing::info!("=== Toggling keyboard capture ON ===");
1102-
harness
1103-
.send_key(KeyCode::F(9), KeyModifiers::NONE)
1104-
.unwrap();
1098+
harness.send_key(KeyCode::F(9), KeyModifiers::NONE).unwrap();
11051099
harness.render().unwrap();
11061100

11071101
assert!(
@@ -1123,9 +1117,7 @@ fn test_keyboard_capture_toggle() {
11231117

11241118
// Toggle keyboard capture OFF with F9
11251119
tracing::info!("=== Toggling keyboard capture OFF ===");
1126-
harness
1127-
.send_key(KeyCode::F(9), KeyModifiers::NONE)
1128-
.unwrap();
1120+
harness.send_key(KeyCode::F(9), KeyModifiers::NONE).unwrap();
11291121
harness.render().unwrap();
11301122

11311123
assert!(
@@ -1218,9 +1210,7 @@ fn test_ui_bindings_blocked_with_keyboard_capture() {
12181210
let terminal_buffer = harness.editor().active_buffer_id();
12191211

12201212
// Turn keyboard capture ON with F9
1221-
harness
1222-
.send_key(KeyCode::F(9), KeyModifiers::NONE)
1223-
.unwrap();
1213+
harness.send_key(KeyCode::F(9), KeyModifiers::NONE).unwrap();
12241214
harness.render().unwrap();
12251215
assert!(harness.editor().is_keyboard_capture());
12261216

@@ -1365,8 +1355,8 @@ fn test_terminal_split_switch_exits_terminal_mode() {
13651355
harness
13661356
.send_mouse(crossterm::event::MouseEvent {
13671357
kind: crossterm::event::MouseEventKind::Down(crossterm::event::MouseButton::Left),
1368-
column: 10, // column - well into left split
1369-
row: 15, // row - middle of content area
1358+
column: 10, // column - well into left split
1359+
row: 15, // row - middle of content area
13701360
modifiers: KeyModifiers::NONE,
13711361
})
13721362
.unwrap();
@@ -1471,7 +1461,9 @@ fn test_click_between_splits_terminal_focus() {
14711461
iteration
14721462
);
14731463
assert!(
1474-
harness.editor().is_terminal_buffer(harness.editor().active_buffer_id()),
1464+
harness
1465+
.editor()
1466+
.is_terminal_buffer(harness.editor().active_buffer_id()),
14751467
"Iteration {}: Active buffer should be terminal before clicking file split",
14761468
iteration
14771469
);
@@ -1496,7 +1488,9 @@ fn test_click_between_splits_terminal_focus() {
14961488

14971489
// Active buffer should be the file (non-terminal)
14981490
assert!(
1499-
!harness.editor().is_terminal_buffer(harness.editor().active_buffer_id()),
1491+
!harness
1492+
.editor()
1493+
.is_terminal_buffer(harness.editor().active_buffer_id()),
15001494
"Iteration {}: Active buffer should be file (non-terminal) after clicking file split",
15011495
iteration
15021496
);
@@ -1521,7 +1515,9 @@ fn test_click_between_splits_terminal_focus() {
15211515

15221516
// Active buffer should be the terminal again
15231517
assert!(
1524-
harness.editor().is_terminal_buffer(harness.editor().active_buffer_id()),
1518+
harness
1519+
.editor()
1520+
.is_terminal_buffer(harness.editor().active_buffer_id()),
15251521
"Iteration {}: Active buffer should be terminal after clicking terminal split",
15261522
iteration
15271523
);

0 commit comments

Comments
 (0)