summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Martínez <lkaezadl3@yahoo.com>2016-11-29 16:45:59 -0300
committerDiego Martínez <kaeza@users.noreply.github.com>2016-11-29 17:35:40 -0300
commit2ea417fad0e09c43b1e3ad31924eb2d27b8876f6 (patch)
tree9c85e211fd3ac4811b054cf2a446260a4f055f09
parentbe00ffe9139491bada62bed126d021c2477e3a4a (diff)
Search when ENTER is pressed on the search field.
-rw-r--r--callbacks.lua3
-rw-r--r--internal.lua2
2 files changed, 4 insertions, 1 deletions
diff --git a/callbacks.lua b/callbacks.lua
index 7240814..e6ea3e7 100644
--- a/callbacks.lua
+++ b/callbacks.lua
@@ -154,7 +154,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
- if fields.searchbutton then
+ if fields.searchbutton
+ or fields.key_enter_field == "searchbox" then
unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange")
unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name])
diff --git a/internal.lua b/internal.lua
index f143355..5732971 100644
--- a/internal.lua
+++ b/internal.lua
@@ -182,6 +182,8 @@ function unified_inventory.get_formspec(player, page)
n = n+1
-- Search box
+ formspec[n] = "field_close_on_enter[searchbox;false]"
+ n = n+1
if not draw_lite_mode then
formspec[n] = "field[9.5,8.325;3,1;searchbox;;"