diff options
author | Kevin Song <chipbuster@users.noreply.github.com> | 2020-01-27 17:23:08 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 17:23:08 -0600 |
commit | 5655a90a28e2a286ae763c9fa7afe88c09a77920 (patch) | |
tree | 801a3658de2100e3a1705e001e34c9fb5f45f225 | |
parent | 4b9a11d0940cf13e3af7b83f85f7545636016221 (diff) |
fix: Restrict clear screen control code printing to fish (#865)
Wraps clearscreen print codes in a statement to detect fish shell, since it is a
workaround for a fish shell behavior.
-rw-r--r-- | src/print.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/print.rs b/src/print.rs index 46d44d223..b7b2936a5 100644 --- a/src/print.rs +++ b/src/print.rs @@ -5,7 +5,7 @@ use std::fmt::Write as FmtWrite; use std::io::{self, Write}; use unicode_width::UnicodeWidthChar; -use crate::context::Context; +use crate::context::{Context, Shell}; use crate::module::Module; use crate::module::ALL_MODULES; use crate::modules; @@ -26,7 +26,11 @@ pub fn get_prompt(context: Context) -> String { writeln!(buf).unwrap(); } - buf.push_str("\x1b[J"); + // A workaround for a fish bug (see #739,#279). Applying it to all shells + // breaks things (see #808,#824,#834). Should only be printed in fish. + if let Shell::Fish = context.shell { + buf.push_str("\x1b[J"); // An ASCII control code to clear screen + } let modules = compute_modules(&context); |