From: Jason Woofenden Date: Thu, 31 Jan 2013 05:20:33 +0000 (-0500) Subject: fix csi_H (off-by-one error) X-Git-Tag: v1.0~22 X-Git-Url: https://jasonwoof.com/gitweb/?p=watch-my-terminal.git;a=commitdiff_plain;h=e5cb729bf87ae7e8a3473a4527af609e49d61321;hp=4260b6a221b4d36c1611171e658243b03d597dc9 fix csi_H (off-by-one error) --- diff --git a/terminal.coffee b/terminal.coffee index 913d874..d5830c5 100644 --- a/terminal.coffee +++ b/terminal.coffee @@ -114,11 +114,9 @@ class Terminal # set cursor position (one based) csi_H: (row, column) -> - row = 0 + @fix_esc_arg row, 1 - column = 0 + @fix_esc_arg column, 1 - - # convert to 0 base - column -= 1 + # handle blank/missing args and convert to 0 base + row = @fix_esc_arg(row, 1) - 1 + column = @fix_esc_arg(column, 1) - 1 #clamp values if column < 0 @@ -160,6 +158,7 @@ class Terminal @attributes[row][i] = @a else console.log "confusing arg for csi_J: #{direction}" + return # clear (some or all of) current line csi_K: (direction) -> @@ -183,6 +182,7 @@ class Terminal @attributes[@y][i] = @a else console.log "confusing arg for csi_K: #{direction}" + return # misc csiq_h: ->