]> git.lizzy.rs Git - rust.git/commitdiff
Smarter warning in extra::term::Terminal.reset()
authorKevin Ballard <kevin@sb.org>
Sat, 29 Jun 2013 03:29:04 +0000 (20:29 -0700)
committerDaniel Micay <danielmicay@gmail.com>
Sat, 29 Jun 2013 05:02:07 +0000 (01:02 -0400)
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.

src/libextra/term.rs

index 880b89f2bbe17c55f9998e437743d2f42ad7ebca..d448a1588a674a3496c438543937c247c08c0f94 100644 (file)
@@ -120,13 +120,15 @@ pub fn bg(&self, color: color::Color) {
     pub fn reset(&self) {
         let mut vars = Variables::new();
         let s = do self.ti.strings.find_equiv(&("op"))
-                       .map_consume_default(Err(~"can't find op")) |&op| {
+                       .map_consume_default(Err(~"can't find terminfo capability `op`")) |&op| {
                            expand(op, [], &mut vars)
                        };
         if s.is_ok() {
             self.out.write(s.unwrap());
-        } else {
+        } else if self.num_colors > 0 {
             warn!("%s", s.unwrap_err());
+        } else {
+            debug!("%s", s.unwrap_err());
         }
     }