Skip to content

Commit

Permalink
fix for lua keydown events, send 'j' when ctrl+somekey is pressed, no…
Browse files Browse the repository at this point in the history
…t ^J
  • Loading branch information
jacob1 committed Jun 11, 2016
1 parent 7e4924e commit 2a541bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lua/LegacyLuaAPI.cpp
Expand Up @@ -17,6 +17,7 @@
#include "gui/dialogues/TextPrompt.h"
#include "gui/dialogues/ConfirmPrompt.h"
#include "gui/game/GameModel.h"
#include "gui/interface/Keys.h"
#include "simulation/Simulation.h"


Expand Down Expand Up @@ -440,6 +441,8 @@ int luacon_elementwrite(lua_State* l)
bool shortcuts = true;
int luacon_keyevent(int key, Uint16 character, int modifier, int event)
{
if (key == 306)
return 0;
int kycontinue = 1;
lua_State* l=luacon_ci->l;
lua_pushstring(l, "keyfunctions");
Expand All @@ -456,7 +459,10 @@ int luacon_keyevent(int key, Uint16 character, int modifier, int event)
for (int i = 1; i <= len && kycontinue; i++)
{
lua_rawgeti(l, -1, i);
lua_pushlstring(l, (const char*)&character, 1);
if ((modifier & KEY_MOD_CONTROL) && (character < ' ' || character > '~'))
lua_pushlstring(l, (const char*)&key, 1);
else
lua_pushlstring(l, (const char*)&character, 1);
lua_pushinteger(l, key);
lua_pushinteger(l, modifier);
lua_pushinteger(l, event);
Expand Down

0 comments on commit 2a541bd

Please sign in to comment.