From 0d52ae96b2d0427643e96f999cd75ec3ebe347ce Mon Sep 17 00:00:00 2001 From: Chen Mulong Date: Tue, 9 Apr 2019 12:19:24 +0800 Subject: [PATCH] Fix display issues when start from iTerm --- CHANGES.md | 6 +++++- src/main.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7544b60..d13c464 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ CHANGES -------- +0.1.2 + +- Fix display issues when start from iTerm on MacOS. + 0.1.1 20190327 - Add `--nofork`. @@ -8,4 +12,4 @@ CHANGES 0.1.0 20190321 -- First release. +- First release. \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 8224de5..f0ae578 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,6 +58,17 @@ fn check_alacritty() -> PathBuf { std::process::exit(-1); } +#[cfg(not(target_os = "macos"))] +fn prepare_env() { +} + +#[cfg(target_os = "macos")] +fn prepare_env() { + // When starting from iTerm, these env vars could cause some display issues. + env::remove_var("TERM_PROGRAM"); + env::remove_var("TERM_PROGRAM_VERSION"); +} + fn check_nvim() { let r = which(NVIM_NAME); if r == None { @@ -170,6 +181,7 @@ fn main() { command.arg(n_arg); } + prepare_env(); let mut child = command.spawn().unwrap(); if config.unwrap().fork { std::process::exit(0);