console.log "confusing arg for csi_K: #{direction}"
return
+ # move lines downwards (arg is how far)
+ csi_L: (lines) ->
+ lines = parseInt @fix_esc_arg lines, '1'
+
+ # move (newly cleared) top line to the bottom of the scrolling region
+ @text = [
+ @text[0...@y]..., # keep everything above cursor
+ @text[@scroll_bottom - lines + 1 .. @scroll_bottom]..., # we'll clear these shortly
+ @text[@y..@scroll_bottom - lines]..., # lines that are moving down
+ @text[@scroll_bottom + 1 ... @height]... # rest of screen
+ ]
+ @attributes = [
+ @attributes[0...@y]..., # keep everything above cursor
+ @attributes[@scroll_bottom - lines + 1 .. @scroll_bottom]..., # we'll clear these shortly
+ @attributes[@y..@scroll_bottom - lines]..., # lines that are moving down
+ @attributes[@scroll_bottom + 1 ... @height]... # rest of screen
+ ]
+
+ # clear the lines we scrolled off (and put back in as "new")
+ for y in [@y...@y+lines]
+ for x in [0...@width]
+ @text[y][x] = ' '
+ @attributes[y][x] = 0x07
+
# misc
csiq_h: ->
args = []