From 76783fcb11598fc03ae5cc8381bb4df5811f7ffd Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Thu, 31 Jan 2013 18:51:45 -0500 Subject: [PATCH] add csi_L (scroll backwards) --- terminal.coffee | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 = [] -- 1.7.10.4