packages/apps/AndroidTerm
Revision | 2f06c89e67fed7c19d921a7762a4a95fe2c9a358 (tree) |
---|---|
Zeit | 2012-03-26 10:21:22 |
Autor | Steven Luo <steven+android@stev...> |
Commiter | Jack Palevich |
Deal with null row color when getting transcript with colors
Signed-off-by: Jack Palevich <jackpal@google.com>
@@ -371,13 +371,21 @@ public class TranscriptScreen implements Screen { | ||
371 | 371 | builder.append(line, 0, lastPrintingChar + 1); |
372 | 372 | if (colors != null) { |
373 | 373 | int column = 0; |
374 | - for (int j = 0; j < lastPrintingChar + 1; ++j) { | |
375 | - colors.append((char) rowColorBuffer[column]); | |
376 | - if (Character.isHighSurrogate(line[j])) { | |
377 | - column += UnicodeTranscript.charWidth(Character.toCodePoint(line[j], line[j+1])); | |
378 | - ++j; | |
379 | - } else { | |
380 | - column += UnicodeTranscript.charWidth(line[j]); | |
374 | + if (rowColorBuffer != null) { | |
375 | + for (int j = 0; j < lastPrintingChar + 1; ++j) { | |
376 | + colors.append((char) rowColorBuffer[column]); | |
377 | + if (Character.isHighSurrogate(line[j])) { | |
378 | + column += UnicodeTranscript.charWidth( | |
379 | + Character.toCodePoint(line[j], line[j+1])); | |
380 | + ++j; | |
381 | + } else { | |
382 | + column += UnicodeTranscript.charWidth(line[j]); | |
383 | + } | |
384 | + } | |
385 | + } else { | |
386 | + char defaultColor = (char) mData.getDefaultColorsEncoded(); | |
387 | + for (int j = 0; j < lastPrintingChar + 1; ++j) { | |
388 | + colors.append(defaultColor); | |
381 | 389 | } |
382 | 390 | } |
383 | 391 | } |
@@ -88,6 +88,10 @@ public class UnicodeTranscript { | ||
88 | 88 | return mDefaultBackColor; |
89 | 89 | } |
90 | 90 | |
91 | + public byte getDefaultColorsEncoded() { | |
92 | + return encodeColor(mDefaultForeColor, mDefaultBackColor); | |
93 | + } | |
94 | + | |
91 | 95 | public int getActiveTranscriptRows() { |
92 | 96 | return mActiveTranscriptRows; |
93 | 97 | } |