else
console.log "tried to move cursor to invalid row: #{row}"
+ # clear lines (implemented inclusive of the current line)
+ csi_J: (direction) ->
+ switch @fix_esc_arg direction, '0'
+ when '0' # erase down
+ for row in [@y...@height]
+ for i in [0...@width]
+ @text[row][i] = ' '
+ @attributes[row][i] = @a
+ when '1' # erase up
+ for row in [0..@y]
+ for i in [0...@width]
+ @text[row][i] = ' '
+ @attributes[row][i] = @a
+ when '2' # erase everything
+ for row in [0...@height]
+ for i in [0...@width]
+ @text[row][i] = ' '
+ @attributes[row][i] = @a
+ else
+ console.log "confusing arg for csi_J: #{direction}"
+
# clear (some or all of) current line
csi_K: (direction) ->
switch @fix_esc_arg direction, '0'
for i in [0...@x]
@text[@y][i] = ' '
@attributes[@y][i] = @a
- when '0' # erase whole line
+ when '2' # erase whole line
for i in [0...@width]
@text[@y][i] = ' '
@attributes[@y][i] = @a
+ else
+ console.log "confusing arg for csi_K: #{direction}"
# set color, bold, underline, etc
csi_m: ->