Skip to content

Commit c70f4f6

Browse files
Ghostty supports OSC 9;4 (#2724)
This enables the new in-terminal progress bar (which uses OSC 9;4) if nextest is running inside the Ghostty terminal. See #2715 Here's a video of it working, with my local nextest build. https://github.com/user-attachments/assets/bd5c7918-7335-45c9-95a2-21108ece2493 It also does a tiny incidental refactor, making the other terminal-specific checks use `var_os` instead of `var` to use fewer allocations. --------- Co-authored-by: RGBCube <git@rgbcu.be>
1 parent 6e77aae commit c70f4f6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

nextest-runner/src/reporter/displayer/progress.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,18 +598,22 @@ fn supports_osc_9_4(stream: &dyn IsTerminal) -> bool {
598598
);
599599
return false;
600600
}
601-
if std::env::var("WT_SESSION").is_ok() {
601+
if std::env::var_os("WT_SESSION").is_some() {
602602
debug!("autodetect terminal progress reporting: enabling since WT_SESSION is set");
603603
return true;
604604
};
605-
if std::env::var("ConEmuANSI").ok() == Some("ON".into()) {
605+
if std::env::var_os("ConEmuANSI").is_some_and(|term| term == "ON") {
606606
debug!("autodetect terminal progress reporting: enabling since ConEmuANSI is ON");
607607
return true;
608608
}
609-
if std::env::var("TERM_PROGRAM").ok() == Some("WezTerm".into()) {
609+
if std::env::var_os("TERM_PROGRAM").is_some_and(|term| term == "WezTerm") {
610610
debug!("autodetect terminal progress reporting: enabling since TERM_PROGRAM is WezTerm");
611611
return true;
612612
}
613+
if std::env::var_os("TERM_PROGRAM").is_some_and(|term| term == "ghostty") {
614+
debug!("autodetect terminal progress reporting: enabling since TERM_PROGRAM is Ghostty");
615+
return true;
616+
}
613617

614618
false
615619
}

0 commit comments

Comments
 (0)