JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
fix ESC[0m, implement italic, render invisible
authorJason Woofenden <jason@jasonwoof.com>
Thu, 31 Jan 2013 19:59:53 +0000 (14:59 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Thu, 31 Jan 2013 20:00:30 +0000 (15:00 -0500)
client.coffee
terminal.coffee

index cf973f8..c14c426 100644 (file)
@@ -80,10 +80,10 @@ $ ->
                if (txt.length == 0 or style == 0x000007)
                        return txt
                css = ''
-               css += 'font-weight: bold; ' if style & 0x10000
-               css += 'text-decoration: underline; ' if style & 0x20000
-               css += 'font-style: italic; ' if style & 0x40000 # blink
-               css += 'text-decoration: line-through; ' if style & 0x100000 # invisible
+               css += 'font-weight: bold; ' if style & 0x010000
+               css += 'text-decoration: underline; ' if style & 0x020000
+               css += 'font-style: italic; ' if style & 0x200000 # italic
+               css += 'opacity: 0; ' if style & 0x100000 # invisible
                css += color_to_css(style) if ((style & 0x0800ff) isnt 0x07)
                css += bg_color_to_css(style) if (style & 0x08ff00)
                return $('<span style="'+css+'"></span>').text(txt)
index 0ba72f4..d6838da 100644 (file)
@@ -228,12 +228,13 @@ class Terminal
                        switch arg
                                # remove all style/color
                                when '0'
-                                       @a = 0
+                                       @a = 0x07
 
                                # style attributes
                                when '1' # bold
                                        @set_attribute_bits 0x010000, 0x010000
-                               # FIXME add '3' for italic ('23' to turn it off)
+                               when '3' # italic (rare)
+                                       @set_attribute_bits 0x200000, 0x200000
                                when '4' # underline
                                        @set_attribute_bits 0x020000, 0x020000
                                when '5' # blink
@@ -244,10 +245,12 @@ class Terminal
                                        @set_attribute_bits 0x100000, 0x100000
 
                                # disable style attributes
-                               when '22' # not bold... according to a page
+                               when '21' # not bold (rare)
                                        @set_attribute_bits 0x010000, 0
-                               when '21' # ... though this would make more sense for "not bold"
+                               when '22' # not bold
                                        @set_attribute_bits 0x010000, 0
+                               when '23' # not italic (rare)
+                                       @set_attribute_bits 0x200000, 0
                                when '24' # not underline
                                        @set_attribute_bits 0x020000, 0
                                when '25' # not blink