Skip to content

Commit 7c9dfe3

Browse files
committed
---
yaml --- r: 147389 b: refs/heads/try2 c: 20f13b2 h: refs/heads/master i: 147387: d00e119 v: v3
1 parent 1030212 commit 7c9dfe3

File tree

4 files changed

+30
-48
lines changed

4 files changed

+30
-48
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 765bc9064f9b38ae227a2c61a8ed34f67f0afd0f
8+
refs/heads/try2: 20f13b228f5e5cc10e19c045a0dd52ec29b6cc45
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/etc/ctags.rust

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
--regex-Rust=/^[ \t]*(pub[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\2/f,functions,function definitions/
44
--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/
55
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
6-
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
76
--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/
87
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
98
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
109
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
1110
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]+<.*>)?[ \t]+([a-zA-Z0-9_]+)/\3/i,impls,trait implementations/
12-
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\2/d,macros,macro definitions/
11+
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/

branches/try2/src/libextra/term.rs

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
use std::io::{Decorator, Writer};
1717

18-
#[cfg(not(target_os = "win32"))] use std::os;
19-
#[cfg(not(target_os = "win32"))] use terminfo::*;
20-
#[cfg(not(target_os = "win32"))] use terminfo::searcher::open;
21-
#[cfg(not(target_os = "win32"))] use terminfo::parser::compiled::parse;
22-
#[cfg(not(target_os = "win32"))] use terminfo::parm::{expand, Number, Variables};
18+
use std::os;
19+
use terminfo::*;
20+
use terminfo::searcher::open;
21+
use terminfo::parser::compiled::{parse, msys_terminfo};
22+
use terminfo::parm::{expand, Number, Variables};
2323

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

@@ -74,7 +74,6 @@ pub mod attr {
7474
}
7575
}
7676

77-
#[cfg(not(target_os = "win32"))]
7877
fn cap_for_attr(attr: attr::Attr) -> &'static str {
7978
match attr {
8079
attr::Bold => "bold",
@@ -93,29 +92,24 @@ fn cap_for_attr(attr: attr::Attr) -> &'static str {
9392
}
9493
}
9594

96-
#[cfg(not(target_os = "win32"))]
9795
pub struct Terminal<T> {
9896
priv num_colors: u16,
9997
priv out: T,
10098
priv ti: ~TermInfo
10199
}
102100

103-
#[cfg(target_os = "win32")]
104-
pub struct Terminal<T> {
105-
priv num_colors: u16,
106-
priv out: T,
107-
}
108-
109-
#[cfg(not(target_os = "win32"))]
110101
impl<T: Writer> Terminal<T> {
111102
pub fn new(out: T) -> Result<Terminal<T>, ~str> {
112-
let term = os::getenv("TERM");
113-
if term.is_none() {
114-
return Err(~"TERM environment variable undefined");
115-
}
103+
let term = match os::getenv("TERM") {
104+
Some(t) => t,
105+
None => return Err(~"TERM environment variable undefined")
106+
};
116107

117-
let entry = open(term.unwrap());
108+
let entry = open(term);
118109
if entry.is_err() {
110+
if "cygwin" == term { // msys terminal
111+
return Ok(Terminal {out: out, ti: msys_terminfo(), num_colors: 8});
112+
}
119113
return Err(entry.unwrap_err());
120114
}
121115

@@ -241,32 +235,6 @@ impl<T: Writer> Terminal<T> {
241235
}
242236
}
243237

244-
#[cfg(target_os = "win32")]
245-
impl<T: Writer> Terminal<T> {
246-
pub fn new(out: T) -> Result<Terminal<T>, ~str> {
247-
return Ok(Terminal {out: out, num_colors: 0});
248-
}
249-
250-
pub fn fg(&mut self, _color: color::Color) -> bool {
251-
false
252-
}
253-
254-
pub fn bg(&mut self, _color: color::Color) -> bool {
255-
false
256-
}
257-
258-
pub fn attr(&mut self, _attr: attr::Attr) -> bool {
259-
false
260-
}
261-
262-
pub fn supports_attr(&self, _attr: attr::Attr) -> bool {
263-
false
264-
}
265-
266-
pub fn reset(&self) {
267-
}
268-
}
269-
270238
impl<T: Writer> Decorator<T> for Terminal<T> {
271239
fn inner(self) -> T {
272240
self.out

branches/try2/src/libextra/terminfo/parser/compiled.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,21 @@ pub fn parse(file: &mut io::Reader,
316316
Ok(~TermInfo {names: term_names, bools: bools_map, numbers: numbers_map, strings: string_map })
317317
}
318318

319+
/// Create a dummy TermInfo struct for msys terminals
320+
pub fn msys_terminfo() -> ~TermInfo {
321+
let mut strings = HashMap::new();
322+
strings.insert(~"sgr0", bytes!("\x1b[0m").to_owned());
323+
strings.insert(~"bold", bytes!("\x1b[1m;").to_owned());
324+
strings.insert(~"setaf", bytes!("\x1b[3%p1%dm").to_owned());
325+
strings.insert(~"setab", bytes!("\x1b[4%p1%dm").to_owned());
326+
~TermInfo {
327+
names: ~[~"cygwin"], // msys is a fork of an older cygwin version
328+
bools: HashMap::new(),
329+
numbers: HashMap::new(),
330+
strings: strings
331+
}
332+
}
333+
319334
#[cfg(test)]
320335
mod test {
321336
use super::*;

0 commit comments

Comments
 (0)