Ranges in keymandorc cause crash with no explanation

5 views
Skip to first unread message

Sean Mackesey

unread,
Jan 15, 2013, 6:56:26 PM1/15/13
to keym...@googlegroups.com
I have been trying to use Keymando to create mappings to simulate Vim "normal mode" by holding down the Ctrl key.  I have an array with a bunch of hashes (vim_num_commands) representing mappings, and I was running them through some code (see below) in an attempt to do the mappings in my keymandorc.  Reloading the keymandorc with this code resulted in Keymando instantly quitting with no error message, then refusing to start again (again with no error message).  Commenting out the code would allow Keymando to start normally.

vim_num_commands.each do |cmd|
    (1..5).each do |n|
      trigger = case cmd[:trigger]
                when String then default_trigger_proc.call(n, cmd[:trigger])
                when Proc then cmd[:trigger].call(n)
                end
      action = cmd[:action].call(n)
      map trigger, action
    end
  end

I did some experimenting to see what was the problem, and I was able to isolate it to ranges.  Even this code causes the same issue:

(1..5).each do |n| end

In fact, simply putting 

(1..5) 

by itself on a line causes the same problem.  By changing (1..5) in my original code to [1, 2, 3, 4, 5] I was able to get all of my mappings to load perfectly fine.  But this seemingly arbitrary hatred of ranges led me to waste a lot of time!  Please fix.

Kevin Colyar

unread,
Jan 22, 2013, 7:35:19 PM1/22/13
to keym...@googlegroups.com
Hey Sean,

Just wanted to let you know I saw your email and I'll be looking into it.  Off the top of my head it looks like a MacRuby issue, since Keymando doesn't do any kind of monkey-patching of ranges.  However, we might have to in order to fix this.
--
Kevin Colyar
Reply all
Reply to author
Forward
0 new messages