diff options
author | 2011-07-11 17:41:06 -0400 | |
---|---|---|
committer | 2011-07-11 17:41:06 -0400 | |
commit | edd1a1c4f1bfb976177faab9390532fe66850f47 (patch) | |
tree | 1f6538fe19dbdad3a9e706cd70892f0f26db9553 /src/textadept.c | |
parent | cf160f145890be7f5dd18c63421ed9fb40522063 (diff) | |
download | textadept-edd1a1c4f1bfb976177faab9390532fe66850f47.tar.gz textadept-edd1a1c4f1bfb976177faab9390532fe66850f47.zip |
Allow buffer functions to omit buffer argument.
This is primarily for key and menu commands to avoid creating too many
unnecessary tables.
Diffstat (limited to 'src/textadept.c')
-rw-r--r-- | src/textadept.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/textadept.c b/src/textadept.c index d9874dd2..661b8ca6 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -1599,8 +1599,12 @@ static int l_call_buffer_function(lua_State *lua) { int rt_type = l_rawgeti_int(lua, buffer_func_table_idx, 2); int p1_type = l_rawgeti_int(lua, buffer_func_table_idx, 3); int p2_type = l_rawgeti_int(lua, buffer_func_table_idx, 4); - l_check_focused_buffer(lua, 1); - return l_call_scintilla(lua, editor, msg, p1_type, p2_type, rt_type, 2); + int arg = 1; + if (lua_type(lua, 1) == LUA_TTABLE) { + l_check_focused_buffer(lua, 1); + arg = 2; + } + return l_call_scintilla(lua, editor, msg, p1_type, p2_type, rt_type, arg); } /** |