Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitely support tmux, fallback if terminfo isn't available #9

Merged
merged 5 commits into from Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@
- Update dependencies.
- Update to nix 0.26.
- Change MSRV policy to stable-5 supported, and bump MSRV to 1.60.0.
- Handle tmux explicitly ([#9](https://github.com/watchexec/clearscreen/pull/9)).
- Fall back to hardcoded sequence if terminfo is not available ([#9](https://github.com/watchexec/clearscreen/pull/9)).

## v1.0.10 (2022-06-01)

Expand Down
3 changes: 3 additions & 0 deletions TERMINALS.md
Expand Up @@ -72,6 +72,9 @@ On macOS, the terminfo for `xterm` and variants does not by default include E3,
the terminal in question actually does support E3. For that reason, default behaviour on macOS is
switched to use `XtermClear` if the `TERM` starts with `xterm` and the terminfo doesn’t have E3.

If the terminfo database is not available, `::default()` falls back to `XTermClear` instead of
supplying a useless `Terminfo`. When testing, it's expected to have a functional terminfo where
practical.

Emulator libraries
------------------
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Expand Up @@ -392,7 +392,8 @@ impl Default for ClearScreen {

// - screen supports CSI 3J only within the XtermClear sequence, without E3 capability.
// - Konsole handles CSI 3J correctly only within the XtermClear sequence.
if term.starts_with("screen") || term.starts_with("konsole") {
// - assume tmux TERMs are only used within tmux, and avoid the requirement for a functioning terminfo then
if term.starts_with("screen") || term.starts_with("konsole") || term.starts_with("tmux") {
return Self::XtermClear;
}

Expand All @@ -406,7 +407,7 @@ impl Default for ClearScreen {
return Self::XtermClear;
}

if !term.is_empty() {
if !term.is_empty() && Database::from_env().is_ok() {
return Self::Terminfo;
}
}
Expand Down