about summary refs log tree commit diff
path: root/src/libterm
diff options
context:
space:
mode:
authorVadim Chugunov <vadimcn@gmail.com>2014-10-30 17:26:07 -0700
committerVadim Chugunov <vadimcn@gmail.com>2014-10-30 18:01:02 -0700
commite23f5c8e2630fc9df7e54911eae0746edccd30aa (patch)
treeddd8019e3027d745d11a850eb2027b2b77cf076a /src/libterm
parentfd53657484d78d0b7c00ce3264d99c051cf07d26 (diff)
downloadrust-e23f5c8e2630fc9df7e54911eae0746edccd30aa.tar.gz
rust-e23f5c8e2630fc9df7e54911eae0746edccd30aa.zip
Really fix #17982 this time.
Diffstat (limited to 'src/libterm')
-rw-r--r--src/libterm/win.rs9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libterm/win.rs b/src/libterm/win.rs
index 7ce6fb658b5..9a67ee8836b 100644
--- a/src/libterm/win.rs
+++ b/src/libterm/win.rs
@@ -71,8 +71,7 @@ fn color_to_bits(color: color::Color) -> u16 {
 }
 
 fn bits_to_color(bits: u16) -> color::Color {
-    let bits = bits & 0x7;
-    let color = match bits {
+    let color = match bits & 0x7 {
         0 => color::BLACK,
         0x1 => color::BLUE,
         0x2 => color::GREEN,
@@ -84,11 +83,7 @@ fn bits_to_color(bits: u16) -> color::Color {
         _ => unreachable!()
     };
 
-    if bits >= 8 {
-        color | 0x8
-    } else {
-        color
-    }
+    color | (bits & 0x8) // copy the hi-intensity bit
 }
 
 impl<T: Writer+Send> WinConsole<T> {