packages/apps/AndroidTerm
Revision | 0ebc55b1d64d501fd959a402e191413f5023d5aa (tree) |
---|---|
Zeit | 2012-03-26 10:21:27 |
Autor | Steven Luo <steven+android@stev...> |
Commiter | Jack Palevich |
Move some getChar() logic from UnicodeTranscript into FullUnicodeLine
Signed-off-by: Jack Palevich <jackpal@google.com>
@@ -691,19 +691,7 @@ public class UnicodeTranscript { | ||
691 | 691 | } |
692 | 692 | |
693 | 693 | FullUnicodeLine line = (FullUnicodeLine) mLines[row]; |
694 | - char[] rawLine = line.getLine(); | |
695 | - int pos = line.findStartOfColumn(column); | |
696 | - int length; | |
697 | - if (column + 1 < mColumns) { | |
698 | - length = line.findStartOfColumn(column + 1) - pos; | |
699 | - } else { | |
700 | - length = line.getSpaceUsed() - pos; | |
701 | - } | |
702 | - if (charIndex >= length) { | |
703 | - throw new IllegalArgumentException(); | |
704 | - } | |
705 | - out[offset] = rawLine[pos + charIndex]; | |
706 | - return (charIndex + 1 < length); | |
694 | + return line.getChar(column, charIndex, out, offset); | |
707 | 695 | } |
708 | 696 | |
709 | 697 | public int getForeColor(int row, int column) { |
@@ -898,6 +886,21 @@ class FullUnicodeLine { | ||
898 | 886 | } |
899 | 887 | } |
900 | 888 | |
889 | + public boolean getChar(int column, int charIndex, char[] out, int offset) { | |
890 | + int pos = findStartOfColumn(column); | |
891 | + int length; | |
892 | + if (column + 1 < mColumns) { | |
893 | + length = findStartOfColumn(column + 1) - pos; | |
894 | + } else { | |
895 | + length = getSpaceUsed() - pos; | |
896 | + } | |
897 | + if (charIndex >= length) { | |
898 | + throw new IllegalArgumentException(); | |
899 | + } | |
900 | + out[offset] = mText[pos + charIndex]; | |
901 | + return (charIndex + 1 < length); | |
902 | + } | |
903 | + | |
901 | 904 | public void setChar(int column, int codePoint) { |
902 | 905 | int columns = mColumns; |
903 | 906 | if (column < 0 || column >= columns) { |