@@ -6,7 +6,7 @@ namespace Terminal.Gui;
6
6
7
7
internal abstract class AnsiResponseParserBase : IAnsiResponseParser
8
8
{
9
- private const char Escape = '\x1B ' ;
9
+ private const char ESCAPE = '\x1B ' ;
10
10
private readonly AnsiMouseParser _mouseParser = new ( ) ;
11
11
protected readonly AnsiKeyboardParser _keyboardParser = new ( ) ;
12
12
protected object _lockExpectedResponses = new ( ) ;
@@ -74,17 +74,17 @@ protected set
74
74
// These all are valid terminators on ansi responses,
75
75
// see CSI in https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s
76
76
// No - N or O
77
- protected readonly HashSet < char > _knownTerminators = new (
78
- [
79
- '@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' ,
80
-
81
- // No - N or O
82
- 'P' , 'Q' , 'R' , 'S' , 'T' , 'W' , 'X' , 'Z' ,
83
- '^' , '`' , '~' ,
84
- 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' ,
85
- 'l' , 'm' , 'n' ,
86
- 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z'
87
- ] ) ;
77
+ protected readonly HashSet < char > _knownTerminators =
78
+ [
79
+ '@' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'G' , 'H' , 'I' , 'J' , 'K' , 'L' , 'M' ,
80
+
81
+ // No - N or O
82
+ 'P' , 'Q' , 'R' , 'S' , 'T' , 'W' , 'X' , 'Z' ,
83
+ '^' , '`' , '~' ,
84
+ 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' ,
85
+ 'l' , 'm' , 'n' ,
86
+ 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z'
87
+ ] ;
88
88
89
89
protected AnsiResponseParserBase ( IHeld heldContent ) { _heldContent = heldContent ; }
90
90
@@ -137,7 +137,7 @@ int inputLength
137
137
char currentChar = getCharAtIndex ( index ) ;
138
138
object currentObj = getObjectAtIndex ( index ) ;
139
139
140
- bool isEscape = currentChar == Escape ;
140
+ bool isEscape = currentChar == ESCAPE ;
141
141
142
142
switch ( State )
143
143
{
@@ -250,7 +250,7 @@ protected void TryLastMinuteSequences ()
250
250
251
251
// We have something totally unexpected, not a CSI and
252
252
// still Esc+<something>. So give last minute swallow chance
253
- if ( cur . Length >= 2 && cur [ 0 ] == Escape )
253
+ if ( cur ! . Length >= 2 && cur [ 0 ] == ESCAPE )
254
254
{
255
255
// Maybe swallow anyway if user has custom delegate
256
256
bool swallow = ShouldSwallowUnexpectedResponse ( ) ;
@@ -328,7 +328,7 @@ protected bool ShouldReleaseHeldContent ()
328
328
329
329
// Finally if it is a valid ansi response but not one we are expect (e.g. its mouse activity)
330
330
// then we can release it back to input processing stream
331
- if ( _knownTerminators . Contains ( cur . Last ( ) ) && cur . StartsWith ( EscSeqUtils . CSI ) )
331
+ if ( _knownTerminators . Contains ( cur ! . Last ( ) ) && cur ! . StartsWith ( EscSeqUtils . CSI ) )
332
332
{
333
333
// We have found a terminator so bail
334
334
State = AnsiResponseParserState . Normal ;
@@ -443,7 +443,7 @@ public bool IsExpecting (string? terminator)
443
443
lock ( _lockExpectedResponses )
444
444
{
445
445
// If any of the new terminator matches any existing terminators characters it's a collision so true.
446
- return _expectedResponses . Any ( r => r . Terminator . Intersect ( terminator ) . Any ( ) ) ;
446
+ return _expectedResponses . Any ( r => r . Terminator ! . Intersect ( terminator ! ) . Any ( ) ) ;
447
447
}
448
448
}
449
449
0 commit comments