aboutsummaryrefslogtreecommitdiff
path: root/src/lua_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_interface.c')
-rw-r--r--src/lua_interface.c11
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);