diff --git a/CodeApp/Managers/TerminalInstance.swift b/CodeApp/Managers/TerminalInstance.swift index 01531831..c2988225 100644 --- a/CodeApp/Managers/TerminalInstance.swift +++ b/CodeApp/Managers/TerminalInstance.swift @@ -319,6 +319,18 @@ class TerminalInstance: NSObject, WKScriptMessageHandler, WKNavigationDelegate { } openSharedFilesApp(urlString: dir) self.readLine() + case let x where x.hasPrefix("history"): + let args = x.components(separatedBy: " ") + if args.count == 2 && args[1] == "-c" { + // Clear command history stored in local-echo.js + // This accesses the HistoryController instance (localEcho.history) + // to reset both the entries array and cursor position + executeScript("localEcho.history.entries = []; localEcho.history.cursor = 0;") + self.readLine() + } else { + // Display history - pass to ios_system for default behavior + fallthrough + } default: let command = result["Input"] as! String // guard command.count > 0 else {