@@ -61,6 +61,7 @@ public AnsiPrintStream(PrintStream ps) { // expected diff with AnsiOutputStream.
61
61
private static final int LOOKING_FOR_OSC_COMMAND_END = 6 ;
62
62
private static final int LOOKING_FOR_OSC_PARAM = 7 ;
63
63
private static final int LOOKING_FOR_ST = 8 ;
64
+ private static final int LOOKING_FOR_CHARSET = 9 ;
64
65
65
66
int state = LOOKING_FOR_FIRST_ESC_CHAR ;
66
67
@@ -69,6 +70,8 @@ public AnsiPrintStream(PrintStream ps) { // expected diff with AnsiOutputStream.
69
70
private static final int SECOND_OSC_CHAR = ']' ;
70
71
private static final int BEL = 7 ;
71
72
private static final int SECOND_ST_CHAR = '\\' ;
73
+ private static final int SECOND_CHARSET0_CHAR = '(' ;
74
+ private static final int SECOND_CHARSET1_CHAR = ')' ;
72
75
73
76
@ Override
74
77
protected boolean filter (int data ) { // expected diff with AnsiOutputStream.java
@@ -87,6 +90,12 @@ protected boolean filter(int data) { // expected diff with AnsiOutputStream.java
87
90
state = LOOKING_FOR_NEXT_ARG ;
88
91
} else if (data == SECOND_OSC_CHAR ) {
89
92
state = LOOKING_FOR_OSC_COMMAND ;
93
+ } else if (data == SECOND_CHARSET0_CHAR ) {
94
+ options .add (new Integer ('0' ));
95
+ state = LOOKING_FOR_CHARSET ;
96
+ } else if (data == SECOND_CHARSET1_CHAR ) {
97
+ options .add (new Integer ('1' ));
98
+ state = LOOKING_FOR_CHARSET ;
90
99
} else {
91
100
reset (false );
92
101
}
@@ -189,6 +198,11 @@ protected boolean filter(int data) { // expected diff with AnsiOutputStream.java
189
198
state = LOOKING_FOR_OSC_PARAM ;
190
199
}
191
200
break ;
201
+
202
+ case LOOKING_FOR_CHARSET :
203
+ options .add (new Character ((char ) data ));
204
+ reset (processCharsetSelect (options ));
205
+ break ;
192
206
}
193
207
194
208
// Is it just too long?
@@ -726,6 +740,21 @@ protected void processChangeWindowTitle(String label) {
726
740
protected void processUnknownOperatingSystemCommand (int command , String param ) {
727
741
}
728
742
743
+ /**
744
+ * Process character set sequence.
745
+ * @param options
746
+ * @return true if the charcter set select command was processed.
747
+ */
748
+ private boolean processCharsetSelect (ArrayList <Object > options ) {
749
+ int set = optionInt (options , 0 );
750
+ char seq = ((Character ) options .get (1 )).charValue ();
751
+ processCharsetSelect (set , seq );
752
+ return true ;
753
+ }
754
+
755
+ protected void processCharsetSelect (int set , char seq ) {
756
+ }
757
+
729
758
private int optionInt (ArrayList <Object > options , int index ) {
730
759
if (options .size () <= index )
731
760
throw new IllegalArgumentException ();
0 commit comments