# File ext/widgets.rb, line 22
  def onKeyUp(key)
    if key==Gosu::Button::KbDelete or key==Gosu::Button::KbBackspace
      thisline=@text[@line]
      if @textm and thisline.length>0
        @text[@line]=thisline.slice(0,thisline.length-1)
      elsif thisline.length>3
        @text[@line]=thisline.slice(0,thisline.length-1)
      end
    elsif key==Gosu::Button::KbEscape or $window.button_id_to_char(key) == '`'
      sleep
    elsif key==Gosu::Button::KbReturn or key==Gosu::Button::KbEnter
      if @textm
        if @text[@line]=="/endtext"
          @textm=false
          @line+=1
          @text[@line]=">> "
        else
          @line+=1
          @text[@line]=""
        end
        return
      end
      @oldtext.push @text[@line]
      cmd=@text[@line].slice(3,@text[@line].length-3)
      if cmd.slice(cmd.size-3,3)=="/nl"
        @text[@line]=@text[@line].slice(0,@text[@line].length-3)
        @text[@line+1]="|> "
        @line+=1
      else
        runcmd(cmd)
      end
      @vline=@oldtext.size
    elsif key==Gosu::Button::KbUp
      if @vline-1 >= 0 and 
        @vline-=1
        @text[@line]=@oldtext[@vline]
      end
    elsif key==Gosu::Button::KbDown
      if @vline+1 < @oldtext.size and 
        @vline+=1
        @text[@line]=@oldtext[@vline]
      end
    end
  end