1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-28 15:56:28 +00:00

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.
This commit is contained in:
Kevin Song 2020-01-27 17:23:08 -06:00 committed by GitHub
parent 4b9a11d094
commit 5655a90a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);