lib/key_map.rb
# Calls the command associated with the key.
Calls the command associated with the key.
Calls the command associated with the key .
def execute(key)
    if key == 27 then
      next_key = Curses.getch()
      if @alt_keys.has_key?(to_ord(next_key)) then
        @alt_keys[to_ord(next_key)].execute
      end
    elsif @keys.has_key?(to_ord(key)) then
      @keys[to_ord(key)].execute
    elsif @insert_key then
      if key.is_a?(String) then
        CSTE::buffer.set_line(
          CSTE::cursor.line,
          CSTE::buffer.line(CSTE::cursor.line).insert(CSTE::cursor.col, key))
        CSTE::cursor.col += 1
        CSTE::view.update_pos
      end
    end
  end
def execute ( key ) if key == 27 then next_key = Curses . getch ( ) if @alt_keys . has_key? ( to_ord ( next_key ) ) then @alt_keys [ to_ord ( next_key ) ] . execute end elsif @keys . has_key? ( to_ord ( key ) ) then @keys [ to_ord ( key ) ] . execute elsif @insert_key then if key . is_a? ( String ) then CSTE :: buffer . set_line ( CSTE :: cursor . line , CSTE :: buffer . line ( CSTE :: cursor . line ) . insert ( CSTE :: cursor . col , key ) ) CSTE :: cursor . col += 1 CSTE :: view . update_pos end end end
Calls the command associated with the key.
Calls the command associated with the key .
# If is a 'alt/esc' + somathing command. # Get the next key. # If is a command. # If is a valid character.
key