@@ -7,21 +7,21 @@ import { MonitorModel } from '../../monitor-model';
7
7
import { Unknown } from '../../../common/nls' ;
8
8
9
9
class RingList {
10
- protected ring : string [ ] ;
11
- protected size : number ;
12
- protected begin : number ;
13
- protected index : number ;
14
- protected end : number ;
10
+ private ring : string [ ] ;
11
+ private size : number ;
12
+ private begin : number ;
13
+ private index : number ;
14
+ private end : number ;
15
15
16
16
constructor ( size : number = 100 ) {
17
- this . Init = this . Init . bind ( this ) ;
18
- this . Push = this . Push . bind ( this ) ;
19
- this . Prev = this . Prev . bind ( this ) ;
20
- this . Next = this . Next . bind ( this ) ;
21
- this . Init ( size ) ;
17
+ this . init = this . init . bind ( this ) ;
18
+ this . push = this . push . bind ( this ) ;
19
+ this . prev = this . prev . bind ( this ) ;
20
+ this . next = this . next . bind ( this ) ;
21
+ this . init ( size ) ;
22
22
}
23
23
24
- public Init ( size : number = 100 )
24
+ private init ( size : number = 100 )
25
25
{
26
26
this . ring = [ ] ;
27
27
this . size = ( size > 0 ) ? size : 1 ;
@@ -30,7 +30,7 @@ class RingList {
30
30
this . end = - 1 ;
31
31
}
32
32
33
- public Push ( val : string ) : number {
33
+ push ( val : string ) : number {
34
34
this . end ++ ;
35
35
if ( this . ring . length >= this . size )
36
36
{
@@ -49,9 +49,9 @@ class RingList {
49
49
return this . index ;
50
50
}
51
51
52
- public Prev ( ) : string {
52
+ prev ( ) : string {
53
53
if ( this . ring . length < 1 ) {
54
- return "" ;
54
+ return '' ;
55
55
}
56
56
57
57
if ( this . index !== this . begin ) {
@@ -61,9 +61,9 @@ class RingList {
61
61
return this . ring [ this . index ] ;
62
62
}
63
63
64
- public Next ( ) : string {
64
+ next ( ) : string {
65
65
if ( this . ring . length < 1 ) {
66
- return "" ;
66
+ return '' ;
67
67
}
68
68
69
69
if ( this . index !== this . end ) {
@@ -72,7 +72,6 @@ class RingList {
72
72
73
73
return this . ring [ this . index ] ;
74
74
}
75
-
76
75
}
77
76
78
77
export namespace SerialMonitorSendInput {
@@ -183,14 +182,16 @@ export class SerialMonitorSendInput extends React.Component<
183
182
// NOTE: order of operations is critical here. Push the current state.text
184
183
// onto the history stack before sending. After sending, state.text is empty
185
184
// and you'd end up pushing '' onto the history stack.
186
- if ( this . state . text . length > 0 ) this . state . history . Push ( this . state . text ) ;
185
+ if ( this . state . text . length > 0 ) {
186
+ this . state . history . push ( this . state . text ) ;
187
+ }
187
188
this . onSend ( ) ;
188
- } else
189
- if ( key === Key . ARROW_UP ) {
190
- this . setState ( { text : this . state . history . Prev ( ) } ) ;
191
- } else
192
- if ( key === Key . ARROW_DOWN ) {
193
- this . setState ( { text : this . state . history . Next ( ) } ) ;
189
+ }
190
+ else if ( key === Key . ARROW_UP ) {
191
+ this . setState ( { text : this . state . history . prev ( ) } ) ;
192
+ }
193
+ else if ( key === Key . ARROW_DOWN ) {
194
+ this . setState ( { text : this . state . history . next ( ) } ) ;
194
195
}
195
196
}
196
197
}
0 commit comments