From: Jason Woofenden Date: Thu, 31 Jan 2013 03:44:13 +0000 (-0500) Subject: add csi_J, fix csi_K(2) X-Git-Tag: v1.0~29 X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=commitdiff_plain;h=17c9edab23a2371d7b553aa5d0ffe8f1d41b0bc1 add csi_J, fix csi_K(2) --- diff --git a/terminal.coffee b/terminal.coffee index 11c79e0..f3ed817 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -125,6 +125,27 @@ class Terminal 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' @@ -136,10 +157,12 @@ class Terminal 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: ->