diff --git a/CHANGELOG.md b/CHANGELOG.md index 646e6bd..3934e96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/TERMINALS.md b/TERMINALS.md index 15af696..c702c77 100644 --- a/TERMINALS.md +++ b/TERMINALS.md @@ -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 ------------------ diff --git a/src/lib.rs b/src/lib.rs index c2122dd..b4133e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; } @@ -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; } }