From: Jason Woofenden Date: Thu, 31 Jan 2013 23:51:45 +0000 (-0500) Subject: add csi_L (scroll backwards) X-Git-Tag: v1.0~16 X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=commitdiff_plain;h=76783fcb11598fc03ae5cc8381bb4df5811f7ffd add csi_L (scroll backwards) --- diff --git a/terminal.coffee b/terminal.coffee index 721ed80..4aa522c 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -233,6 +233,30 @@ class Terminal 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 = []