X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=blobdiff_plain;f=terminal.coffee;h=e5a404fe698b9932b5f94c7292471752797e586f;hp=141165b85b73ce74848efb1c3ef3f522a9b5d02a;hb=3fbdc55777e4eaa22c12340eb2f065e991ac4522;hpb=0777de8703279b080aaeed70ae6dcaa0c7257135 diff --git a/terminal.coffee b/terminal.coffee index 141165b..e5a404f 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -249,6 +249,27 @@ class Terminal @text[y][x] = ' ' @attributes[y][x] = 0x07 + # move lines upwards (arg is how far) + # this obliterates the line under the cursor and arg-1 following it + csi_M: (lines) -> + lines = parseInt @fix_esc_arg lines, '1' + + rearrange = (a) => + return [ + a[0 ... @y]..., # keep everything above cursor + a[@y + lines .. @scroll_bottom]..., # lines we're moving up + a[@y ... @y + lines]..., # recycle these + a[@scroll_bottom + 1 ... @height]... # keep the rest + ] + @text = rearrange @text + @attributes = rearrange @attributes + + # clear the lines we're recycling + for y in [@scroll_bottom - lines + 1 .. @scroll_bottom] + for x in [0...@width] + @text[y][x] = ' ' + @attributes[y][x] = 0x07 + # misc csiq_h: -> args = []