Skip to content

Commit

Permalink
fix: Don't depend on ansi_term in windows to make windows 7 work
Browse files Browse the repository at this point in the history
  • Loading branch information
Marwes committed Aug 30, 2019
1 parent b910eea commit 58e2a8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion repl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ gluon_codegen = { path = "../codegen", version = "0.12.0" } # GLUON
gluon_format = { version = "0.12.0", path = "../format" } # GLUON
gluon_doc = { version = "0.12.0", path = "../doc" } # GLUON

ansi_term = "0.12"
app_dirs = "1.0.0"
futures = "0.1.11"
futures-cpupool = "0.1"
Expand All @@ -48,6 +47,9 @@ codespan-reporting = "0.3"
serde = "1"
serde_derive = "1"

[target.'cfg(not(windows))'.dependencies]
ansi_term = "0.12"

[dev-dependencies]
pretty_assertions = "0.6"

Expand Down
7 changes: 5 additions & 2 deletions repl/src/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,12 @@ impl rustyline::highlight::Highlighter for Completer {

fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> {
// TODO Detect when windows supports ANSI escapes
if cfg!(windows) {
#[cfg(windows)]
{
Cow::Borrowed(hint)
} else {
}
#[cfg(not(windows))]
{
use ansi_term::Style;
Cow::Owned(Style::new().dimmed().paint(hint).to_string())
}
Expand Down

0 comments on commit 58e2a8b

Please sign in to comment.