Skip to content

Commit 7fb13ea

Browse files
authored
Add readonly modifier to some private fields (#1984)
1 parent b65141e commit 7fb13ea

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

PSReadLine/CharMap.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public void ProcessKey(ConsoleKeyInfo key)
6363
// Hard-coded translator for the only VT mode Windows supports.
6464
internal class WindowsAnsiCharMap : ICharMap
6565
{
66-
private List<ConsoleKeyInfo> _pendingKeys;
66+
private readonly List<ConsoleKeyInfo> _pendingKeys;
67+
private readonly Stopwatch _escTimeoutStopwatch = new Stopwatch();
68+
6769
// The next index in `_pendingKeys` to write to.
6870
private int _addKeyIndex;
6971
// The next index in `_pendingKeys` to read from. This index becomes
@@ -75,8 +77,6 @@ internal class WindowsAnsiCharMap : ICharMap
7577
// The upper bound of `_pendingKeys` to read from, exclusive.
7678
private int _readKeyIndexTo;
7779

78-
private Stopwatch _escTimeoutStopwatch = new Stopwatch();
79-
8080
public WindowsAnsiCharMap(long escapeTimeout = 50)
8181
{
8282
// In theory this shouldn't need to be any longer, but one time

PSReadLine/Completion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class PSConsoleReadLine
4040
private static readonly char[] EolChars = {'\r', '\n'};
4141

4242
// String helper for directory paths
43-
private static string DirectorySeparatorString = System.IO.Path.DirectorySeparatorChar.ToString();
43+
private static readonly string DirectorySeparatorString = System.IO.Path.DirectorySeparatorChar.ToString();
4444

4545
// Stub helper method so completion can be mocked
4646
[ExcludeFromCodeCoverage]

PSReadLine/PlatformWindows.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ public static bool IsConsoleApiAvailable(bool input, bool output)
403403

404404
internal class LegacyWin32Console : VirtualTerminal
405405
{
406-
private static ConsoleColor InitialFG = Console.ForegroundColor;
407-
private static ConsoleColor InitialBG = Console.BackgroundColor;
406+
private static readonly ConsoleColor InitialFG = Console.ForegroundColor;
407+
private static readonly ConsoleColor InitialBG = Console.BackgroundColor;
408408
private static int maxTop = 0;
409409

410410
private static readonly Dictionary<int, Action> VTColorAction = new Dictionary<int, Action> {

test/MockConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ internal class TestConsole : IConsole
6868
private readonly int _bufferHeight;
6969
private readonly int _windowWidth;
7070
private readonly int _windowHeight;
71+
private readonly dynamic _keyboardLayout;
7172
private bool _ignoreNextNewline;
72-
private dynamic _keyboardLayout;
7373

7474
internal TestConsole(dynamic keyboardLayout)
7575
{

0 commit comments

Comments
 (0)