• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

packages/apps/AndroidTerm


Commit MetaInfo

Revision2f06c89e67fed7c19d921a7762a4a95fe2c9a358 (tree)
Zeit2012-03-26 10:21:22
AutorSteven Luo <steven+android@stev...>
CommiterJack Palevich

Log Message

Deal with null row color when getting transcript with colors

Signed-off-by: Jack Palevich <jackpal@google.com>

Ändern Zusammenfassung

Diff

--- a/src/jackpal/androidterm/session/TranscriptScreen.java
+++ b/src/jackpal/androidterm/session/TranscriptScreen.java
@@ -371,13 +371,21 @@ public class TranscriptScreen implements Screen {
371371 builder.append(line, 0, lastPrintingChar + 1);
372372 if (colors != null) {
373373 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);
381389 }
382390 }
383391 }
--- a/src/jackpal/androidterm/util/UnicodeTranscript.java
+++ b/src/jackpal/androidterm/util/UnicodeTranscript.java
@@ -88,6 +88,10 @@ public class UnicodeTranscript {
8888 return mDefaultBackColor;
8989 }
9090
91+ public byte getDefaultColorsEncoded() {
92+ return encodeColor(mDefaultForeColor, mDefaultBackColor);
93+ }
94+
9195 public int getActiveTranscriptRows() {
9296 return mActiveTranscriptRows;
9397 }