From da4e614742ea67677ed122985c1730590748d788 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Fri, 14 Jun 2013 13:02:24 -0700 Subject: [PATCH] Fix line lengths in terminfo --- src/libextra/term.rs | 3 ++- src/libextra/terminfo/parm.rs | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libextra/term.rs b/src/libextra/term.rs index f09c00ccce2..17d80ded47f 100644 --- a/src/libextra/term.rs +++ b/src/libextra/term.rs @@ -105,7 +105,8 @@ pub fn bg(&self, color: u8) { } pub fn reset(&self) { if self.color_supported { - let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut Variables::new()); + let mut vars = Variables::new(); + let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut vars); if s.is_ok() { self.out.write(s.get()); } else { diff --git a/src/libextra/terminfo/parm.rs b/src/libextra/terminfo/parm.rs index 59d34c7317b..c395b57219c 100644 --- a/src/libextra/terminfo/parm.rs +++ b/src/libextra/terminfo/parm.rs @@ -176,19 +176,22 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) } else { return Err(~"stack is empty") }, '=' => if stack.len() > 1 { match (stack.pop(), stack.pop()) { - (Number(y), Number(x)) => stack.push(Number(if x == y { 1 } else { 0 })), + (Number(y), Number(x)) => stack.push(Number(if x == y { 1 } + else { 0 })), _ => return Err(~"non-numbers on stack with =") } } else { return Err(~"stack is empty") }, '>' => if stack.len() > 1 { match (stack.pop(), stack.pop()) { - (Number(y), Number(x)) => stack.push(Number(if x > y { 1 } else { 0 })), + (Number(y), Number(x)) => stack.push(Number(if x > y { 1 } + else { 0 })), _ => return Err(~"non-numbers on stack with >") } } else { return Err(~"stack is empty") }, '<' => if stack.len() > 1 { match (stack.pop(), stack.pop()) { - (Number(y), Number(x)) => stack.push(Number(if x < y { 1 } else { 0 })), + (Number(y), Number(x)) => stack.push(Number(if x < y { 1 } + else { 0 })), _ => return Err(~"non-numbers on stack with <") } } else { return Err(~"stack is empty") }, @@ -353,12 +356,14 @@ mod test { #[test] fn test_basic_setabf() { let s = bytes!("\\E[48;5;%p1%dm"); - assert_eq!(expand(s, [Number(1)], &mut Variables::new()).unwrap(), bytes!("\\E[48;5;1m").to_owned()); + assert_eq!(expand(s, [Number(1)], &mut Variables::new()).unwrap(), + bytes!("\\E[48;5;1m").to_owned()); } #[test] fn test_multiple_int_constants() { - assert_eq!(expand(bytes!("%{1}%{2}%d%d"), [], &mut Variables::new()).unwrap(), bytes!("21").to_owned()); + assert_eq!(expand(bytes!("%{1}%{2}%d%d"), [], &mut Variables::new()).unwrap(), + bytes!("21").to_owned()); } #[test]