aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile8
-rw-r--r--src/lua_interface.c11
2 files changed, 15 insertions, 4 deletions
diff --git a/src/Makefile b/src/Makefile
index cda54868..4fb61776 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -69,19 +69,21 @@ SCINTILLA_OBJS = AutoComplete.o CallTip.o Catalogue.o CellBuffer.o \
Style.o UniConversion.o ViewStyle.o XPM.o \
Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerNoExceptions.o \
LexerSimple.o PropSetSimple.o StyleContext.o WordList.o \
- LexLPeg.o \
PlatGTK.o ScintillaGTK.o
SCINTILLA_MARSHALLER = scintilla-marshal.o
+SCINTILLA_LEXER = LexLPeg.o
# Build
all: $(TEXTADEPT)
$(SCINTILLA_OBJS): scintillua/gtk/*.cxx scintillua/src/*.cxx \
- scintillua/lexlib/*.cxx scintillua/lexers/LexLPeg.cxx
+ scintillua/lexlib/*.cxx
$(CPP) $(SCI_CXXFLAGS) $(GTKFLAGS) -c $^
$(SCINTILLA_MARSHALLER): scintillua/gtk/scintilla-marshal.c
$(CC) $(SCI_CXXFLAGS) $(GTKFLAGS) -w -c $^
+$(SCINTILLA_LEXER): LexLPeg.cxx
+ $(CPP) $(SCI_CXXFLAGS) $(GTKFLAGS) $(LUA_CFLAGS) -DLPEG_LEXER -DNO_SCITE -c $^
$(TEXTADEPT_OBJS): *.c
$(CC) $(CFLAGS) $(GTKFLAGS) -c $^
$(LUA_OBJS): lua/src/*.c
@@ -89,7 +91,7 @@ $(LUA_OBJS): lua/src/*.c
$(GCOCOADIALOG): gcocoadialog/gcocoadialog.c
$(CC) $(GTKFLAGS) $(INCLUDEDIRS) -c $^
$(TEXTADEPT):\
- $(SCINTILLA_OBJS) $(SCINTILLA_MARSHALLER) \
+ $(SCINTILLA_OBJS) $(SCINTILLA_MARSHALLER) $(SCINTILLA_LEXER) \
$(TEXTADEPT_OBJS) $(LUA_OBJS) $(GCOCOADIALOG) \
$(TEXTADEPT_RC)
$(CPP) $(EXPORTLUASYMS) -o $@ $^ $(GTKLIBS)
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);