diff options
-rw-r--r-- | src/lua_interface.c | 11 | ||||
-rw-r--r-- | src/properties.h | 7 | ||||
-rw-r--r-- | src/textadept.c | 2 | ||||
-rw-r--r-- | src/textadept.h | 6 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/lua_interface.c b/src/lua_interface.c index 95a286e5..34376f75 100644 --- a/src/lua_interface.c +++ b/src/lua_interface.c @@ -24,6 +24,7 @@ static int // parameter/return types tBOOL = 5, tKEYMOD = 6, tSTRING = 7, tSTRINGRESULT = 8; static void clear_table(LS *lua, int index); +static void warn(const char *s) { printf("Warning: %s\n", s); } LF l_buffer_mt_index(LS *lua), l_buffer_mt_newindex(LS *lua), l_bufferp_mt_index(LS *lua), l_bufferp_mt_newindex(LS *lua), @@ -418,7 +419,7 @@ void l_set_buffer_global(ScintillaObject *sci) { */ void l_close() { closing = true; - while (unsplit_window(focused_editor)); + while (unsplit_window(focused_editor)) ; if (!l_ta_get(lua, "buffers")) luaL_error(lua, buffers_dne); lua_pushnil(lua); while (lua_next(lua, -2)) { @@ -554,7 +555,7 @@ static long l_toscintillaparam(LS *lua, int type, int &arg_idx) { else if (type == tBOOL) return lua_toboolean(lua, arg_idx++); else if (type == tKEYMOD) - return static_cast<int>(luaL_checkinteger(lua, arg_idx++)) & 0xFFFF | + return (static_cast<int>(luaL_checkinteger(lua, arg_idx++)) & 0xFFFF) | ((static_cast<int>(luaL_checkinteger(lua, arg_idx++)) & (SCMOD_SHIFT | SCMOD_CTRL | SCMOD_ALT)) << 16); else if (type > tVOID && type < tBOOL) @@ -990,8 +991,10 @@ LF l_bufferp_mt_(LS *lua, int n, const char *prop, int arg) { int rt_type = n == 1 ? l_rawgeti_int(lua, -1, 3) : tVOID; int p1_type = l_rawgeti_int(lua, -1, n == 1 ? 4 : 3); int p2_type = n == 2 ? l_rawgeti_int(lua, -1, 4) : tVOID; - if (n == 2 && (p2_type != tVOID || p2_type == tVOID && p1_type == tSTRING)) - p1_type ^= p2_type ^= p1_type ^= p2_type; + if (n == 2 && + (p2_type != tVOID || (p2_type == tVOID && p1_type == tSTRING))) { + int temp = p1_type; p1_type = p2_type; p2_type = temp; // swap + } if (msg != 0) return l_call_scintilla(lua, sci, msg, p1_type, p2_type, rt_type, arg); else luaL_error(lua, "The property '%s' is %s-only.", prop, diff --git a/src/properties.h b/src/properties.h index 0ea11a2e..1d7d8b50 100644 --- a/src/properties.h +++ b/src/properties.h @@ -5,6 +5,12 @@ #include "textadept.h" +static long SSS(ScintillaObject *sci, unsigned int msg, const char *wParam=0, + const char *lParam=0) { + return scintilla_send_message(sci, msg, reinterpret_cast<long>(wParam), + reinterpret_cast<long>(lParam)); +} + #define sp(k, v) SSS(sci, SCI_SETPROPERTY, k, v) #define color(r, g, b) r | (g << 8) | (b << 16) @@ -13,6 +19,7 @@ * @param sci The Scintilla window to set default properties for. */ void set_default_editor_properties(ScintillaObject *sci) { + sp("textadept.home", textadept_home); sp("lexer.lua.home", "/usr/share/textadept/lexers/"); sp("lexer.lua.script", "/usr/share/textadept/lexers/lexer.lua"); diff --git a/src/textadept.c b/src/textadept.c index 71d2aea5..3886baec 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -664,7 +664,7 @@ static void pm_entry_activated(GtkWidget *widget, gpointer) { * - Escape - Refocuses the Scintilla view. */ static bool pm_keypress(GtkWidget *, GdkEventKey *event, gpointer) { - if (event->keyval == 0xff09 && event->state == GDK_CONTROL_MASK || + if ((event->keyval == 0xff09 && event->state == GDK_CONTROL_MASK) || event->keyval == 0xff1b) { gtk_widget_grab_focus(focused_editor); return true; diff --git a/src/textadept.h b/src/textadept.h index aae1fd8a..ac845e01 100644 --- a/src/textadept.h +++ b/src/textadept.h @@ -31,12 +31,6 @@ static long SS(ScintillaObject *sci, unsigned int msg, unsigned long wParam=0, long lParam=0) { return scintilla_send_message(sci, msg, wParam, lParam); } -static long SSS(ScintillaObject *sci, unsigned int msg, const char *wParam=0, - const char *lParam=0) { - return scintilla_send_message(sci, msg, reinterpret_cast<long>(wParam), - reinterpret_cast<long>(lParam)); -} -static void warn(const char *s) { printf("Warning: %s\n", s); } // textadept.c void create_ui(); |