--
-- ion/query/mod_query.lua -- Some common queries for Ion
--
--- Copyright (c) Tuomo Valkonen 2004-2007.
+-- Copyright (c) Tuomo Valkonen 2004-2009.
--
-- See the included file LICENSE for details.
--
wedln:complete('prev', 'normal')
end
- -- Check that no other queries are open in the mplex.
- local ok=mplex:managed_i(function(r)
- return not obj_is(r, "WEdln")
+ -- Check that no other queries or message boxes are open in the mplex.
+ local ok=mplex:managed_i(function(r)
+ return not (obj_is(r, "WEdln") or
+ obj_is(r, "WMessage"))
end)
if not ok then
return
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
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)
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
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
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")
-- 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;
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)