diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-06-14 13:02:24 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-06-14 13:03:42 -0700 |
| commit | da4e614742ea67677ed122985c1730590748d788 (patch) | |
| tree | 6254e188a5b610b2223646d61f4b81a133b8066f /src | |
| parent | f31767df66b9468cea81a3aceb34633fad213d67 (diff) | |
| download | rust-da4e614742ea67677ed122985c1730590748d788.tar.gz rust-da4e614742ea67677ed122985c1730590748d788.zip | |
Fix line lengths in terminfo
Diffstat (limited to 'src')
| -rw-r--r-- | src/libextra/term.rs | 3 | ||||
| -rw-r--r-- | 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 @@ impl Terminal { } 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] |
