From 5dc5775c72f04a787a0a6466d5fe8e22dbd09333 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Thu, 9 Apr 2026 22:17:23 +0200 Subject: [PATCH] stty: add support for tabs/-tabs combination settings --- src/uu/stty/src/flags.rs | 1 + src/uu/stty/src/stty.rs | 6 ++++++ tests/by-util/test_stty.rs | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/uu/stty/src/flags.rs b/src/uu/stty/src/flags.rs index 79965bf6b53..325dc95d154 100644 --- a/src/uu/stty/src/flags.rs +++ b/src/uu/stty/src/flags.rs @@ -355,4 +355,5 @@ pub const COMBINATION_SETTINGS: &[(&str, bool)] = &[ ("pass8", true), ("raw", true), ("sane", false), + ("tabs", true), ]; diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index 686f00a823e..ea078435d51 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -1220,6 +1220,12 @@ fn combo_to_flags(combo: &str) -> Vec> { (S::VDISCARD, "^O"), ]; } + "tabs" => { + flags = vec!["tab0"]; + } + "-tabs" => { + flags = vec!["tab3"]; + } _ => unreachable!("invalid combination setting: must have been caught earlier"), } let mut flags = flags diff --git a/tests/by-util/test_stty.rs b/tests/by-util/test_stty.rs index 411c716cab0..f8a2095a89d 100644 --- a/tests/by-util/test_stty.rs +++ b/tests/by-util/test_stty.rs @@ -947,6 +947,23 @@ fn test_combo_crt() { .stdout_contains("echoe"); } +#[test] +#[cfg(target_os = "linux")] +fn test_combo_tabs() { + // Test tabs combination setting - tabs is an alias for tab0, -tabs for tab3 + new_ucmd!() + .terminal_simulation(true) + .args(&["tabs"]) + .succeeds() + .no_stderr(); + + new_ucmd!() + .terminal_simulation(true) + .args(&["-tabs"]) + .succeeds() + .no_stderr(); +} + #[test] #[cfg(unix)] #[ignore = "Fails because cargo test does not run in a tty"]