jackpal/Android-Terminal-Emulator — pull request #140 by steven676 (2012-09-08 17:26:55+00:00)
Title: Fix crash when resizing transcript containing non-BMP or combining characters

Trying to resize a transcript with non-BMP characters or combining characters results in the following crash:

E/AndroidRuntime( 1682): FATAL EXCEPTION: main
E/AndroidRuntime( 1682): java.lang.ArrayIndexOutOfBoundsException: length=264; index=264
E/AndroidRuntime( 1682):	at jackpal.androidterm.emulatorview.TextStyleLine.getStyle(UnicodeTranscript.java:1078)
E/AndroidRuntime( 1682):	at jackpal.androidterm.emulatorview.TranscriptScreen.internalGetTranscriptText(TranscriptScreen.java:353)
E/AndroidRuntime( 1682):	at jackpal.androidterm.emulatorview.TranscriptScreen.getTranscriptText(TranscriptScreen.java:296)
E/AndroidRuntime( 1682):	at jackpal.androidterm.emulatorview.TerminalEmulator.updateSize(TerminalEmulator.java:414)
...

This appears to be a regression introduced by the 256-color series. Included fix very lightly tested on a Nexus S running 4.1.1. (The patches could really use another set of eyes ... the code in question isn't terribly easy to understand even when you don't have a cold.)