8000 Rename variables for clarity · PowerShell/PowerShell@a7a3160 · GitHub
[go: up one dir, main page]

Skip to content

Commit a7a3160

Browse files
committed
Rename variables for clarity
1 parent 8bcb8ca commit a7a3160

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void WriteToScreen()
167167
// error checking on invalid values
168168

169169
// generate the lines using the computed widths
170-
List<string> list = StringManipulationHelper.GenerateLines(_lo.DisplayCells, _stringBuffer.ToString(),
170+
List<string> lines = StringManipulationHelper.GenerateLines(_lo.DisplayCells, _stringBuffer.ToString(),
171171
firstLineWidth, followingLinesWidth);
172172

173173
// compute padding
@@ -186,7 +186,7 @@ private void WriteToScreen()
186186

187187
// now write the lines on the screen
188188
bool firstLine = true;
189-
foreach (string s in list)
189+
foreach (string s in lines)
190190
{
191191
if (firstLine)
192192
{

src/System.Management.Automation/FormatAndOutput/common/ListWriter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,21 @@ private void WriteSingleLineHelper(string prependString, string line, LineOutput
207207
int fieldCellCount = _columnWidth - _propertyLabelsDisplayLength;
208208

209209
// split the lines
210-
List<string> list = StringManipulationHelper.GenerateLines(lo.DisplayCells, line, fieldCellCount, fieldCellCount);
210+
List<string> lines = StringManipulationHelper.GenerateLines(lo.DisplayCells, line, fieldCellCount, fieldCellCount);
211211

212212
// padding to use in the lines after the first
213213
string padding = StringUtil.Padding(_propertyLabelsDisplayLength);
214214

215215
// display the string collection
216-
for (int k = 0; k < list.Count; k++)
216+
for (int k = 0; k < lines.Count; k++)
217217
{
218218
if (k == 0)
219219
{
220-
lo.WriteLine(prependString + list[k]);
220+
lo.WriteLine(prependString + lines[k]);
221221
}
222222
else
223223
{
224-
lo.WriteLine(padding + list[k]);
224+
lo.WriteLine(padding + lines[k]);
225225
}
226226
}
227227
}

src/System.Management.Automation/FormatAndOutput/common/TableWriter.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -255,38 +255,38 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
255255
return null;
256256
}
257257

258-
List<string>[] scArray = new List<string>[validColumnCount];
258+
List<string>[] stringListArray = new List<string>[validColumnCount];
259259
bool addPadding = true;
260-
for (int k = 0; k < scArray.Length; k++)
260+
for (int k = 0; k < stringListArray.Length; k++)
261261
{
262262
// for the last column, don't pad it with trailing spaces
263-
if (k == scArray.Length - 1)
263+
if (k == stringListArray.Length - 1)
264264
{
265265
addPadding = false;
266266
}
267267

268268
// obtain a set of tokens for each field
269-
scArray[k] = GenerateMultiLineRowField(values[validColumnArray[k]], validColumnArray[k],
269+
stringListArray[k] = GenerateM 9E88 ultiLineRowField(values[validColumnArray[k]], validColumnArray[k],
270270
alignment[validColumnArray[k]], ds, addPadding);
271271

272272
// NOTE: the following padding operations assume that we
273273
// pad with a blank (or any character that ALWAYS maps to a single screen cell
274274
if (k > 0)
275275
{
276276
// skipping the first ones, add a separator for concatenation
277-
for (int j = 0; j < scArray[k].Count; j++)
277+
for (int j = 0; j < stringListArray[k].Count; j++)
278278
{
279-
scArray[k][j] = StringUtil.Padding(ScreenInfo.separatorCharacterCount) + scArray[k][j];
279+
stringListArray[k][j] = StringUtil.Padding(ScreenInfo.separatorCharacterCount) + stringListArray[k][j];
280280
}
281281
}
282282
else
283283
{
284284
// add indentation padding if needed
285285
if (_startColumn > 0)
286286
{
287-
for (int j = 0; j < scArray[k].Count; j++)
287+
for (int j = 0; j < stringListArray[k].Count; j++)
288288
{
289-
scArray[k][j] = StringUtil.Padding(_startColumn) + scArray[k][j];
289+
stringListArray[k][j] = StringUtil.Padding(_startColumn) + stringListArray[k][j];
290290
}
291291
}
292292
}
@@ -295,10 +295,10 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
295295
// now we processed all the rows columns and we need to find the cell that occupies the most
296296
// rows
297297
int screenRows = 0;
298-
for (int k = 0; k < scArray.Length; k++)
298+
for (int k = 0; k < stringListArray.Length; k++)
299299
{
300-
if (scArray[k].Count > screenRows)
301-
screenRows = scArray[k].Count;
300+
if (stringListArray[k].Count > screenRows)
301+
screenRows = stringListArray[k].Count;
302302
}
303303

304304
// column headers can span multiple rows if the width of the column is shorter than the header text like:
@@ -314,22 +314,22 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
314314
System.Span<int> lastColWithContent = screenRows <= OutCommandInner.StackAllocThreshold ? stackalloc int[screenRows] : new int[screenRows];
315315
for (int row = 0; row < screenRows; row++)
316316
{
317-
for (int col = 0; col < scArray.Length; col++)
317+
for (int col = 0; col < stringListArray.Length; col++)
318318
{
319-
if (scArray[col].Count > row)
319+
if (stringListArray[col].Count > row)
320320
{
321321
lastColWithContent[row] = col;
322322
}
323323
}
324324
}
325325

326326
// add padding for the columns that are shorter
327-
for (int col = 0; col < scArray.Length; col++)
327+
for (int col = 0; col < stringListArray.Length; col++)
328328
{
329329
int paddingBlanks = 0;
330330

331331
// don't pad if last column
332-
if (col < scArray.Length - 1)
332+
if (col < stringListArray.Length - 1)
333333
{
334334
paddingBlanks = _si.columnInfo[validColumnArray[col]].width;
335335
if (col > 0)
@@ -342,19 +342,19 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
342342
}
343343
}
344344

345-
int paddingEntries = screenRows - scArray[col].Count;
345+
int paddingEntries = screenRows - stringListArray[col].Count;
346346
if (paddingEntries > 0)
347347
{
348348
for (int row = screenRows - paddingEntries; row < screenRows; row++)
349349
{
350350
// if the column is beyond the last column with content, just use empty string
351351
if (col > lastColWithContent[row])
352352
{
353-
scArray[col].Add(string.Empty);
353+
stringListArray[col].Add(string.Empty);
354354
}
355355
else
356356
{
357-
scArray[col].Add(StringUtil.Padding(paddingBlanks));
357+
stringListArray[col].Add(StringUtil.Padding(paddingBlanks));
358358
}
359359
}
360360
}
@@ -366,16 +366,16 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
366366
{
367367
StringBuilder sb = new StringBuilder();
368368
// for a given row, walk the columns
369-
for (int col = 0; col < scArray.Length; col++)
369+
for (int col = 0; col < stringListArray.Length; col++)
370370
{
371371
// if the column is the last column with content, we need to trim trailing whitespace, unless there is only one row
372372
if (col == lastColWithContent[row] && screenRows > 1)
373373
{
374-
sb.Append(scArray[col][row].TrimEnd());
374+
sb.Append(stringListArray[col][row].TrimEnd());
375375
}
376376
else
377377
{
378-
sb.Append(scArray[col][row]);
378+
sb.Append(stringListArray[col][row]);
379379
}
380380
}
381381

@@ -387,19 +387,19 @@ private string[] GenerateTableRow(string[] values, ReadOnlySpan<int> alignment,
387387

388388
private List<string> GenerateMultiLineRowField(string val, int k, int alignment, DisplayCells dc, bool addPadding)
389389
{
390-
List<string> sc = StringManipulationHelper.GenerateLines(dc, val,
390+
List<string> lines = StringManipulationHelper.GenerateLines(dc, val,
391391
_si.columnInfo[k].width, _si.columnInfo[k].width);
392392
if (addPadding || alignment == TextAlignment.Right || alignment == TextAlignment.Center)
393393
{
394394
// if length is shorter, do some padding
395-
for (int col = 0; col < sc.Count; col++)
395+
for (int col = 0; col < lines.Count; col++)
396396
{
397-
if (dc.Length(sc[col]) < _si.columnInfo[k].width)
398-
sc[col] = GenerateRowField(sc[col], _si.columnInfo[k].width, alignment, dc, addPadding);
397+
if (dc.Length(lines[col]) < _si.columnInfo[k].width)
398+
lines[col] = GenerateRowField(lines[col], _si.columnInfo[k].width, alignment, dc, addPadding);
399399
}
400400
}
401401

402-
return sc;
402+
return lines;
403403
}
404404

405405
private string GenerateRow(string[] values, ReadOnlySpan<int> alignment, DisplayCells dc)

0 commit comments

Comments
 (0)
0