no duplicate entries in prompt history
Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
092813cd63
commit
bf8e6418f5
|
@ -43,10 +43,12 @@ local function history_check_load(id, max)
|
||||||
-- Read history file
|
-- Read history file
|
||||||
if f then
|
if f then
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
table.insert(data.history[id].table, line)
|
if util.table.hasitem(data.history[id].table, line) == nil then
|
||||||
if #data.history[id].table >= data.history[id].max then
|
table.insert(data.history[id].table, line)
|
||||||
break
|
if #data.history[id].table >= data.history[id].max then
|
||||||
end
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
@ -90,7 +92,7 @@ end
|
||||||
local function history_add(id, command)
|
local function history_add(id, command)
|
||||||
if data.history[id] then
|
if data.history[id] then
|
||||||
if command ~= ""
|
if command ~= ""
|
||||||
and command ~= data.history[id].table[#data.history[id].table] then
|
and util.table.hasitem(data.history[id].table, command) == nil then
|
||||||
table.insert(data.history[id].table, command)
|
table.insert(data.history[id].table, command)
|
||||||
|
|
||||||
-- Do not exceed our max_cmd
|
-- Do not exceed our max_cmd
|
||||||
|
|
Loading…
Reference in New Issue