summaryrefslogtreecommitdiffstats
path: root/src/cell.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cell.rs')
-rw-r--r--src/cell.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/cell.rs b/src/cell.rs
index 7032a7b..32aeeeb 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -187,7 +187,12 @@ impl Cell {
/// Apply style then call `print` to print the cell into a terminal
pub fn print_term<T: Terminal+?Sized>(&self, out: &mut T, idx: usize, col_width: usize) -> Result<(), Error> {
for a in &self.style {
- try!(out.attr(a.clone()).map_err(term_error_to_io_error));
+ match out.attr(a.clone()) {
+ Ok(ok) => ok,
+ Err(::term::Error::NotSupported) => (), // Ignore unsupported atrributes
+ Err(::term::Error::Io(why)) => return Err(why),
+ Err(e) => return Err(Error::new(::std::io::ErrorKind::Other, e))
+ };
}
try!(self.print(out, idx, col_width));
try!(out.reset().map_err(term_error_to_io_error));
@@ -195,13 +200,6 @@ impl Cell {
}
}
-fn term_error_to_io_error(te: ::term::Error) -> Error {
- match te {
- ::term::Error::Io(why) => why,
- _ => Error::new(::std::io::ErrorKind::Other, te),
- }
-}
-
impl <'a, T: ToString> From<&'a T> for Cell {
fn from(f: &T) -> Cell {
return Cell::new(&f.to_string());