JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
add csi_r (scrolling region)
[watch-my-terminal.git] / client.coffee
index c14c426..3cc8c87 100644 (file)
@@ -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 = $('<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()