def ORIGkeycode_tos keycode # {{{
        $log.warn "XXX:  keycode_tos please move to window.key_tos"
        case keycode
        when 33..126
          return keycode.chr
        when ?\C-a.getbyte(0) .. ?\C-z.getbyte(0)
          return "C-" + (keycode + ?a.getbyte(0) -1).chr 
        when ?\M-A.getbyte(0)..?\M-z.getbyte(0)
          return "M-"+ (keycode - 128).chr
        when ?\M-\C-A.getbyte(0)..?\M-\C-Z.getbyte(0)
          return "M-C-"+ (keycode - 32).chr
        when ?\M-0.getbyte(0)..?\M-9.getbyte(0)
          return "M-"+ (keycode-?\M-0.getbyte(0)).to_s
        when 32
          return "space" # changed to lowercase so consistent
        when 27
          return "esc" # changed to lowercase so consistent
        when ?\C-].getbyte(0)
          return "C-]"
        when 258
          return "down"
        when 259
          return "up"
        when 260
          return "left"
        when 261
          return "right"
        when FFI::NCurses::KEY_F1..FFI::NCurses::KEY_F12
          return "F"+ (keycode-264).to_s
        when 330
          return "delete"
        when 127
          return "bs"
        when 353
          return "btab"
        when 481
          return "M-S-tab"
        when 393..402
          return "M-F"+ (keycode-392).to_s
        when 0
          return "C-space" 
        when 160
          return "M-space" # at least on OSX Leopard now (don't remember this working on PPC)
        when C_LEFT
          return "C-left"
        when C_RIGHT
          return "C-right"
        when S_F9
          return "S_F9"
        else
          others=[?\M--,?\M-+,?\M-=,?\M-',?\M-",?\M-;,?\M-:,?\M-\,, ?\M-.,?\M-<,?\M->,?\M-?,?\M-/,?\M-!]
          others.collect! {|x| x.getbyte(0)  }  ## added 2009-10-04 14:25 for 1.9
          s_others=%w[M-- M-+ M-= M-' M-"   M-;   M-:   M-, M-. M-< M-> M-? M-/ M-!]
          if others.include? keycode
            index = others.index keycode
            return s_others[index]
          end
          # all else failed
          return keycode.to_s
        end
      end
def ORIGkeycode_tos keycode # {{{
        $log.warn "XXX:  keycode_tos please move to window.key_tos"
        case keycode
        when 33..126
          return keycode.chr
        when ?\C-a.getbyte(0) .. ?\C-z.getbyte(0)
          return "C-" + (keycode + ?a.getbyte(0) -1).chr 
        when ?\M-A.getbyte(0)..?\M-z.getbyte(0)
          return "M-"+ (keycode - 128).chr
        when ?\M-\C-A.getbyte(0)..?\M-\C-Z.getbyte(0)
          return "M-C-"+ (keycode - 32).chr
        when ?\M-0.getbyte(0)..?\M-9.getbyte(0)
          return "M-"+ (keycode-?\M-0.getbyte(0)).to_s
        when 32
          return "space" # changed to lowercase so consistent
        when 27
          return "esc" # changed to lowercase so consistent
        when ?\C-].getbyte(0)
          return "C-]"
        when 258
          return "down"
        when 259
          return "up"
        when 260
          return "left"
        when 261
          return "right"
        when FFI::NCurses::KEY_F1..FFI::NCurses::KEY_F12
          return "F"+ (keycode-264).to_s
        when 330
          return "delete"
        when 127
          return "bs"
        when 353
          return "btab"
        when 481
          return "M-S-tab"
        when 393..402
          return "M-F"+ (keycode-392).to_s
        when 0
          return "C-space" 
        when 160
          return "M-space" # at least on OSX Leopard now (don't remember this working on PPC)
        when C_LEFT
          return "C-left"
        when C_RIGHT
          return "C-right"
        when S_F9
          return "S_F9"
        else
          others=[?\M--,?\M-+,?\M-=,?\M-',?\M-",?\M-;,?\M-:,?\M-\,, ?\M-.,?\M-<,?\M->,?\M-?,?\M-/,?\M-!]
          others.collect! {|x| x.getbyte(0)  }  ## added 2009-10-04 14:25 for 1.9
          s_others=%w[M-- M-+ M-= M-' M-"   M-;   M-:   M-, M-. M-< M-> M-? M-/ M-!]
          if others.include? keycode
            index = others.index keycode
            return s_others[index]
          end
          # all else failed
          return keycode.to_s
        end
      end
needs to move to a keystroke class
 please use these only for printing or debugging, not comparing
 I could soon return symbols instead 2010-09-07 14:14
 @deprecated
 Please move to window.key_tos