X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=blobdiff_plain;f=client.coffee;h=14e5a6fab510dd4dac14c5e5c3ad184e8dce852f;hp=c14c42657114c9a21f815ab8f8e853d634c7c931;hb=469415c385464dc424c37f4602bf59233bbaa738;hpb=5a99a6ff19d3eed9231a9820bcd76bb824eb6d32 diff --git a/client.coffee b/client.coffee index c14c426..14e5a6f 100644 --- a/client.coffee +++ b/client.coffee @@ -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,5 @@ $ -> term.a = v.a term.text = v.text term.attributes = v.attributes + term.cursor_visible = v.cursor_visible redraw()