mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 05:33:00 +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:
		| @@ -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 ) | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 SquidDev
					SquidDev