packages/apps/AndroidTerm
Revision | c4b50ab98ce60a551d2f72876c31c0fecde037cb (tree) |
---|---|
Zeit | 2012-03-26 10:21:42 |
Autor | Steven Luo <steven+android@stev...> |
Commiter | Jack Palevich |
Fix emission of combining characters following wide characters in transcript
At the moment, combining characters which follow an East Asian wide
character are not being stored in the same column as the characters they
modify. Fix this by keeping track of the width of the last spacing mark
emitted and using this to place combining characters into the correct
column.
Signed-off-by: Jack Palevich <jackpal@google.com>
@@ -234,6 +234,12 @@ public class TerminalEmulator { | ||
234 | 234 | private boolean mAboutToAutoWrap; |
235 | 235 | |
236 | 236 | /** |
237 | + * The width of the last emitted spacing character. Used to place | |
238 | + * combining characters into the correct column. | |
239 | + */ | |
240 | + private int mLastEmittedCharWidth = 0; | |
241 | + | |
242 | + /** | |
237 | 243 | * True if we just auto-wrapped and no character has been emitted on this |
238 | 244 | * line yet. Used to ensure combining characters following a character |
239 | 245 | * at the edge of the screen are stored in the proper place. |
@@ -1430,9 +1436,9 @@ public class TerminalEmulator { | ||
1430 | 1436 | if (width == 0) { |
1431 | 1437 | // Combining character -- store along with character it modifies |
1432 | 1438 | if (mJustWrapped) { |
1433 | - mScreen.set(mColumns - 1, mCursorRow - 1, c, foreColor, backColor); | |
1439 | + mScreen.set(mColumns - mLastEmittedCharWidth, mCursorRow - 1, c, foreColor, backColor); | |
1434 | 1440 | } else { |
1435 | - mScreen.set(mCursorCol - 1, mCursorRow, c, foreColor, backColor); | |
1441 | + mScreen.set(mCursorCol - mLastEmittedCharWidth, mCursorRow, c, foreColor, backColor); | |
1436 | 1442 | } |
1437 | 1443 | } else { |
1438 | 1444 | mScreen.set(mCursorCol, mCursorRow, c, foreColor, backColor); |
@@ -1444,6 +1450,9 @@ public class TerminalEmulator { | ||
1444 | 1450 | } |
1445 | 1451 | |
1446 | 1452 | mCursorCol = Math.min(mCursorCol + width, mColumns - 1); |
1453 | + if (width > 0) { | |
1454 | + mLastEmittedCharWidth = width; | |
1455 | + } | |
1447 | 1456 | } |
1448 | 1457 | |
1449 | 1458 | private void emit(int c) { |