Merge pull request #1222 from morethanoneanimal/master
Use unmodified command for the command history.
This commit is contained in:
commit
5aa4a16fb2
|
@ -389,9 +389,9 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
|
||||||
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
|
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
|
||||||
prompt = prettyprompt })
|
prompt = prettyprompt })
|
||||||
|
|
||||||
local function exec(cb)
|
local function exec(cb, command_to_history)
|
||||||
textbox:set_markup("")
|
textbox:set_markup("")
|
||||||
history_add(history_path, command)
|
history_add(history_path, command_to_history)
|
||||||
keygrabber.stop(grabber)
|
keygrabber.stop(grabber)
|
||||||
cb(command)
|
cb(command)
|
||||||
if done_callback then done_callback() end
|
if done_callback then done_callback() end
|
||||||
|
@ -461,9 +461,10 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
|
||||||
for _,v2 in ipairs(v[1]) do
|
for _,v2 in ipairs(v[1]) do
|
||||||
match = match and mod[v2]
|
match = match and mod[v2]
|
||||||
end
|
end
|
||||||
if match or #filtered_modifiers == 0 then
|
if match then
|
||||||
local cb
|
local cb
|
||||||
local ret = v[3](command)
|
local ret = v[3](command)
|
||||||
|
local original_command = command
|
||||||
if ret then
|
if ret then
|
||||||
command = ret
|
command = ret
|
||||||
cb = exe_callback
|
cb = exe_callback
|
||||||
|
@ -471,7 +472,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
|
||||||
-- No callback.
|
-- No callback.
|
||||||
cb = function() end
|
cb = function() end
|
||||||
end
|
end
|
||||||
exec(cb)
|
exec(cb, original_command)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -489,7 +490,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
|
||||||
elseif (mod.Control and (key == "j" or key == "m"))
|
elseif (mod.Control and (key == "j" or key == "m"))
|
||||||
or (not mod.Control and key == "Return")
|
or (not mod.Control and key == "Return")
|
||||||
or (not mod.Control and key == "KP_Enter") then
|
or (not mod.Control and key == "KP_Enter") then
|
||||||
exec(exe_callback)
|
exec(exe_callback, command)
|
||||||
-- We already unregistered ourselves so we don't want to return
|
-- We already unregistered ourselves so we don't want to return
|
||||||
-- true, otherwise we may unregister someone else.
|
-- true, otherwise we may unregister someone else.
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue