Skip to content

Commit

Permalink
auto merge of #7133 : kballard/rust/terminfo-parm, r=thestinger
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jun 15, 2013
2 parents 83d44f8 + da4e614 commit da42e6b
Show file tree
Hide file tree
Showing 2 changed files with 321 additions and 97 deletions.
9 changes: 5 additions & 4 deletions src/libextra/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use core::os;
use terminfo::*;
use terminfo::searcher::open;
use terminfo::parser::compiled::parse;
use terminfo::parm::{expand, Number};
use terminfo::parm::{expand, Number, Variables};

// FIXME (#2807): Windows support.

Expand Down Expand Up @@ -84,7 +84,7 @@ impl Terminal {
pub fn fg(&self, color: u8) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
[Number(color as int)], [], []);
[Number(color as int)], &mut Variables::new());
if s.is_ok() {
self.out.write(s.get());
} else {
Expand All @@ -95,7 +95,7 @@ impl Terminal {
pub fn bg(&self, color: u8) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
[Number(color as int)], [], []);
[Number(color as int)], &mut Variables::new());
if s.is_ok() {
self.out.write(s.get());
} else {
Expand All @@ -105,7 +105,8 @@ impl Terminal {
}
pub fn reset(&self) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []);
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 {
Expand Down
Loading

0 comments on commit da42e6b

Please sign in to comment.