@text[y][x] = ' '
@attributes[y][x] = 0x07
- # delete chars (I think this shouldn't move the cursor)
+ # delete chars (without moving the cursor)
csi_X: (chars) ->
chars = parseInt @fix_esc_arg chars, '1'
x = @x
@attributes[@y][x] = @a
x += 1
return
+ "csi_@": (chars) ->
+ chars = parseInt @fix_esc_arg chars, '1'
+ if chars < 1
+ return
+ if chars > @width - @x
+ chars = @width - @x
+ else
+ dest = @width - 1
+ if dest >= @width
+ dest = @width - 1
+ while dest - chars >= @x
+ @text[@y][dest] = @text[@y][dest - chars]
+ @attributes[@y][dest] = @attributes[@y][dest - chars]
+ dest -= 1
+ @csi_X chars # clear
+ csi_P: (chars) ->
+ chars = parseInt @fix_esc_arg chars, '1'
+ if chars < 1
+ return
+ if chars > @width - @x
+ chars = @width - @x
+ else
+ dest = @x
+ while dest < @width - chars
+ @text[@y][dest] = @text[@y][dest + chars]
+ @attributes[@y][dest] = @attributes[@y][dest + chars]
+ dest += 1
+ # clear the space moved out of
+ x = @width - chars
+ while x < @width
+ @text[@y][x] = ' '
+ @attributes[@y][x] = @a
+ x += 1
+ # set modes not starting with "?"
+ csi_h: (args...) ->
+ for i in args
+ arg = @fix_esc_arg i, ''
+ switch arg
+ when '0' # error (ignored
+ return
+ when '2' # KAM -- keyboard action
+ return
+ when '4' # put cursor in "INSERT" mode
+ return
+ when '12' # turn local echo off (or on?)
+ return
+ # TODO when '20' LNM linefeed/newline
+ else
+ log "Unimplemented arg for csi_h: #{arg}"
# set modes starting with "?"
- csiq_h: ->
- args = []
- for i in arguments
+ csiq_h: (args...) ->
+ for i in args
arg = @fix_esc_arg i, ''
switch arg
when '1' # mode ?1
for i in arguments
arg = @fix_esc_arg i, ''
switch arg
- when '0'
- # error (ignored
+ when '0' # error (ignored
return
- when '2'
- # KAM -- keyboard action
+ when '2' # KAM -- keyboard action
return
- when '4'
- # put cursor in "REPLACE" mode
+ when '4' # put cursor in "REPLACE" mode
return
- when '12'
- # turn local echo on (or off?)
+ when '12' # turn local echo on (or off?)
return
# TODO when '20' LNM linefeed/newline
# "The auxiliary keypad keys will transmit control sequences."
"esc_=": ->
- # esc (
+ # esc )
"esc_)": ->
@alternate_charset = true
# esc ( 0