Compare commits

..

4 Commits

Author SHA1 Message Date
Andrew Gallant
506f046b8b termcolor-0.1.1 2016-11-21 20:33:39 -05:00
Andrew Gallant
ae592b11e3 Only emit bold ANSI code if bold is true.
This was a simple logic error. Also, avoid emitting ANSI escape codes
if there are no color settings.

Fixes #242
2016-11-21 20:33:15 -05:00
Andrew Gallant
a5e7f176f1 Use clap ~2.18.0.
This is to ensure that we don't silently update a minor version of clap,
which could include a breaking change.

(An update to 2.19 should be done soon.)
2016-11-21 09:20:43 -05:00
Andrew Gallant
0428bd1bec update brew tap 2016-11-20 19:55:40 -05:00
5 changed files with 11 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ path = "tests/tests.rs"
[dependencies]
bytecount = "0.1.4"
clap = "2.18"
clap = "~2.18.0"
ctrlc = "2.0"
env_logger = "0.3"
grep = { version = "0.1.4", path = "grep" }

View File

@@ -1,9 +1,9 @@
class RipgrepBin < Formula
version '0.2.8'
version '0.3.0'
desc "Search tool like grep and The Silver Searcher."
homepage "https://github.com/BurntSushi/ripgrep"
url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz"
sha256 "349aba7561028e869932bae8fd27cd5ce45a68f47f05d426d6701a50a8474aa0"
sha256 "a177195e31a6687e1b0141cbb93bb2fc915a49c4bca26d7094a8144ebdfb3a69"
conflicts_with "ripgrep"

View File

@@ -260,7 +260,7 @@ impl<W: WriteColor> Printer<W> {
}
fn write_matched_line(&mut self, re: &Regex, buf: &[u8]) {
if !self.wtr.supports_color() {
if !self.wtr.supports_color() || self.colors.matched().is_none() {
self.write(buf);
return;
}

View File

@@ -1,6 +1,6 @@
[package]
name = "termcolor"
version = "0.1.0" #:version
version = "0.1.1" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
A simple cross platform library for writing colored text to a terminal.

View File

@@ -764,7 +764,7 @@ impl<W: io::Write> WriteColor for Ansi<W> {
if let Some(ref c) = spec.bg_color {
try!(self.write_color(false, c, spec.bold));
}
if spec.fg_color.is_none() && spec.bg_color.is_none() {
if spec.bold && spec.fg_color.is_none() && spec.bg_color.is_none() {
try!(self.write_str("\x1B[1m"));
}
Ok(())
@@ -969,6 +969,11 @@ impl ColorSpec {
self
}
/// Returns true if this color specification has no colors or styles.
pub fn is_none(&self) -> bool {
self.fg_color.is_none() && self.bg_color.is_none() && !self.bold
}
/// Clears this color specification so that it has no color/style settings.
pub fn clear(&mut self) {
self.fg_color = None;