Inline out variable parameters

This commit is contained in:
Jason Shirk
2017-07-31 16:24:57 -07:00
parent b823045bb2
commit fc55704f83
14 changed files with 71 additions and 145 deletions
+4 -8
View File
@@ -35,8 +35,7 @@ namespace Microsoft.PowerShell
var toInsert = new string(key.Value.KeyChar, count);
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
Replace(start, length, toInsert);
}
else
@@ -49,8 +48,7 @@ namespace Microsoft.PowerShell
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
Replace(start, length, new string(key.Value.KeyChar, 1));
}
else
@@ -155,8 +153,7 @@ namespace Microsoft.PowerShell
{
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
Delete(start, length);
return;
}
@@ -187,8 +184,7 @@ namespace Microsoft.PowerShell
if (_visualSelectionCommandCount > 0)
{
int start, length;
GetRegion(out start, out length);
GetRegion(out var start, out var length);
Delete(start, length);
return;
}
+7 -16
View File
@@ -249,8 +249,7 @@ namespace Microsoft.PowerShell
return;
}
bool ambiguous;
var replacementText = GetUnambiguousPrefix(completions.CompletionMatches, ambiguous: out ambiguous);
var replacementText = GetUnambiguousPrefix(completions.CompletionMatches, out var ambiguous);
if (replacementText.Length > 0)
{
@@ -537,8 +536,7 @@ namespace Microsoft.PowerShell
private bool IsDoneWithCompletions(CompletionResult currentCompletion, ConsoleKeyInfo nextKey)
{
if (nextKey == Keys.Space || nextKey == Keys.Enter) return true;
ConsoleKeyInfo[] doneKeys;
if (doneCompletionKeys.TryGetValue(currentCompletion.ResultType, out doneKeys))
if (doneCompletionKeys.TryGetValue(currentCompletion.ResultType, out var doneKeys))
{
return doneKeys.Contains<ConsoleKeyInfo>(nextKey);
}
@@ -563,12 +561,8 @@ namespace Microsoft.PowerShell
var matches = completions.CompletionMatches;
int menuColumnWidth;
int displayRows;
int selectedItem;
var menuBuffer = CreateCompletionMenu(matches, _console, Options.ShowToolTips,
"", out selectedItem,
out menuColumnWidth, out displayRows);
"", out var selectedItem, out var menuColumnWidth, out var displayRows);
if (menuSelect)
{
@@ -593,8 +587,7 @@ namespace Microsoft.PowerShell
int savedUserMark = _mark;
_visualSelectionCommandCount++;
bool ambiguous;
var userCompletionText = GetUnambiguousPrefix(matches, ambiguous: out ambiguous);
var userCompletionText = GetUnambiguousPrefix(matches, out var ambiguous);
// remove possible first quote
if (userCompletionText.Length > 0 &&
( IsSingleQuote(userCompletionText[0])
@@ -687,7 +680,7 @@ namespace Microsoft.PowerShell
else if (nextKey == Keys.Tab)
{
// Search for possible unAmbiguous common prefix. ...
string unAmbiguousText = GetUnambiguousPrefix(matches, ambiguous: out ambiguous);
string unAmbiguousText = GetUnambiguousPrefix(matches, out ambiguous);
int userComplPos = unAmbiguousText.IndexOf(userCompletionText, StringComparison.OrdinalIgnoreCase);
// ... If found - advance IncrementalCompletion ...
if (unAmbiguousText.Length > 0 && userComplPos >= 0 && unAmbiguousText.Length > (userComplPos + userCompletionText.Length))
@@ -782,8 +775,7 @@ namespace Microsoft.PowerShell
matches = tmpMatches;
previousItem = -1;
menuBuffer = CreateCompletionMenu(matches, _console, Options.ShowToolTips,
selectedCompletionText, out selectedItem,
out menuColumnWidth, out displayRows);
selectedCompletionText, out selectedItem, out menuColumnWidth, out displayRows);
}
else
{
@@ -804,8 +796,7 @@ namespace Microsoft.PowerShell
prependNextKey = true;
// without this branch experience doesnt look naturally
KeyHandler handler;
if (_dispatchTable.TryGetValue(nextKey, out handler) &&
if (_dispatchTable.TryGetValue(nextKey, out var handler) &&
(
handler.Action == CopyOrCancelLine ||
handler.Action == Cut ||
+3 -6
View File
@@ -81,8 +81,7 @@ namespace Microsoft.PowerShell
// Enum.TryParse accepts arbitrary integers. We shouldn't,
// but single digits need to map to the correct key, e.g.
// ConsoleKey.D1
long tokenAsLong;
if (long.TryParse(token, out tokenAsLong))
if (long.TryParse(token, out var tokenAsLong))
{
if (tokenAsLong >= 0 && tokenAsLong <= 9)
{
@@ -99,8 +98,7 @@ namespace Microsoft.PowerShell
// doesn't map to ConsoleKey so convert to virtual key from char
if (!valid && token.Length == 1)
{
string failReason;
valid = TryParseCharLiteral(token[0], ref modifiers, ref key, out failReason);
valid = TryParseCharLiteral(token[0], ref modifiers, ref key, out var failReason);
if (!valid)
{
@@ -116,7 +114,6 @@ namespace Microsoft.PowerShell
else
{
// now, parse modifier(s)
ConsoleModifiers modifier;
// courtesy translation
if (token == "ctrl")
@@ -124,7 +121,7 @@ namespace Microsoft.PowerShell
token = "control";
}
if (Enum.TryParse(token, ignoreCase: true, result: out modifier))
if (Enum.TryParse<ConsoleModifiers>(token, ignoreCase: true, result: out var modifier))
{
// modifier already set?
if ((modifiers & modifier) != 0)
+3 -6
View File
@@ -459,8 +459,7 @@ namespace Microsoft.PowerShell.Internal
public uint GetConsoleInputMode()
{
var handle = _inputHandle.Value.DangerousGetHandle();
uint result;
NativeMethods.GetConsoleMode(handle, out result);
NativeMethods.GetConsoleMode(handle, out var result);
return result;
}
@@ -770,8 +769,7 @@ namespace Microsoft.PowerShell.Internal
}
_istmInitialized = true;
}
int width;
result = NativeMethods.GetCharWidth32(_hDC, (uint)c, (uint)c, out width);
result = NativeMethods.GetCharWidth32(_hDC, (uint)c, (uint)c, out var width);
if (!result)
{
return 1;
@@ -822,8 +820,7 @@ namespace Microsoft.PowerShell.Internal
return true;
// Char device - if GetConsoleMode succeeds, we are NOT redirected.
uint mode;
return !NativeMethods.GetConsoleMode(handle, out mode);
return !NativeMethods.GetConsoleMode(handle, out var mode);
}
}
+8 -16
View File
@@ -375,8 +375,7 @@ namespace Microsoft.PowerShell
if (Options.HistoryNoDuplicates)
{
var line = _history[newHistoryIndex]._line;
int index;
if (!_hashedHistory.TryGetValue(line, out index))
if (!_hashedHistory.TryGetValue(line, out var index))
{
_hashedHistory.Add(line, newHistoryIndex);
--count;
@@ -404,8 +403,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void PreviousHistory(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, -1);
TryGetArgAsInt(arg, out var numericArg, -1);
if (numericArg > 0)
{
numericArg = -numericArg;
@@ -420,8 +418,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void NextHistory(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
_singleton.SaveCurrentLine();
_singleton.HistoryRecall(numericArg);
@@ -468,8 +465,7 @@ namespace Microsoft.PowerShell
{
if (Options.HistoryNoDuplicates)
{
int index;
if (!_hashedHistory.TryGetValue(line, out index))
if (!_hashedHistory.TryGetValue(line, out var index))
{
_hashedHistory.Add(line, newHistoryIndex);
--count;
@@ -518,8 +514,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void HistorySearchBackward(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, -1);
TryGetArgAsInt(arg, out var numericArg, -1);
if (numericArg > 0)
{
numericArg = -numericArg;
@@ -535,8 +530,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void HistorySearchForward(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
_singleton.SaveCurrentLine();
_singleton.HistorySearch(numericArg);
@@ -553,8 +547,7 @@ namespace Microsoft.PowerShell
{
if (Options.HistoryNoDuplicates)
{
int index;
if (!_hashedHistory.TryGetValue(line, out index))
if (!_hashedHistory.TryGetValue(line, out var index))
{
_hashedHistory.Add(line, searchFromPoint);
}
@@ -601,8 +594,7 @@ namespace Microsoft.PowerShell
while (true)
{
var key = ReadKey();
KeyHandler handler;
_dispatchTable.TryGetValue(key, out handler);
_dispatchTable.TryGetValue(key, out var handler);
var function = handler != null ? handler.Action : null;
if (function == ReverseSearchHistory)
{
+2 -4
View File
@@ -329,16 +329,14 @@ namespace Microsoft.PowerShell
_singleton._statusLinePrompt = "what-is-key: ";
_singleton.Render();
var toLookup = ReadKey();
KeyHandler keyHandler;
var buffer = new StringBuilder();
_singleton._dispatchTable.TryGetValue(toLookup, out keyHandler);
_singleton._dispatchTable.TryGetValue(toLookup, out var keyHandler);
buffer.Append(toLookup.ToGestureString());
if (keyHandler != null)
{
if (keyHandler.BriefDescription == "ChordFirstKey")
{
Dictionary<ConsoleKeyInfo, KeyHandler> secondKeyDispatchTable;
if (_singleton._chordDispatchTable.TryGetValue(toLookup, out secondKeyDispatchTable))
if (_singleton._chordDispatchTable.TryGetValue(toLookup, out var secondKeyDispatchTable))
{
toLookup = ReadKey();
secondKeyDispatchTable.TryGetValue(toLookup, out keyHandler);
+5 -11
View File
@@ -193,8 +193,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void KillRegion(ConsoleKeyInfo? key = null, object arg = null)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
_singleton.Kill(start, length, true);
}
@@ -251,10 +250,8 @@ namespace Microsoft.PowerShell
return;
}
Token[] tokens;
ParseError[] errors;
var buffer = _history[yankLastArgState.historyIndex];
Parser.ParseInput(buffer._line, out tokens, out errors);
Parser.ParseInput(buffer._line, out var tokens, out var errors);
int arg = (yankLastArgState.argument < 0)
? tokens.Length + yankLastArgState.argument - 1
@@ -470,8 +467,7 @@ namespace Microsoft.PowerShell
textToPaste = textToPaste.Replace("\r", "");
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
Replace(start, length, textToPaste);
}
else
@@ -489,8 +485,7 @@ namespace Microsoft.PowerShell
string textToSet;
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
textToSet = _singleton._buffer.ToString(start, length);
}
else
@@ -525,8 +520,7 @@ namespace Microsoft.PowerShell
{
if (_singleton._visualSelectionCommandCount > 0)
{
int start, length;
_singleton.GetRegion(out start, out length);
_singleton.GetRegion(out var start, out var length);
ExecuteOnSTAThread(() => Clipboard.SetText(_singleton._buffer.ToString(start, length)));
Delete(start, length);
}
+10 -20
View File
@@ -76,8 +76,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ForwardChar(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (TryGetArgAsInt(arg, out numericArg, 1))
if (TryGetArgAsInt(arg, out var numericArg, 1))
{
SetCursorPosition(_singleton._current + numericArg);
}
@@ -89,8 +88,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void BackwardChar(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (TryGetArgAsInt(arg, out numericArg, 1))
if (TryGetArgAsInt(arg, out var numericArg, 1))
{
SetCursorPosition(_singleton._current - numericArg);
}
@@ -139,8 +137,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void PreviousLine(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (TryGetArgAsInt(arg, out numericArg, 1))
if (TryGetArgAsInt(arg, out var numericArg, 1))
{
_singleton.MoveToLine(-numericArg);
}
@@ -151,8 +148,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void NextLine(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (TryGetArgAsInt(arg, out numericArg, 1))
if (TryGetArgAsInt(arg, out var numericArg, 1))
{
_singleton.MoveToLine(numericArg);
}
@@ -164,8 +160,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void NextWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -190,8 +185,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ShellNextWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -222,8 +216,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ForwardWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -248,8 +241,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ShellForwardWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -290,8 +282,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void BackwardWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -323,8 +314,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ShellBackwardWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
+6 -12
View File
@@ -17,8 +17,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViNextWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -48,8 +47,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViBackwardWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -73,8 +71,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViBackwardGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -93,8 +90,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViNextGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -111,8 +107,7 @@ namespace Microsoft.PowerShell
public static void ViEndOfGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -133,8 +128,7 @@ namespace Microsoft.PowerShell
public static void ViEndOfPreviousGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
+2 -4
View File
@@ -190,8 +190,7 @@ namespace Microsoft.PowerShell
else
{
_dispatchTable[chord[0]] = MakeKeyHandler(Chord, "ChordFirstKey");
Dictionary<ConsoleKeyInfo, KeyHandler> secondDispatchTable;
if (!_chordDispatchTable.TryGetValue(chord[0], out secondDispatchTable))
if (!_chordDispatchTable.TryGetValue(chord[0], out var secondDispatchTable))
{
secondDispatchTable = new Dictionary<ConsoleKeyInfo, KeyHandler>();
_chordDispatchTable[chord[0]] = secondDispatchTable;
@@ -212,8 +211,7 @@ namespace Microsoft.PowerShell
}
else
{
Dictionary<ConsoleKeyInfo, KeyHandler> secondDispatchTable;
if (_chordDispatchTable.TryGetValue(chord[0], out secondDispatchTable))
if (_chordDispatchTable.TryGetValue(chord[0], out var secondDispatchTable))
{
secondDispatchTable.Remove(chord[1]);
if (secondDispatchTable.Count == 0)
+5 -10
View File
@@ -332,8 +332,7 @@ namespace Microsoft.PowerShell
sb.Append(' ');
sb.Append(_lastNKeys[i].ToGestureString());
KeyHandler handler;
if (_singleton._dispatchTable.TryGetValue(_lastNKeys[i], out handler) &&
if (_singleton._dispatchTable.TryGetValue(_lastNKeys[i], out var handler) &&
"AcceptLine".Equals(handler.BriefDescription, StringComparison.OrdinalIgnoreCase))
{
// Make it a little easier to see the keys
@@ -456,8 +455,7 @@ namespace Microsoft.PowerShell
void ProcessOneKey(ConsoleKeyInfo key, Dictionary<ConsoleKeyInfo, KeyHandler> dispatchTable, bool ignoreIfNoAction, object arg)
{
KeyHandler handler;
if (!dispatchTable.TryGetValue(key, out handler))
if (!dispatchTable.TryGetValue(key, out var handler))
{
// If we see a control character where Ctrl wasn't used but shift was, treat that like
// shift hadn't be pressed. This cleanly allows Shift+Backspace without adding a key binding.
@@ -670,8 +668,7 @@ namespace Microsoft.PowerShell
throw new ArgumentNullException("key");
}
Dictionary<ConsoleKeyInfo, KeyHandler> secondKeyDispatchTable;
if (_singleton._chordDispatchTable.TryGetValue(key.Value, out secondKeyDispatchTable))
if (_singleton._chordDispatchTable.TryGetValue(key.Value, out var secondKeyDispatchTable))
{
var secondKey = ReadKey();
_singleton.ProcessOneKey(secondKey, secondKeyDispatchTable, ignoreIfNoAction: true, arg: arg);
@@ -758,8 +755,7 @@ namespace Microsoft.PowerShell
while (true)
{
var nextKey = ReadKey();
KeyHandler handler;
if (_singleton._dispatchTable.TryGetValue(nextKey, out handler))
if (_singleton._dispatchTable.TryGetValue(nextKey, out var handler))
{
if (handler.Action == DigitArgument)
{
@@ -799,8 +795,7 @@ namespace Microsoft.PowerShell
}
}
int intArg;
if (int.TryParse(argBuffer.ToString(), out intArg))
if (int.TryParse(argBuffer.ToString(), out var intArg))
{
_singleton.ProcessOneKey(nextKey, _singleton._dispatchTable, ignoreIfNoAction: false, arg: intArg);
}
+4 -8
View File
@@ -985,8 +985,7 @@ namespace Microsoft.PowerShell
return;
}
Dictionary<ConsoleKeyInfo, KeyHandler> secondKeyDispatchTable;
if (_singleton._chordDispatchTable.TryGetValue(key.Value, out secondKeyDispatchTable))
if (_singleton._chordDispatchTable.TryGetValue(key.Value, out var secondKeyDispatchTable))
{
//if (_singleton._demoMode)
//{
@@ -994,8 +993,7 @@ namespace Microsoft.PowerShell
// _singleton.Render();
//}
var secondKey = ReadKey();
KeyHandler handler;
if (secondKeyDispatchTable.TryGetValue(secondKey, out handler))
if (secondKeyDispatchTable.TryGetValue(secondKey, out var handler))
{
_singleton.ProcessOneKey(secondKey, secondKeyDispatchTable, ignoreIfNoAction: true, arg: arg);
}
@@ -1070,8 +1068,7 @@ namespace Microsoft.PowerShell
while (true)
{
var nextKey = ReadKey();
KeyHandler handler;
if (_singleton._dispatchTable.TryGetValue(nextKey, out handler) && handler.Action == DigitArgument)
if (_singleton._dispatchTable.TryGetValue(nextKey, out var handler) && handler.Action == DigitArgument)
{
if (nextKey.KeyChar == '-')
{
@@ -1102,8 +1099,7 @@ namespace Microsoft.PowerShell
}
}
int intArg;
if (int.TryParse(argBuffer.ToString(), out intArg))
if (int.TryParse(argBuffer.ToString(), out var intArg))
{
_singleton.ProcessOneKey(nextKey, _singleton._dispatchTable, ignoreIfNoAction: false, arg: intArg);
}
+4 -8
View File
@@ -680,8 +680,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ScrollDisplayUp(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
var console = _singleton._console;
var newTop = console.WindowTop - (numericArg * console.WindowHeight);
if (newTop < 0)
@@ -696,8 +695,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ScrollDisplayUpLine(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
var console = _singleton._console;
var newTop = console.WindowTop - numericArg;
if (newTop < 0)
@@ -712,8 +710,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ScrollDisplayDown(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
var console = _singleton._console;
var newTop = console.WindowTop + (numericArg * console.WindowHeight);
if (newTop > (console.BufferHeight - console.WindowHeight))
@@ -728,8 +725,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ScrollDisplayDownLine(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
TryGetArgAsInt(arg, out numericArg, +1);
TryGetArgAsInt(arg, out var numericArg, +1);
var console = _singleton._console;
var newTop = console.WindowTop + numericArg;
if (newTop > (console.BufferHeight - console.WindowHeight))
+8 -16
View File
@@ -73,8 +73,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankRight(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -95,8 +94,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankLeft(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -137,8 +135,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankPreviousWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -162,8 +159,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankNextWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -191,8 +187,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankEndOfWord(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -216,8 +211,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankEndOfGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -295,8 +289,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankPreviousGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}
@@ -321,8 +314,7 @@ namespace Microsoft.PowerShell
/// </summary>
public static void ViYankNextGlob(ConsoleKeyInfo? key = null, object arg = null)
{
int numericArg;
if (!TryGetArgAsInt(arg, out numericArg, 1))
if (!TryGetArgAsInt(arg, out var numericArg, 1))
{
return;
}