Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ internal string WorkingDirectory
{
return _workingDirectory.Remove(_workingDirectory.Length - 1);
}
#endif
#endif
return _workingDirectory;
}
}
Expand Down Expand Up @@ -529,7 +529,7 @@ private static string GetConfigurationNameFromGroupPolicy()
/// </param>
private static void EarlyParseHelper(string[] args)
{
if(args == null)
if (args == null)
{
Dbg.Assert(args != null, "Argument 'args' to EarlyParseHelper should never be null");
return;
Expand Down
78 changes: 39 additions & 39 deletions src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Microsoft.PowerShell
internal static class ConsoleControl
{
#if !UNIX
#region structs
#region structs

internal enum InputRecordEventTypes : ushort
{
Expand Down Expand Up @@ -246,7 +246,7 @@ internal struct TEXTMETRIC
public byte tmCharSet;
}

#region SentInput Data Structures
#region SentInput Data Structures

[StructLayout(LayoutKind.Sequential)]
internal struct INPUT
Expand Down Expand Up @@ -417,11 +417,11 @@ internal enum KeyboardFlag : uint
ScanCode = 0x0008
}

#endregion SentInput Data Structures
#endregion SentInput Data Structures

#endregion structs
#endregion structs

#region Window Visibility
#region Window Visibility
[DllImport(PinvokeDllNames.GetConsoleWindowDllName)]
internal static extern IntPtr GetConsoleWindow();

Expand Down Expand Up @@ -473,9 +473,9 @@ internal static void SetConsoleMode(ProcessWindowStyle style)
}
}
#endif
#endregion
#endregion

#region Input break handler (Ctrl-C, Ctrl-Break)
#region Input break handler (Ctrl-C, Ctrl-Break)

/// <summary>
/// Types of control ConsoleBreakSignals received by break Win32Handler delegates.
Expand Down Expand Up @@ -546,9 +546,9 @@ internal static void RemoveBreakHandler()
}
}

#endregion
#endregion

#region Win32Handles
#region Win32Handles

private static readonly Lazy<ConsoleHandle> _keyboardInputHandle = new Lazy<SafeFileHandle>(() =>
{
Expand Down Expand Up @@ -621,9 +621,9 @@ internal static ConsoleHandle GetActiveScreenBufferHandle()
return _outputHandle.Value;
}

#endregion
#endregion

#region Mode
#region Mode

/// <summary>
/// Flags used by ConsoleControl.GetMode and ConsoleControl.SetMode.
Expand Down Expand Up @@ -707,9 +707,9 @@ internal static void SetMode(ConsoleHandle consoleHandle, ConsoleModes mode)
}
}

#endregion
#endregion

#region Input
#region Input

/// <summary>
/// Reads input from the console device according to the mode in effect (see GetMode, SetMode)
Expand Down Expand Up @@ -943,9 +943,9 @@ internal static void FlushConsoleInputBuffer(ConsoleHandle consoleHandle)
}
}

#endregion Input
#endregion Input

#region Buffer
#region Buffer

/// <summary>
/// Wraps Win32 GetConsoleScreenBufferInfo
Expand Down Expand Up @@ -1178,7 +1178,7 @@ private static void BuildEdgeTypeInfo(
firstRightLeadingRow = r;
}

for (;;)
for (; ; )
{
r++;
if (r > contentsRegion.Bottom)
Expand Down Expand Up @@ -1769,7 +1769,7 @@ internal static void ReadConsoleOutput
}
}

#region ReadConsoleOutput CJK
#region ReadConsoleOutput CJK
/// <summary>
/// If an edge cell read is a blank, it is potentially part of a double width character. Hence,
/// at least one of the left and right edges should be checked.
Expand Down Expand Up @@ -2066,7 +2066,7 @@ out background
rowIndex++;
}
}
#endregion ReadConsoleOutput CJK
#endregion ReadConsoleOutput CJK

private static void ReadConsoleOutputPlain
(
Expand Down Expand Up @@ -2408,9 +2408,9 @@ internal static void ScrollConsoleScreenBuffer
}
}

#endregion Buffer
#endregion Buffer

#region Window
#region Window

/// <summary>
/// Wraps Win32 SetConsoleWindowInfo.
Expand Down Expand Up @@ -2536,7 +2536,7 @@ internal static void SetConsoleWindowTitle(string consoleTitle)
}
}

#endregion Window
#endregion Window

/// <summary>
/// Wrap Win32 WriteConsole.
Expand Down Expand Up @@ -2661,7 +2661,7 @@ internal static void SetConsoleTextAttribute(ConsoleHandle consoleHandle, WORD a
}

#endif
#region Dealing with CJK
#region Dealing with CJK

// Return the length of a VT100 control sequence character in str starting
// at the given offset.
Expand Down Expand Up @@ -2748,11 +2748,11 @@ internal static bool IsCJKOutputCodePage(out uint codePage)
}

#endif
#endregion Dealing with CJK
#endregion Dealing with CJK

#if !UNIX

#region Cursor
#region Cursor

/// <summary>
/// Wraps Win32 SetConsoleCursorPosition.
Expand Down Expand Up @@ -2874,9 +2874,9 @@ internal static void SetConsoleCursorInfo(ConsoleHandle consoleHandle, CONSOLE_C
}
}

#endregion Cursor
#endregion Cursor

#region helper
#region helper

/// <summary>
/// Helper function to create the proper HostException.
Expand All @@ -2895,9 +2895,9 @@ private static HostException CreateHostException(
return e;
}

#endregion helper
#endregion helper

#region
#region

internal static int LengthInBufferCells(char c)
{
Expand All @@ -2915,16 +2915,16 @@ internal static int LengthInBufferCells(char c)
(c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */
(c >= 0xff00 && c <= 0xff60) || /* Fullwidth Forms */
(c >= 0xffe0 && c <= 0xffe6));
// We can ignore these ranges because .Net strings use surrogate pairs
// for this range and we do not handle surrogage pairs.
// (c >= 0x20000 && c <= 0x2fffd) ||
// (c >= 0x30000 && c <= 0x3fffd)
// We can ignore these ranges because .Net strings use surrogate pairs
// for this range and we do not handle surrogage pairs.
// (c >= 0x20000 && c <= 0x2fffd) ||
// (c >= 0x30000 && c <= 0x3fffd)
return 1 + (isWide ? 1 : 0);
}

#endregion
#endregion

#region SendInput
#region SendInput

internal static void MimicKeyPress(INPUT[] inputs)
{
Expand All @@ -2941,7 +2941,7 @@ internal static void MimicKeyPress(INPUT[] inputs)
}
}

#endregion SendInput
#endregion SendInput

/// <summary>
/// Class to hold the Native Methods used in this file enclosing class.
Expand All @@ -2953,7 +2953,7 @@ internal static class NativeMethods
internal const int FontTypeMask = 0x06;
internal const int TrueTypeFont = 0x04;

#region CreateFile
#region CreateFile

[Flags]
internal enum AccessQualifiers : uint
Expand Down Expand Up @@ -2993,14 +2993,14 @@ internal static extern NakedWin32Handle CreateFile
NakedWin32Handle templateFileWin32Handle
);

#endregion CreateFile
#endregion CreateFile

#region Code Page
#region Code Page

[DllImport(PinvokeDllNames.GetConsoleOutputCPDllName, SetLastError = false, CharSet = CharSet.Unicode)]
internal static extern uint GetConsoleOutputCP();

#endregion Code Page
#endregion Code Page

[DllImport(PinvokeDllNames.GetConsoleWindowDllName, SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern HWND GetConsoleWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal sealed partial class ConsoleHost
#region static methods

internal const int ExitCodeSuccess = 0;
internal const int ExitCodeCtrlBreak = 128+21; // SIGBREAK
internal const int ExitCodeCtrlBreak = 128 + 21; // SIGBREAK
internal const int ExitCodeInitFailure = 70; // Internal Software Error
internal const int ExitCodeBadCommandLineParameter = 64; // Command Line Usage Error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ int LengthInBufferCells(char c)
return ConsoleControl.LengthInBufferCells(c);
}

#region internal
#region internal

/// <summary>
/// Clear the ReadKey cache.
Expand All @@ -1262,9 +1262,9 @@ internal void ClearKeyCache()
cachedKeyEvent.RepeatCount = 0;
}

#endregion internal
#endregion internal

#region helpers
#region helpers

// pass-by-ref for speed.
/// <summary>
Expand Down Expand Up @@ -1315,7 +1315,7 @@ private static
return result;
}

#endregion helpers
#endregion helpers

private ConsoleColor defaultForeground = ConsoleColor.Gray;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ internal string WrapToCurrentWindowWidth(string text)
return sb.ToString();
}

#endregion Word Wrapping
#endregion Word Wrapping

/// <summary>
/// See base class.
Expand Down Expand Up @@ -1580,8 +1580,8 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
}

#endif
do
{
do
{
#if UNIX
keyInfo = Console.ReadKey(true);
#else
Expand All @@ -1595,35 +1595,35 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
#else
if (s.Length == 0)
#endif
{
result = ReadLineResult.endedOnBreak;
s = null;

if (calledFromPipeline)
{
// make sure that the pipeline that called us is stopped
{
result = ReadLineResult.endedOnBreak;
s = null;

throw new PipelineStoppedException();
}
if (calledFromPipeline)
{
// make sure that the pipeline that called us is stopped

break;
throw new PipelineStoppedException();
}

break;
}

#if UNIX
if (keyInfo.Key == ConsoleKey.Enter)
#else
if (s.EndsWith(Crlf, StringComparison.Ordinal))
#endif
{
result = ReadLineResult.endedOnEnter;
{
result = ReadLineResult.endedOnEnter;
#if UNIX
// We're intercepting characters, so we need to echo the newline
Console.Out.WriteLine();
#else
s = s.Remove(s.Length - Crlf.Length);
#endif
break;
}
break;
}

#if UNIX
if (keyInfo.Key == ConsoleKey.Tab)
Expand Down Expand Up @@ -1806,15 +1806,15 @@ private string ReadLineFromConsole(bool endOnTab, string initialContent, bool ca
Console.Out.Write(s);
Console.CursorLeft = cursorCurrent + 1;
#endif
}
while (true);
}
while (true);

Dbg.Assert(
(s == null && result == ReadLineResult.endedOnBreak)
|| (s != null && result != ReadLineResult.endedOnBreak),
"s should only be null if input ended with a break");
Dbg.Assert(
(s == null && result == ReadLineResult.endedOnBreak)
|| (s != null && result != ReadLineResult.endedOnBreak),
"s should only be null if input ended with a break");

return s;
return s;
#if UNIX
}
finally
Expand Down
Loading