This commit is contained in:
p.kosyh 2010-06-16 18:29:11 +00:00
parent 3c3c91003c
commit 7f28b2de54
3 changed files with 21 additions and 5 deletions

View file

@ -159,3 +159,16 @@ function isMenu(v)
return false
end
stead.fmt = function(...)
local i, res
if arg == nil then
return false
end
for i=1,stead.table.maxn(arg) do
if type(arg[i]) == 'string' then
local s = stead.string.gsub(arg[i],'\t',' '):gsub('[\n]+', ' '):gsub('%^','\n');
res = par('', res, s);
end
end
return res
end

View file

@ -259,8 +259,11 @@ function(f, ...)
end)
function input_esc(s)
local rep = function(s)
return txtnb(s)
end
if not s then return end
return s:gsub("\\","\\\\"):gsub(">","\\>");
return s:gsub("\\","\\\\"):gsub(">","\\>"):gsub("[^ ]+", rep):gsub("[ \t]", rep);
end
function inp(info, txt)
@ -270,9 +273,9 @@ function inp(info, txt)
end
v.dsc = function(s)
if s._edit then
return s.info..txtnb(input_esc(input._txt))..input.cursor
return s.info..input_esc(input._txt)..input.cursor
end
return s.info..txtnb(input_esc(s._txt))
return s.info..input_esc(s._txt)
end
v.text = function(s)
if s._edit then return input._txt end

View file

@ -189,7 +189,7 @@ function txtnm(n, v)
return iface:enum(n, v);
end
function fmt(...)
stead.fmt = function(...)
local i, res
if arg == nil then
return false
@ -1661,7 +1661,7 @@ iface = {
end
end
end
vv = fmt(cat(par("^^", l, r, av, objs, pv), '^'));
vv = stead.fmt(cat(par("^^", l, r, av, objs, pv), '^'));
return vv
end,
cmd = function(self, inp)