Skip to content

Commit

Permalink
Explicitely support tmux, fallback if terminfo isn't available (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Dec 28, 2022
1 parent 9a446c8 commit 90cd645
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
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

0 comments on commit 90cd645

Please sign in to comment.