mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Handle Ctrl-C while prompting
This commit is contained in:
1 parent
3572367c00
commit
68875f0942
1 file changed
+13
@@ -1720,11 +1720,17 @@ namespace Microsoft.PowerShell
|
||||
// the empty string.
|
||||
|
||||
#if LINUX
|
||||
bool treatControlCAsInput = Console.TreatControlCAsInput;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
ConsoleKeyInfo keyInfo;
|
||||
string s = "";
|
||||
int index = 0;
|
||||
int cursorLeft = Console.CursorLeft;
|
||||
int cursorCurrent = cursorLeft;
|
||||
Console.TreatControlCAsInput = true;
|
||||
#else
|
||||
rawui.ClearKeyCache();
|
||||
uint keyState = 0;
|
||||
@@ -1900,6 +1906,13 @@ namespace Microsoft.PowerShell
|
||||
"s should only be null if input ended with a break");
|
||||
|
||||
return s;
|
||||
#if LINUX
|
||||
}
|
||||
finally
|
||||
{
|
||||
Console.TreatControlCAsInput = treatControlCAsInput;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user