Example #1
0
    private async Task <PromptResult?> GetResult(CodePane codePane, KeyPress key, string inputText, CancellationToken cancellationToken)
    {
        // process any user-defined keyboard shortcuts
        if (promptCallbacks.TryGetKeyPressCallbacks(key.ConsoleKeyInfo, out var callback))
        {
            var result = await callback.Invoke(inputText, codePane.Document.Caret, cancellationToken).ConfigureAwait(false);

            if (result is not null)
            {
                return(result);
            }
        }
        return(codePane.Result);
    }