$body = $('body')
$body.css backgroundColor: "##{palette[0]}", color: "##{palette[7]}"
- socket = io.connect('http://localhost')
+ socket = io.connect('/')
color_to_css = (i) ->
# handle inverse bit
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 = ->
socket.on 'init', (v) ->
term = terminal.new(v.width, v.height)
- term.x = v.x
- term.y = v.y
- term.a = v.a
- term.text = v.text
- term.attributes = v.attributes
- redraw()
+ update v.text