Skip to content

Commit c409924

Browse files
committed
---
yaml --- r: 62906 b: refs/heads/snap-stage3 c: 100ee84 h: refs/heads/master v: v3
1 parent 42e155a commit c409924

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1f27c6306d9f376f9b629a98f8a57c2e43e59b41
4+
refs/heads/snap-stage3: 100ee8409789edb290a1d3309f70286c6a799a7c
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/term.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ pub static color_bright_magenta: u8 = 13u8;
4343
pub static color_bright_cyan: u8 = 14u8;
4444
pub static color_bright_white: u8 = 15u8;
4545

46-
pub fn esc(writer: @io::Writer) { writer.write([0x1bu8, '[' as u8]); }
47-
4846
pub struct Terminal {
4947
color_supported: bool,
5048
priv out: @io::Writer,
@@ -75,12 +73,20 @@ pub impl Terminal {
7573
return Ok(Terminal {out: out, ti: inf, color_supported: cs});
7674
}
7775
fn fg(&self, color: u8) {
78-
self.out.write(expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(), [Number(color as int)], [], []));
76+
if self.color_supported {
77+
self.out.write(expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
78+
[Number(color as int)], [], []));
79+
}
7980
}
8081
fn bg(&self, color: u8) {
81-
self.out.write(expand(*self.ti.strings.find_equiv(&("setab")).unwrap(), [Number(color as int)], [], []));
82+
if self.color_supported {
83+
self.out.write(expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
84+
[Number(color as int)], [], []));
85+
}
8286
}
8387
fn reset(&self) {
84-
self.out.write(expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []));
88+
if self.color_supported {
89+
self.out.write(expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []));
90+
}
8591
}
8692
}

0 commit comments

Comments
 (0)