diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in index cc3a4475..afebeb58 100644 --- a/lib/awful/prompt.lua.in +++ b/lib/awful/prompt.lua.in @@ -151,7 +151,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his history_check_load(history_path, history_max) local history_index = history_items(history_path) + 1 -- The cursor position - local cur_pos = (args.selectall and 1) or text:len() + 1 + local cur_pos = (args.selectall and 1) or text:wlen() + 1 -- The completion element to use on completion request. local ncomp = 1 if not textbox or not exe_callback then @@ -288,9 +288,9 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his cur_pos = 1 end else - -- len() is UTF-8 aware but #key is not, + -- wlen() is UTF-8 aware but #key is not, -- so check that we have one UTF-8 char but advance the cursor of # position - if key:len() == 1 then + if key:wlen() == 1 then if args.selectall then command = "" end command = command:sub(1, cur_pos - 1) .. key .. command:sub(cur_pos) cur_pos = cur_pos + #key diff --git a/luaa.c b/luaa.c index f63e339a..ee3b5491 100644 --- a/luaa.c +++ b/luaa.c @@ -319,10 +319,10 @@ CHECK_TYPE(widget); static void luaA_fixups(lua_State *L) { - /* replace string.len */ + /* export string.wlen */ lua_getglobal(L, "string"); lua_pushcfunction(L, luaA_mbstrlen); - lua_setfield(L, -2, "len"); + lua_setfield(L, -2, "wlen"); lua_pop(L, 1); /* replace next */ lua_pushliteral(L, "next");