public SyntaxHighlighter(IPromptCallbacks promptCallbacks, bool hasUserOptedOutFromColor) { this.promptCallbacks = promptCallbacks; this.hasUserOptedOutFromColor = hasUserOptedOutFromColor; this.previousInput = string.Empty; this.previousOutput = Array.Empty <FormatSpan>(); }
public CompletionPane( CodePane codePane, IPromptCallbacks promptCallbacks, PromptConfiguration configuration) { this.codePane = codePane; this.promptCallbacks = promptCallbacks; this.configuration = configuration; }
/// <summary> /// Instantiates a prompt object. This object can be re-used for multiple invocations of <see cref="ReadLineAsync()"/>. /// </summary> /// <param name="persistentHistoryFilepath">The filepath of where to store history entries. If null, persistent history is disabled.</param> /// <param name="callbacks">A collection of callbacks for modifying and intercepting the prompt's behavior</param> /// <param name="console">The implementation of the console to use. This is mainly for ease of unit testing</param> /// <param name="configuration">If null, default configuration is used.</param> public Prompt( string?persistentHistoryFilepath = null, PromptCallbacks?callbacks = null, IConsole?console = null, PromptConfiguration?configuration = null) { this.console = console ?? new SystemConsole(); this.console.InitVirtualTerminalProcessing(); this.configuration = configuration ?? new PromptConfiguration(); this.history = new HistoryLog(persistentHistoryFilepath, this.configuration.KeyBindings); this.cancellationManager = new CancellationManager(this.console); this.clipboard = (console is IConsoleWithClipboard consoleWithClipboard) ? consoleWithClipboard.Clipboard : new Clipboard(); promptCallbacks = callbacks ?? new PromptCallbacks(); this.highlighter = new SyntaxHighlighter(promptCallbacks, PromptConfiguration.HasUserOptedOutFromColor); }