Skip to content

Commit

Permalink
fixed lua bug that caused e.g. hop java to sometimes hop to javascr…
Browse files Browse the repository at this point in the history
…ipt even if java was a key
  • Loading branch information
Colin Morris committed May 15, 2013
1 parent a66f820 commit 3e1b8e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hop/hop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ Hop.hop = function(request)
local results = Hop.search(request)
local value
local key
for k, p in pairs(results) do key = k; value = p break end
-- prefer an exact match if possible
if results[request] ~= nil
then
key = request
value = results[request]
else
for k, p in pairs(results) do key = k; value = p break end
end
if not (value)
then
print ('No value for ' .. request)
Expand Down Expand Up @@ -124,4 +131,4 @@ Hop.dispatch = function(argv)

end

Hop.dispatch(arg)
Hop.dispatch(arg)

0 comments on commit 3e1b8e6

Please sign in to comment.