Skip to content

Commit ee7307e

Browse files
lilyballthestinger
authored andcommitted
Smarter warning in extra::term::Terminal.reset()
Don't spew a warn!() in reset() if num_colors is 0, because non-color-supporting terminals are legit. Use debug!() there instead. Continue spewing warn!() if we believe the terminal to support colors. Use a better warning when the `op` capability can't be found.
1 parent a0c31ec commit ee7307e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libextra/term.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,15 @@ impl Terminal {
120120
pub fn reset(&self) {
121121
let mut vars = Variables::new();
122122
let s = do self.ti.strings.find_equiv(&("op"))
123-
.map_consume_default(Err(~"can't find op")) |&op| {
123+
.map_consume_default(Err(~"can't find terminfo capability `op`")) |&op| {
124124
expand(op, [], &mut vars)
125125
};
126126
if s.is_ok() {
127127
self.out.write(s.unwrap());
128-
} else {
128+
} else if self.num_colors > 0 {
129129
warn!("%s", s.unwrap_err());
130+
} else {
131+
debug!("%s", s.unwrap_err());
130132
}
131133
}
132134

0 commit comments

Comments
 (0)