summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver looney <oliverjlooney@gmail.com>2023-12-31 22:24:44 +0000
committerOliver looney <oliverjlooney@gmail.com>2023-12-31 22:24:44 +0000
commit3b0ade9cb8ade5aa03ca20a250372aba37a1b24f (patch)
tree2248193e4018436efe2026a7a20871fd6ad3dd40
parent57016f4e044db09161140b50e55a65b35fb3e363 (diff)
slightly changed set terminal command to match docs & broke print line into multiple variables
-rw-r--r--src/bin/bat/main.rs7
-rw-r--r--tests/integration_tests.rs14
2 files changed, 13 insertions, 8 deletions
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index 8998ad7b..4a8ff421 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -228,7 +228,12 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result<
}
fn set_terminal_title_to(new_terminal_title: String) {
- print!("\x1b]2;{}\x07", new_terminal_title);
+ let osc_command_for_setting_terminal_title = "\x1b]0;";
+ let osc_end_command = "\x07";
+ print!(
+ "{}{}{}",
+ osc_command_for_setting_terminal_title, new_terminal_title, osc_end_command
+ );
io::stdout().flush().unwrap();
}
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 43a75d8b..47a75e5c 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -653,7 +653,7 @@ fn pager_disable() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07hello world\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07hello world\n").normalize());
}
#[test]
@@ -734,7 +734,7 @@ fn env_var_pager_value_bat() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07hello world\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07hello world\n").normalize());
}
#[test]
@@ -772,7 +772,7 @@ fn pager_most_from_pager_env_var() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07hello world\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07hello world\n").normalize());
});
}
@@ -818,7 +818,7 @@ fn pager_most_with_arg() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07hello world\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07hello world\n").normalize());
});
}
@@ -833,7 +833,7 @@ fn pager_more() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07hello world\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07hello world\n").normalize());
});
}
@@ -896,7 +896,7 @@ fn enable_pager_if_disable_paging_flag_comes_before_paging() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07pager-output\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07pager-output\n").normalize());
}
#[test]
@@ -908,7 +908,7 @@ fn enable_pager_if_pp_flag_comes_before_paging() {
.arg("test.txt")
.assert()
.success()
- .stdout(predicate::eq("\u{1b}]2;bat: test.txt\x07pager-output\n").normalize());
+ .stdout(predicate::eq("\u{1b}]0;bat: test.txt\x07pager-output\n").normalize());
}
#[test]