mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00

committed by
Phil Scott

parent
884cb8ddd4
commit
5f97f2300c
@ -2,6 +2,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Spectre.Console
|
||||
{
|
||||
@ -10,7 +12,7 @@ namespace Spectre.Console
|
||||
/// </summary>
|
||||
public static partial class AnsiConsoleExtensions
|
||||
{
|
||||
internal static string ReadLine(this IAnsiConsole console, Style? style, bool secret, IEnumerable<string>? items = null)
|
||||
internal static async Task<string> ReadLine(this IAnsiConsole console, Style? style, bool secret, IEnumerable<string>? items = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (console is null)
|
||||
{
|
||||
@ -24,7 +26,7 @@ namespace Spectre.Console
|
||||
|
||||
while (true)
|
||||
{
|
||||
var rawKey = console.Input.ReadKey(true);
|
||||
var rawKey = await console.Input.ReadKeyAsync(true, cancellationToken).ConfigureAwait(false);
|
||||
if (rawKey == null)
|
||||
{
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user