+ else
+ console.log "confusing arg for csi_K: #{direction}"
+ return
+
+ # misc
+ csiq_h: ->
+ args = []
+ for i in arguments
+ arg = @fix_esc_arg i, ''
+ switch arg
+ when '25'
+ @cursor_visible = true
+ when '1049'
+ if @saved_normal_screen?
+ console.log "ignoring request to switch to the alt screen because we're already on the alt screen"
+ return
+ @saved_normal_screen = [@x, @y, @text, @attributes]
+ @text = []
+ @attributes = []
+ for y in [0...@height]
+ @text[y] = []
+ @attributes[y] = []
+ for x in [0...@width]
+ @text[y].push ' '
+ @attributes[y].push 0x07
+ else
+ console.log "confusing arg for csiq_h: #{arg}"
+ return
+
+ # unmisc
+ csiq_l: ->
+ args = []
+ for i in arguments
+ arg = @fix_esc_arg i, ''
+ switch arg
+ when '25'
+ @cursor_visible = false
+ when '1049'
+ if not @saved_normal_screen?
+ console.log "ignoring request to switch to the normal screen because we're already on the normal screen"
+ return
+ @x = @saved_normal_screen[0]
+ @y = @saved_normal_screen[1]
+ @text = @saved_normal_screen[2]
+ @attributes = @saved_normal_screen[3]
+ @saved_normal_screen = null
+ else
+ console.log "confusing arg for csiq_l: #{arg}"
+ return