From 11f31b96848c7d04f79e6aaa2c789857bb224526 Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Fri, 31 May 2013 13:37:58 -0400 Subject: [PATCH] Fix formatting for tidy --- src/libextra/term.rs | 3 ++- src/libextra/terminfo/parm.rs | 2 +- src/libextra/terminfo/parser/compiled.rs | 22 +++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/libextra/term.rs b/src/libextra/term.rs index 26a9e568e613..e74a0f4e18e1 100644 --- a/src/libextra/term.rs +++ b/src/libextra/term.rs @@ -75,7 +75,8 @@ pub impl Terminal { } let mut inf = ti.get(); - let cs = *inf.numbers.find_or_insert(~"colors", 0) >= 16 && inf.strings.find(&~"setaf").is_some() + let cs = *inf.numbers.find_or_insert(~"colors", 0) >= 16 + && inf.strings.find(&~"setaf").is_some() && inf.strings.find_equiv(&("setab")).is_some(); return Ok(Terminal {out: out, ti: inf, color_supported: cs}); diff --git a/src/libextra/terminfo/parm.rs b/src/libextra/terminfo/parm.rs index aee4b4494499..fd0511727922 100644 --- a/src/libextra/terminfo/parm.rs +++ b/src/libextra/terminfo/parm.rs @@ -46,7 +46,7 @@ pub enum Param { To be compatible with ncurses, `sta` and `dyn` should be the same between calls to `expand` for multiple capabilities for the same terminal. */ -pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Param]) +pub fn expand(cap: &[u8], params: &mut [Param], sta: &mut [Param], dyn: &mut [Param]) -> Result<~[u8], ~str> { assert!(cap.len() != 0, "expanding an empty capability makes no sense"); assert!(params.len() <= 9, "only 9 parameters are supported by capability strings"); diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index e63ec1ab5f99..03fbfc2dbff9 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -1,3 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + /// ncurses-compatible compiled terminfo format parsing (term(5)) use core::prelude::*; @@ -283,11 +293,12 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { // Find the offset of the NUL we want to go to - let nulpos = vec::position_between(string_table, offset as uint, string_table_bytes as uint, - |&b| b == 0); + let nulpos = vec::position_between(string_table, offset as uint, + string_table_bytes as uint, |&b| b == 0); match nulpos { Some(x) => { - string_map.insert(name.to_owned(), string_table.slice(offset as uint, x).to_owned()) + string_map.insert(name.to_owned(), + string_table.slice(offset as uint, x).to_owned()) }, None => { return Err(~"invalid file: missing NUL in string_table"); @@ -303,7 +314,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> { #[cfg(test)] mod test { use super::*; - use p = std::path::PosixPath; + use p = std::path::Path; #[test] fn test_veclens() { @@ -314,6 +325,7 @@ mod test { #[test] fn test_parse() { - parse(io::file_reader(&p("/usr/share/terminfo/r/rxvt-256color")).unwrap(), false); + // FIXME #6870: Distribute a compiled file in src/tests and test there + // parse(io::file_reader(&p("/usr/share/terminfo/r/rxvt-256color")).unwrap(), false); } }