Skip to content

Commit da4e614

Browse files
committed
Fix line lengths in terminfo
1 parent f31767d commit da4e614

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/libextra/term.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ impl Terminal {
105105
}
106106
pub fn reset(&self) {
107107
if self.color_supported {
108-
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut Variables::new());
108+
let mut vars = Variables::new();
109+
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], &mut vars);
109110
if s.is_ok() {
110111
self.out.write(s.get());
111112
} else {

src/libextra/terminfo/parm.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,22 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
176176
} else { return Err(~"stack is empty") },
177177
'=' => if stack.len() > 1 {
178178
match (stack.pop(), stack.pop()) {
179-
(Number(y), Number(x)) => stack.push(Number(if x == y { 1 } else { 0 })),
179+
(Number(y), Number(x)) => stack.push(Number(if x == y { 1 }
180+
else { 0 })),
180181
_ => return Err(~"non-numbers on stack with =")
181182
}
182183
} else { return Err(~"stack is empty") },
183184
'>' => if stack.len() > 1 {
184185
match (stack.pop(), stack.pop()) {
185-
(Number(y), Number(x)) => stack.push(Number(if x > y { 1 } else { 0 })),
186+
(Number(y), Number(x)) => stack.push(Number(if x > y { 1 }
187+
else { 0 })),
186188
_ => return Err(~"non-numbers on stack with >")
187189
}
188190
} else { return Err(~"stack is empty") },
189191
'<' => if stack.len() > 1 {
190192
match (stack.pop(), stack.pop()) {
191-
(Number(y), Number(x)) => stack.push(Number(if x < y { 1 } else { 0 })),
193+
(Number(y), Number(x)) => stack.push(Number(if x < y { 1 }
194+
else { 0 })),
192195
_ => return Err(~"non-numbers on stack with <")
193196
}
194197
} else { return Err(~"stack is empty") },
@@ -353,12 +356,14 @@ mod test {
353356
#[test]
354357
fn test_basic_setabf() {
355358
let s = bytes!("\\E[48;5;%p1%dm");
356-
assert_eq!(expand(s, [Number(1)], &mut Variables::new()).unwrap(), bytes!("\\E[48;5;1m").to_owned());
359+
assert_eq!(expand(s, [Number(1)], &mut Variables::new()).unwrap(),
360+
bytes!("\\E[48;5;1m").to_owned());
357361
}
358362

359363
#[test]
360364
fn test_multiple_int_constants() {
361-
assert_eq!(expand(bytes!("%{1}%{2}%d%d"), [], &mut Variables::new()).unwrap(), bytes!("21").to_owned());
365+
assert_eq!(expand(bytes!("%{1}%{2}%d%d"), [], &mut Variables::new()).unwrap(),
366+
bytes!("21").to_owned());
362367
}
363368

364369
#[test]

0 commit comments

Comments
 (0)