aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-01-29 09:56:17 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2016-01-29 09:56:17 -0500
commit0ce6dc459507ad755d006a2050b6566cb6f429ca (patch)
tree1cbd134714a28dac8803b7c396f51936752f5621
parent1e00f8e5d3cffb0300d56231746ff84e35e1c2af (diff)
downloadtextadept-0ce6dc459507ad755d006a2050b6566cb6f429ca.tar.gz
textadept-0ce6dc459507ad755d006a2050b6566cb6f429ca.zip
`buffer:clear_cmd_key()` should only take one argument.
The `bit32` library makes bit shifting easier.
-rw-r--r--core/ui.lua5
-rw-r--r--src/textadept.c7
2 files changed, 4 insertions, 8 deletions
diff --git a/core/ui.lua b/core/ui.lua
index c82dce5f..e0ba8aef 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -257,10 +257,11 @@ events_connect(events.VIEW_NEW, function()
}
local ctrl_shift_keys = {'L', 'T', 'U', 'Z'}
for _, key in ipairs(ctrl_keys) do
- buffer:clear_cmd_key(string.byte(key), buffer.MOD_CTRL)
+ buffer:clear_cmd_key(string.byte(key) + bit32.lshift(buffer.MOD_CTRL, 16))
end
for _, key in ipairs(ctrl_shift_keys) do
- buffer:clear_cmd_key(string.byte(key), buffer.MOD_CTRL + buffer.MOD_SHIFT)
+ buffer:clear_cmd_key(string.byte(key) +
+ bit32.lshift(buffer.MOD_CTRL + buffer.MOD_SHIFT, 16))
end
-- Since BUFFER_NEW loads themes and settings on startup, only load them for
-- subsequent views.
diff --git a/src/textadept.c b/src/textadept.c
index fa8109c3..867b872d 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1116,12 +1116,7 @@ static int lbuffer_text_range(lua_State *L) {
static sptr_t lL_checkscintillaparam(lua_State *L, int *arg, int type) {
if (type == SSTRING) return (sptr_t)luaL_checkstring(L, (*arg)++);
if (type == SBOOL) return lua_toboolean(L, (*arg)++);
- if (type >= SINT && type <= SCOLOR) return luaL_checkinteger(L, (*arg)++);
- if (type == SKEYMOD) {
- int key = luaL_checkinteger(L, (*arg)++) & 0xFFFF;
- return key | ((luaL_checkinteger(L, (*arg)++) &
- (SCMOD_SHIFT | SCMOD_CTRL | SCMOD_ALT)) << 16);
- }
+ if (type >= SINT && type <= SKEYMOD) return luaL_checkinteger(L, (*arg)++);
return 0;
}