X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=mod_query%2Fmod_query.lua;h=a9524809b4948dc9afe010f4bdd4fde6b34cdf2e;hb=3102bb90c325d9b29ac304d8f3ea0a17df564fc8;hp=15b03c29428f55a49bbf987af25ed6a373c5c8ac;hpb=3c05dc83d5cac336fe65908542307722c6b98d5a;p=ion3.git diff --git a/mod_query/mod_query.lua b/mod_query/mod_query.lua index 15b03c2..a952480 100644 --- a/mod_query/mod_query.lua +++ b/mod_query/mod_query.lua @@ -1,7 +1,7 @@ -- -- ion/query/mod_query.lua -- Some common queries for Ion -- --- Copyright (c) Tuomo Valkonen 2004-2007. +-- Copyright (c) Tuomo Valkonen 2004-2008. -- -- See the included file LICENSE for details. -- @@ -324,6 +324,8 @@ end local function mk_completion_test(str, sub_ok, casei_ok) + local settings=mod_query.get() + if not str then return function(s) return true end end @@ -337,9 +339,10 @@ local function mk_completion_test(str, sub_ok, casei_ok) end end - local casei=(casei_ok and mod_query.get().caseicompl) + casei_ok=(casei_ok and settings.caseicompl) + sub_ok=(sub_ok and settings.substrcompl) - if not casei then + if not casei_ok then return mk(str, sub_ok) else local fn=mk(string.lower(str), sub_ok) @@ -907,7 +910,7 @@ function mod_query.get_hostnicks(mplex) patterns=pat elseif string.find(substr, "^[nN][aA][mM][eE]") and patterns then - for s in string.gfind(patterns, "%S+") do + for s in string.gmatch(patterns, "%S+") do if not string.find(s, "[*?]") then table.insert(mod_query.hostnicks, s) end @@ -931,7 +934,7 @@ function mod_query.complete_ssh(str) end local res = {} - local tst = mk_completion_test(host, true, false) + local tst = mk_completion_test(host, true, true) for _, v in ipairs(mod_query.ssh_completions) do if tst(v) then @@ -1024,6 +1027,7 @@ function mod_query.do_handle_lua(mplex, env, code) local print_res local function collect_print(...) local tmp="" + local arg={...} local l=#arg for i=1,l do tmp=tmp..tostring(arg[i])..(i==l and "\n" or "\t") @@ -1065,7 +1069,7 @@ function mod_query.do_complete_lua(env, str) -- Descend into tables if tocomp and string.len(tocomp)>=1 then - for t in string.gfind(tocomp, "([^.:]*)[.:]") do + for t in string.gmatch(tocomp, "([^.:]*)[.:]") do metas=false if string.len(t)==0 then comptab=env; @@ -1212,8 +1216,7 @@ function mod_query.query_menu(mplex, sub, themenu, prompt) local ntab=xform_menu({}, menu, "") local function complete(str) - -- casei_ok false, because everything is already in lower case - return mod_query.complete_keys(ntab, str, true, false) + return mod_query.complete_keys(ntab, str, true, true) end local function handle(mplex, str)