Skip to content

Commit 265f2db

Browse files
committed
---
yaml --- r: 65487 b: refs/heads/master c: 100ee84 h: refs/heads/master i: 65485: 8095580 65483: 9486463 65479: 6c9c7e5 65471: c0b7bd9 v: v3
1 parent 139f467 commit 265f2db

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,5 +1,5 @@
11
---
2-
refs/heads/master: 1f27c6306d9f376f9b629a98f8a57c2e43e59b41
2+
refs/heads/master: 100ee8409789edb290a1d3309f70286c6a799a7c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/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)