Use env for terminal size in redox
Undo color changes to test redox 256 color support Get terminal size for Redox's kernel terminal Use env for terminal size in redox
This commit is contained in:
parent
cd59514615
commit
f5936c0035
|
@ -96,13 +96,6 @@ pub trait TermWrite {
|
|||
/// Set foreground color.
|
||||
fn color(&mut self, color: Color) -> io::Result<usize> {
|
||||
let ansi = color.to_ansi_val();
|
||||
if ansi <= 7 {
|
||||
self.csi(&[
|
||||
b'3',
|
||||
b'0' + ansi,
|
||||
b'm',
|
||||
])
|
||||
} else {
|
||||
self.csi(&[
|
||||
b'3',
|
||||
b'8',
|
||||
|
@ -115,18 +108,9 @@ pub trait TermWrite {
|
|||
b'm',
|
||||
])
|
||||
}
|
||||
}
|
||||
/// Set background color.
|
||||
fn bg_color(&mut self, color: Color) -> io::Result<usize> {
|
||||
let ansi = color.to_ansi_val();
|
||||
|
||||
if ansi <= 7 {
|
||||
self.csi(&[
|
||||
b'4',
|
||||
b'0' + ansi,
|
||||
b'm',
|
||||
])
|
||||
} else {
|
||||
self.csi(&[
|
||||
b'4',
|
||||
b'8',
|
||||
|
@ -139,7 +123,6 @@ pub trait TermWrite {
|
|||
b'm',
|
||||
])
|
||||
}
|
||||
}
|
||||
/// Set rendition mode (SGR).
|
||||
fn style(&mut self, mode: Style) -> io::Result<usize> {
|
||||
self.rendition(mode as u8)
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
//! This crate is not stable, yet. However, if you do want stability, you should specify the
|
||||
//! revision (commit hash) in your `Cargo.toml`, this way builds are complete reproducible, and won't
|
||||
//! break.
|
||||
|
||||
#![cfg_attr(feature = "nightly",
|
||||
feature(io))]
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
|
||||
|
|
15
src/size.rs
15
src/size.rs
|
@ -48,21 +48,12 @@ pub fn terminal_size() -> io::Result<(usize, usize)> {
|
|||
/// Get the size of the terminal.
|
||||
#[cfg(target_os = "redox")]
|
||||
pub fn terminal_size() -> io::Result<(usize, usize)> {
|
||||
/*
|
||||
fn get_int(s: &'static str) -> io::Result<usize> {
|
||||
use std::env;
|
||||
|
||||
env::var(s).map_err(|e| match e {
|
||||
env::VarError::NotPresent => io::Error::new(io::ErrorKind::NotFound, e),
|
||||
env::VarError::NotUnicode(u) => io::Error::new(io::ErrorKind::InvalidData, u),
|
||||
}).and_then(|x| {
|
||||
x.parse().map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
|
||||
})
|
||||
}
|
||||
let width = env::var("COLUMNS").unwrap_or(String::new()).parse::<usize>().unwrap_or(0);
|
||||
let height = env::var("LINES").unwrap_or(String::new()).parse::<usize>().unwrap_or(0);
|
||||
|
||||
Ok((try!(get_int("COLUMNS")), try!(get_int("LINES"))))
|
||||
*/
|
||||
Ok((128,48))
|
||||
Ok((width, height))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in New Issue