Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Nov 30, 2022
1 parent 31964c3 commit d261d1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/libraries/System.Console/src/System/ConsolePal.Unix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ internal static partial class ConsolePal
// StdInReader is only used when input isn't redirected and we're working
// with an interactive terminal. In that case, performance isn't critical
// and we can use a smaller buffer to minimize working set.
#if !TARGET_WASI
private const int InteractiveBufferSize = 255;

#if !TARGET_WASI
// For performance we cache Cursor{Left,Top} and Window{Width,Height}.
// These values must be read/written under lock (Console.Out).
// We also need to invalidate these values when certain signals occur.
Expand Down Expand Up @@ -269,11 +269,13 @@ public static void Beep()
#endif

#if TARGET_WASI
#pragma warning disable IDE0060
public static void Clear() => throw new PlatformNotSupportedException();
public static void SetCursorPosition(int left, int top) => throw new PlatformNotSupportedException();
public static bool IsInputRedirectedCore() => throw new PlatformNotSupportedException();
public static bool IsOutputRedirectedCore() => throw new PlatformNotSupportedException();
public static bool IsErrorRedirectedCore() => throw new PlatformNotSupportedException();
#pragma warning restore IDE0060
#else
public static void Clear()
{
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Console/src/System/IO/KeyParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ internal static class KeyParser
{
private const char Escape = '\u001B';
private const char Delete = '\u007F';
#if !TARGET_WASI
private const char VtSequenceEndTag = '~';
private const char ModifierSeparator = ';';
private const int MinimalSequenceLength = 3;
private const int SequencePrefixLength = 2; // ^[[ ("^[" stands for Escape)

#if !TARGET_WASI
internal static ConsoleKeyInfo Parse(char[] buffer, TerminalFormatStrings terminalFormatStrings, byte posixDisableValue, byte veraseCharacter, ref int startIndex, int endIndex)
{
int length = endIndex - startIndex;
Expand Down
4 changes: 3 additions & 1 deletion src/libraries/System.Console/src/System/IO/StdInReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ private int ReadOrPeek(bool peek)
}

#if TARGET_WASI
#pragma warning disable IDE0060
private static bool IsEol(char c)
{
return false; // TODOWASI
}
#pragma warning restore IDE0060
#else
private static bool IsEol(char c)
{
Expand Down Expand Up @@ -357,7 +359,7 @@ private unsafe ConsoleKeyInfo ReadKey()
// or just use 0 if none are available.
return new ConsoleKeyInfo((char)
#if TARGET_WASI
0,// TODOWASI
0, // TODOWASI
#else
(ConsolePal.s_veolCharacter != ConsolePal.s_posixDisableValue ? ConsolePal.s_veolCharacter :
ConsolePal.s_veol2Character != ConsolePal.s_posixDisableValue ? ConsolePal.s_veol2Character :
Expand Down

0 comments on commit d261d1b

Please sign in to comment.