Skip to content

Commit da42e6b

Browse files
committed
auto merge of #7133 : kballard/rust/terminfo-parm, r=thestinger
Implement conditional support in terminfo, along with a few other related operators. Fix implementation of non-commutative arithmetic operators. Remove all known cases of task failure from `terminfo::parm::expand`, and change the method signature. Fix some other miscellaneous issues.
2 parents 83d44f8 + da4e614 commit da42e6b

File tree

2 files changed

+321
-97
lines changed

2 files changed

+321
-97
lines changed

src/libextra/term.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use core::os;
2020
use terminfo::*;
2121
use terminfo::searcher::open;
2222
use terminfo::parser::compiled::parse;
23-
use terminfo::parm::{expand, Number};
23+
use terminfo::parm::{expand, Number, Variables};
2424

2525
// FIXME (#2807): Windows support.
2626

@@ -84,7 +84,7 @@ impl Terminal {
8484
pub fn fg(&self, color: u8) {
8585
if self.color_supported {
8686
let s = expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
87-
[Number(color as int)], [], []);
87+
[Number(color as int)], &mut Variables::new());
8888
if s.is_ok() {
8989
self.out.write(s.get());
9090
} else {
@@ -95,7 +95,7 @@ impl Terminal {
9595
pub fn bg(&self, color: u8) {
9696
if self.color_supported {
9797
let s = expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
98-
[Number(color as int)], [], []);
98+
[Number(color as int)], &mut Variables::new());
9999
if s.is_ok() {
100100
self.out.write(s.get());
101101
} else {
@@ -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(), [], [], []);
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 {

0 commit comments

Comments
 (0)