Skip to content

Commit 8a6ad63

Browse files
committed
cleanup warnings
1 parent 18eeafc commit 8a6ad63

4 files changed

Lines changed: 12 additions & 17 deletions

File tree

src/XTerm.NET.Tests/Buffer/BufferTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ public void ScrollUp_PreservesScrollbackContent()
632632
// Mark each initial line with a unique identifier
633633
for (int i = 0; i < 5; i++)
634634
{
635-
var line = buffer.Lines[i];
635+
var line = buffer.Lines[i]!;
636636
var cell = new BufferCell(((char)('A' + i)).ToString(), 1, AttributeData.Default);
637637
line.SetCell(0, ref cell);
638638
}

src/XTerm.NET/Buffer/TerminalBuffer.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class TerminalBuffer
2222
/// The absolute line index of the top of the viewport in the buffer.
2323
/// In XTerm.js this is 'ydisp'. This represents the current scroll position.
2424
/// </summary>
25-
public int ViewportY
26-
{
25+
public int ViewportY
26+
{
2727
get => _yDisp;
2828
set => _yDisp = Math.Clamp(value, 0, _yBase);
2929
}
@@ -144,20 +144,20 @@ public void ScrollUp(int lines, bool isWrapped = false)
144144
// When scrollTop is 0, the top line goes into scrollback.
145145
// In xterm.js: push new line first, then increment yBase and yDisp.
146146
// This causes the circular list to potentially recycle the oldest line.
147-
147+
148148
// Check if we're at max capacity - if so, yBase stays the same but
149149
// the buffer rotates. If not, yBase increments.
150150
var willBeRecycled = _lines.Length >= _lines.MaxLength;
151-
151+
152152
// Push the new line at the end (bottom of screen in buffer terms)
153153
_lines.Push(newLine);
154-
154+
155155
// Only increment yBase if the buffer didn't recycle
156156
if (!willBeRecycled)
157157
{
158158
_yBase++;
159159
}
160-
160+
161161
// If yDisp was at the bottom, keep it there
162162
if (_yDisp + 1 < _yBase)
163163
{
@@ -348,9 +348,12 @@ public string PrintViewport()
348348
for (int i = 0; i < _rows; i++)
349349
{
350350
var line = GetLine(_yDisp + i);
351-
foreach(var cell in line)
351+
if (line != null)
352352
{
353-
sb.Append(cell.Content);
353+
foreach (var cell in line)
354+
{
355+
sb.Append(cell.Content);
356+
}
354357
}
355358
sb.AppendLine();
356359
}

src/XTerm.NET/InputHandler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ public void Print(string data)
108108
{
109109
return; // Successfully combined, don't create new cell
110110
}
111-
else
112-
;
113111
// If we can't combine (e.g., at start of line), fall through to normal handling
114112
}
115113
}

src/XTerm.NET/Parser/EscapeSequenceParser.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public class EscapeSequenceParser
1313
{
1414
private ParserState _state;
1515
private readonly Params _params;
16-
private int _currentParam;
1716
private readonly StringBuilder _collect;
1817
private readonly StringBuilder _osc;
1918
private readonly StringBuilder _dcs;
@@ -53,7 +52,6 @@ public EscapeSequenceParser()
5352
{
5453
_state = ParserState.Ground;
5554
_params = new Params();
56-
_currentParam = 0;
5755
_collect = new StringBuilder();
5856
_osc = new StringBuilder();
5957
_dcs = new StringBuilder();
@@ -255,7 +253,6 @@ private void Transition(ParserState newState)
255253
{
256254
_params.Reset();
257255
_collect.Clear();
258-
_currentParam = 0;
259256
}
260257
break;
261258
}
@@ -269,7 +266,6 @@ private void Transition(ParserState newState)
269266
case ParserState.DcsEntry:
270267
_params.Reset();
271268
_collect.Clear();
272-
_currentParam = 0;
273269
_params.AddParam(0);
274270
break;
275271

@@ -305,7 +301,6 @@ private void Param(int code)
305301
if (code == 0x3B) // ;
306302
{
307303
_params.AddParam(0);
308-
_currentParam = 0;
309304
}
310305
else if (code >= 0x30 && code <= 0x39) // 0-9
311306
{
@@ -375,7 +370,6 @@ public void Reset()
375370
{
376371
_state = ParserState.Ground;
377372
_params.Reset();
378-
_currentParam = 0;
379373
_collect.Clear();
380374
_osc.Clear();
381375
_dcs.Clear();

0 commit comments

Comments
 (0)