OSDN Git Service

Fix insert and delete line code.
authorJack Palevich <jackpal@google.com>
Sat, 18 Jun 2011 11:40:54 +0000 (19:40 +0800)
committerJack Palevich <jackpal@google.com>
Sat, 18 Jun 2011 13:19:50 +0000 (21:19 +0800)
Thanks to Sam Jacobson <sam.jacobson@snitchinc.com> for the
bug report and fix!

src/jackpal/androidterm/Term.java

index e636b03..7a039a7 100644 (file)
@@ -1043,7 +1043,7 @@ class TranscriptScreen implements Screen {
                 || dy + h > mScreenRows) {
             throw new IllegalArgumentException();
         }
-        if (sy <= dy) {
+        if (sy > dy) {
             // Move in increasing order
             for (int y = 0; y < h; y++) {
                 int srcOffset = getOffset(sx, sy + y);
@@ -1838,10 +1838,10 @@ class TerminalEmulator {
             break;
 
         case 'M': // Reverse index
-            if (mCursorRow == 0) {
-                mScreen.blockCopy(0, mTopMargin + 1, mColumns, mBottomMargin
-                        - (mTopMargin + 1), 0, mTopMargin);
-                blockClear(0, mBottomMargin - 1, mColumns);
+            if (mCursorRow <= mTopMargin) {
+                mScreen.blockCopy(0, mTopMargin, mColumns, mBottomMargin
+                        - (mTopMargin + 1), 0, mTopMargin + 1);
+                blockClear(0, mTopMargin, mColumns);
             } else {
                 mCursorRow--;
             }