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)
redraw_again = false
redraw_now = ->
$body.children().remove()
+ # cursor can be just off the right side, but we draw it on the last column in that case
+ if term.x >= term.width
+ cursor_x = term.width - 1
+ else
+ cursor_x = term.x
+ # invert the cursor TODO: make it blink
+ if term.cursor_visible
+ term.attributes[term.y][cursor_x] ^= 0x080000
for i in [0...term.text.length]
div = $('<div>')
txt = ''
if txt.length
div.append(stylize(txt, a))
$body.append(div)
+ if term.cursor_visible
+ term.attributes[term.y][cursor_x] ^= 0x080000
# limit to 50fps
redraw = ->
term.a = v.a
term.text = v.text
term.attributes = v.attributes
+ term.cursor_visible = v.cursor_visible
+ term.scroll_top = v.scroll_top
+ term.scroll_bottom = v.scroll_bottom
redraw()