/// <summary> /// Initializes an instance of <see cref="AutoCompleteInput"/>. /// </summary> public AutoCompleteInput(IConsole console, HashSet <ShortcutDefinition>?userDefinedShortcut = null) { History = new InputHistoryProvider(); var keyActions = new HashSet <ShortcutDefinition> { // History new ShortcutDefinition(ConsoleKey.UpArrow, () => { if (History.SelectionUp()) { _lineInputHandler.ClearLine(); _lineInputHandler.Write(History.GetSelection()); } }), new ShortcutDefinition(ConsoleKey.DownArrow, () => { if (History.SelectionDown()) { _lineInputHandler.ClearLine(); _lineInputHandler.Write(History.GetSelection()); } }), // AutoComplete new ShortcutDefinition(ConsoleKey.Tab, () => { if (IsInAutoCompleteMode) { NextAutoComplete(); } else { InitAutoComplete(); } }), new ShortcutDefinition(ConsoleKey.Tab, ConsoleModifiers.Shift, () => { if (IsInAutoCompleteMode) { PreviousAutoComplete(); } else { InitAutoComplete(true); } }) }; _lineInputHandler = new LineInputHandler(console, keyActions, userDefinedShortcut); _lineInputHandler.InputModified += InputModifiedCallback; }
/// <summary> /// Initializes an instance of <see cref="AutoCompleteInput"/>. /// </summary> public AutoCompleteInput(IConsole console, HashSet <ShortcutDefinition>?userDefinedShortcut = null) { History = new InputHistoryProvider(); var keyActions = new HashSet <ShortcutDefinition> { // History new ShortcutDefinition(ConsoleKey.UpArrow, () => { if (History.SelectionUp()) { _lineInputHandler !.ClearLine(); _lineInputHandler.Write(History.GetSelection()); } }),