diff --git a/ConsoleImprovements/ConsoleImprovements/manifest.jecs b/ConsoleImprovements/ConsoleImprovements/manifest.jecs index eabe279..d46ac86 100644 --- a/ConsoleImprovements/ConsoleImprovements/manifest.jecs +++ b/ConsoleImprovements/ConsoleImprovements/manifest.jecs @@ -1,7 +1,7 @@ ID: D4VID_ConsoleImprovements Name: ConsoleImprovements Author: D4VID -Version: 1.0.0 +Version: 1.1.0 Priority: 0 ClientOnly: true Dependencies: diff --git a/ConsoleImprovements/ConsoleImprovements/src/client/CommandHistoryPatch.cs b/ConsoleImprovements/ConsoleImprovements/src/client/CommandHistoryPatch.cs index e1e27a8..3432672 100644 --- a/ConsoleImprovements/ConsoleImprovements/src/client/CommandHistoryPatch.cs +++ b/ConsoleImprovements/ConsoleImprovements/src/client/CommandHistoryPatch.cs @@ -83,6 +83,13 @@ namespace ConsoleImprovements.Client { // ReSharper disable once InconsistentNaming public static bool HookCommandSubmit(Console __instance, ref string line) { + _command = null; // Clear the command pointer + + // Skip adding the line to the history if it matches the last item + if (_history.Count > 0 && line == _history.First!.Value) { + return true; + } + // Keep the set max number of entries in the history if (_history.Count >= HistLength) { _history.RemoveLast(); @@ -90,8 +97,6 @@ namespace ConsoleImprovements.Client { _history.AddFirst(line); - _command = null; // Clear the command pointer - return true; // Resume original functionality } }