1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-13 11:40:29 +00:00

Do not insert empty or duplicate entries into shell history

If a string is empty or the same as the previous command then it will
not be inserted into history.
This commit is contained in:
SquidDev 2017-05-11 21:01:23 +01:00
parent 25128dfb66
commit 9908f8c289
2 changed files with 6 additions and 2 deletions

View File

@ -44,7 +44,9 @@ while bRunning do
end
return nil
end )
table.insert( tCommandHistory, s )
if s:match("%S") and tCommandHistory[#tCommandHistory] ~= s then
table.insert( tCommandHistory, s )
end
local nForcePrint = 0
local func, e = load( s, "lua", "t", tEnv )

View File

@ -363,7 +363,9 @@ else
else
sLine = read( nil, tCommandHistory )
end
table.insert( tCommandHistory, sLine )
if sLine:match("%S") and tCommandHistory[#tCommandHistory] ~= sLine then
table.insert( tCommandHistory, sLine )
end
shell.run( sLine )
end
end