diff options
author | 2010-08-31 18:28:48 -0400 | |
---|---|---|
committer | 2010-08-31 18:28:48 -0400 | |
commit | f062973a81b74e5a5ea38602d74a8ee61aa76695 (patch) | |
tree | 90a15e45d4d3196d6a10dbad1c3872e39df895e0 /src/lua_interface.c | |
parent | d4db80a3d354ba3c39038c8fb4a1477516fec6d8 (diff) | |
download | textadept-f062973a81b74e5a5ea38602d74a8ee61aa76695.tar.gz textadept-f062973a81b74e5a5ea38602d74a8ee61aa76695.zip |
Change Lua interface to support updated LPeg Scintilla lexer.
Diffstat (limited to 'src/lua_interface.c')
-rw-r--r-- | src/lua_interface.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lua_interface.c b/src/lua_interface.c index 88fb802e..25fc279d 100644 --- a/src/lua_interface.c +++ b/src/lua_interface.c @@ -26,7 +26,7 @@ lua_State *lua; int closing = FALSE; -static int tVOID = 0, /*tINT = 1,*/ tLENGTH = 2, /*tPOSITION = 3,*/ +static int tVOID = 0, tINT = 1, tLENGTH = 2, /*tPOSITION = 3,*/ /*tCOLOUR = 4,*/ tBOOL = 5, tKEYMOD = 6, tSTRING = 7, tSTRINGRESULT = 8; @@ -711,6 +711,15 @@ static int l_call_scintilla(lua_State *lua, GtkWidget *editor, int msg, int params_needed = 2, len = 0, string_return = FALSE; char *return_string = 0; + // SCI_PRIVATELEXERCALL iface has p1_type int, p2_type int. Change p2_type + // appropriately. See LPeg lexer API for more info. + if (msg == SCI_PRIVATELEXERCALL) { + p2_type = tSTRINGRESULT; + int c = luaL_checklong(lua, arg); + if (c == SCI_GETDIRECTFUNCTION || c == SCI_SETDOCPOINTER) p2_type = tINT; + else if (c == SCI_SETLEXERLANGUAGE) p2_type = tSTRING; + } + // Set the w and l parameters appropriately for Scintilla. if (p1_type == tLENGTH && p2_type == tSTRING) { params[0] = (long)lua_strlen(lua, arg); |