Skip to content

Commit 5dc5775

Browse files
committed
stty: add support for tabs/-tabs combination settings
1 parent ef5243e commit 5dc5775

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/uu/stty/src/flags.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,5 @@ pub const COMBINATION_SETTINGS: &[(&str, bool)] = &[
355355
("pass8", true),
356356
("raw", true),
357357
("sane", false),
358+
("tabs", true),
358359
];

src/uu/stty/src/stty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,12 @@ fn combo_to_flags(combo: &str) -> Vec<ArgOptions<'_>> {
12201220
(S::VDISCARD, "^O"),
12211221
];
12221222
}
1223+
"tabs" => {
1224+
flags = vec!["tab0"];
1225+
}
1226+
"-tabs" => {
1227+
flags = vec!["tab3"];
1228+
}
12231229
_ => unreachable!("invalid combination setting: must have been caught earlier"),
12241230
}
12251231
let mut flags = flags

tests/by-util/test_stty.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,23 @@ fn test_combo_crt() {
947947
.stdout_contains("echoe");
948948
}
949949

950+
#[test]
951+
#[cfg(target_os = "linux")]
952+
fn test_combo_tabs() {
953+
// Test tabs combination setting - tabs is an alias for tab0, -tabs for tab3
954+
new_ucmd!()
955+
.terminal_simulation(true)
956+
.args(&["tabs"])
957+
.succeeds()
958+
.no_stderr();
959+
960+
new_ucmd!()
961+
.terminal_simulation(true)
962+
.args(&["-tabs"])
963+
.succeeds()
964+
.no_stderr();
965+
}
966+
950967
#[test]
951968
#[cfg(unix)]
952969
#[ignore = "Fails because cargo test does not run in a tty"]

0 commit comments

Comments
 (0)