prompt: fix search term ctrl+up/ctrl+down when starting from existing entries

Signed-off-by: Massimiliano Brocchini <massimiliano.brocchini@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Massimiliano Brocchini 2014-02-22 12:21:09 +01:00 committed by Uli Schlachter
parent 94a8c72596
commit 77a2b27426
1 changed files with 2 additions and 2 deletions

View File

@ -312,7 +312,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback, history_pa
command = command:sub(cur_pos, #command) command = command:sub(cur_pos, #command)
cur_pos = 1 cur_pos = 1
elseif key == "Up" then elseif key == "Up" then
search_term = search_term or command:sub(1, cur_pos - 1) search_term = command:sub(1, cur_pos - 1) or ""
for i,v in (function(a,i) return itera(-1,a,i) end), data.history[history_path].table, history_index do for i,v in (function(a,i) return itera(-1,a,i) end), data.history[history_path].table, history_index do
if v:find('^'..search_term) ~= nil then if v:find('^'..search_term) ~= nil then
command=v command=v
@ -321,7 +321,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback, history_pa
end end
end end
elseif key == "Down" then elseif key == "Down" then
search_term = search_term or command:sub(1, cur_pos - 1) search_term = command:sub(1, cur_pos - 1) or ""
for i,v in (function(a,i) return itera(1,a,i) end), data.history[history_path].table, history_index do for i,v in (function(a,i) return itera(1,a,i) end), data.history[history_path].table, history_index do
if v:find('^'..search_term) ~= nil then if v:find('^'..search_term) ~= nil then
command=v command=v