X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.coffee;h=6749a602beb28792dfe5315beb2b775b850c3f44;hb=b02630f149b0cc5fa9257504a4f4c146af2e0750;hp=c14c42657114c9a21f815ab8f8e853d634c7c931;hpb=6360b697a9933ab36a683b0f443acfe227fc89ec;p=watch-my-terminal.git diff --git a/client.coffee b/client.coffee index c14c426..6749a60 100644 --- a/client.coffee +++ b/client.coffee @@ -58,7 +58,7 @@ $ -> $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 @@ -92,6 +92,14 @@ $ -> 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 = $('
') txt = '' @@ -106,6 +114,8 @@ $ -> 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 = -> @@ -136,4 +146,7 @@ $ -> 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()