Method: Muby::InputWindow#handle

Defined in:
lib/muby/inputwindow.rb

#handle(c, hash) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/muby/inputwindow.rb', line 151

def handle(c, hash)
  # Echo the keycode we got if we have conf.echo_keycodes == true (good for setting up conf.key_commands)
  if conf.echo_keycodes && c != Ncurses.const_get("ERR")
    info(c.to_s)
  end
  if hash.include?(c)
    value = hash[c]
    if Hash === value
      c = @inputWindow.wgetch
      if value.include?(c)
        handle(c, value)
      else
        handle(c, conf.key_commands)
      end
    else
      execute(value, self, Muby::OutputWindow.get_instance, c)
    end
  elsif 0 < c && c < 265
    method = self.method(@handle_mode)
    method.call(c)
  end
end