awful: fix empty command adding
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
df7d60faf3
commit
2e4fdbb40d
|
@ -779,7 +779,7 @@ end
|
|||
|
||||
--- Set path for history file
|
||||
-- @param path The history file path, set "on" to enable history in the default file (~/.awesome_history)
|
||||
-- @param max_size Optional parameter: set the max entries number in the history file, 50 by default
|
||||
-- @param max_cmd Optional parameter: set the max entries number in the history file, 50 by default
|
||||
function prompt.history.set(path, max_cmd)
|
||||
if path then
|
||||
prompt.history.data.path = path
|
||||
|
@ -809,8 +809,8 @@ end
|
|||
--- Add an entry to the history file
|
||||
-- @param command The command to add
|
||||
local function prompt_history_add(command)
|
||||
if prompt.history.data.path
|
||||
and command
|
||||
if prompt.history.data.path then
|
||||
if command ~= ""
|
||||
and command ~= prompt.history.data.table[#prompt.history.data.table] then
|
||||
table.insert(prompt.history.data.table, command)
|
||||
|
||||
|
@ -821,6 +821,7 @@ local function prompt_history_add(command)
|
|||
|
||||
-- Save table content in file, not very optimized atm...
|
||||
prompt_history_save()
|
||||
end
|
||||
|
||||
prompt.history.data.index = #prompt.history.data.table + 1
|
||||
end
|
||||
|
@ -1055,6 +1056,8 @@ function prompt.run(args, textbox, exe_callback, completion_callback)
|
|||
command = prompt.history.data.table[prompt.history.data.index]
|
||||
cur_pos = #command + 2
|
||||
elseif prompt.history.data.index == #prompt.history.data.table then
|
||||
prompt.history.data.index = prompt.history.data.index + 1
|
||||
|
||||
command = ""
|
||||
cur_pos = 1
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue