airstruck / luigi

Lovely User Interfaces for Game Inventors
MIT License
113 stars 23 forks source link

Tab key failing #41

Closed ghost closed 8 years ago

ghost commented 8 years ago

The fix for issue #37 broke the tab key from a text widget for me.

I think that the problem is a confusion on what the return type and value of the event should be, because this fixed it for me:

diff --git a/luigi/widget/text.lua b/luigi/widget/text.lua
index 23813f1..5d3482c 100644
--- a/luigi/widget/text.lua
+++ b/luigi/widget/text.lua
@@ -381,9 +381,9 @@ This color is used to indicate the selected range of text.
         local act = self.keyActions[event.key]
         if act then
             local result = act()
-            if result then return true end
+            if result then return end
         end
-        return false
+        return true
     end)

     self:onDisplay(function (event)

By type I mean that Event:emit checks explicitly for nil:

    if result ~= nil then return result end
airstruck commented 8 years ago

Whoops, good catch. Thanks for the bug reports, keep them coming :+1: