Skip to content
Snippets Groups Projects
Commit 249cd5c0 authored by dg's avatar dg
Browse files

Ctrl+V is supported in the debug console

git-svn-id: http://svn.net-core.org/repos/t-engine4@4617 51575b47-30f0-44d4-a5cc-537603b46e54
parent 47fbb1df
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,13 @@ function _M:init()
self.line = self.line .. c
self.changed = true
end,
[{"_v", "ctrl"}] = function(c)
local s = core.key.getClipboard()
if s then
self.line = self.line .. s
self.changed = true
end
end,
}
-- Scroll message log
self:mouseZones{
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
startx = 39
startx = 49
starty = 47
endx = 49
endy = 47
......
......@@ -211,6 +211,31 @@ static int lua_key_unicode(lua_State *L)
return 0;
}
static int lua_key_set_clipboard(lua_State *L)
{
char *str = luaL_checkstring(L, 1);
SDL_SetClipboardText(str);
return 0;
}
static int lua_key_get_clipboard(lua_State *L)
{
if (SDL_HasClipboardText())
{
char *str = SDL_GetClipboardText();
if (str)
{
lua_pushstring(L, str);
free(str);
}
else
lua_pushnil(L);
}
else
lua_pushnil(L);
return 1;
}
static const struct luaL_reg keylib[] =
{
{"set_current_handler", lua_set_current_keyhandler},
......@@ -218,6 +243,8 @@ static const struct luaL_reg keylib[] =
{"symName", lua_get_scancode_name},
{"flush", lua_flush_key_events},
{"unicodeInput", lua_key_unicode},
{"getClipboard", lua_key_get_clipboard},
{"setClipboard", lua_key_set_clipboard},
{NULL, NULL},
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment