diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-12 17:24:54 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-12 21:30:44 +0200 |
| commit | 3816e57fd2a8ab19e4ac6d4b3ddd5b49d5973ff2 (patch) | |
| tree | 508982ed2f789aedd89eebd529343d9dc88b8e01 /src/lib/Term.rs | |
| parent | Transitional change to make extfmt output lowercase module name (diff) | |
| download | rust-3816e57fd2a8ab19e4ac6d4b3ddd5b49d5973ff2.tar.xz rust-3816e57fd2a8ab19e4ac6d4b3ddd5b49d5973ff2.zip | |
Downcase std modules again, move to :: for module dereferencing
This should be a snapshot transition.
Diffstat (limited to 'src/lib/Term.rs')
| -rw-r--r-- | src/lib/Term.rs | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/lib/Term.rs b/src/lib/Term.rs deleted file mode 100644 index b07dcc0c..00000000 --- a/src/lib/Term.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Simple ANSI color library. -// -// TODO: Windows support. - -const u8 color_black = 0u8; -const u8 color_red = 1u8; -const u8 color_green = 2u8; -const u8 color_yellow = 3u8; -const u8 color_blue = 4u8; -const u8 color_magenta = 5u8; -const u8 color_cyan = 6u8; -const u8 color_light_gray = 7u8; -const u8 color_light_grey = 7u8; -const u8 color_dark_gray = 8u8; -const u8 color_dark_grey = 8u8; -const u8 color_bright_red = 9u8; -const u8 color_bright_green = 10u8; -const u8 color_bright_yellow = 11u8; -const u8 color_bright_blue = 12u8; -const u8 color_bright_magenta = 13u8; -const u8 color_bright_cyan = 14u8; -const u8 color_bright_white = 15u8; - -fn esc(IO.buf_writer writer) { - writer.write(vec(0x1bu8, '[' as u8)); -} - -fn reset(IO.buf_writer writer) { - esc(writer); - writer.write(vec('0' as u8, 'm' as u8)); -} - -fn color_supported() -> bool { - ret GenericOS.getenv("TERM") == Option.some[str]("xterm-color"); -} - -fn set_color(IO.buf_writer writer, u8 first_char, u8 color) { - assert (color < 16u8); - - esc(writer); - if (color >= 8u8) { - writer.write(vec('1' as u8, ';' as u8)); - color -= 8u8; - } - writer.write(vec(first_char, ('0' as u8) + color, 'm' as u8)); -} - -fn fg(IO.buf_writer writer, u8 color) { - ret set_color(writer, '3' as u8, color); -} - -fn bg(IO.buf_writer writer, u8 color) { - ret set_color(writer, '4' as u8, color); -} - -// export fg; -// export bg; - |