diff options
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 25 | ||||
-rw-r--r-- | src/org/connectbot/PubkeyListActivity.java | 10 | ||||
-rw-r--r-- | src/org/connectbot/TerminalView.java | 7 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalManager.java | 2 | ||||
-rw-r--r-- | src/org/connectbot/util/PubkeyDatabase.java | 4 |
5 files changed, 28 insertions, 20 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index b1cf8b5..a1523cc 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -483,19 +483,20 @@ public class ConsoleActivity extends Activity { // when copying, highlight the area if(copying) { if(copySource == null) return false; - int row = (int)(event.getY() / copySource.bridge.charHeight); - int col = (int)(event.getX() / copySource.bridge.charWidth); + float row = event.getY() / copySource.bridge.charHeight; + float col = event.getX() / copySource.bridge.charWidth; + Log.d(TAG, String.format("X = %f, Y = %f, row = %f, col = %f", event.getX(), event.getY(), row, col)); switch(event.getAction()) { case MotionEvent.ACTION_DOWN: // recording starting area - copySource.top = row; - copySource.left = col; + copySource.top = (int) Math.floor(row); + copySource.left = (int) Math.floor(col); return false; case MotionEvent.ACTION_MOVE: // update selected area - copySource.bottom = row; - copySource.right = col; + copySource.bottom = (int) Math.ceil(row); + copySource.right = (int) Math.ceil(col); copySource.invalidate(); return false; case MotionEvent.ACTION_UP: @@ -510,13 +511,23 @@ public class ConsoleActivity extends Activity { int size = (right - left) * (bottom - top); StringBuffer buffer = new StringBuffer(size); for(int y = top; y < bottom; y++) { + int lastNonSpace = buffer.length(); + for(int x = left; x < right; x++) { // only copy printable chars char c = copySource.bridge.buffer.getChar(x, y); if(c < 32 || c >= 127) c = ' '; + if (c != ' ') + lastNonSpace = buffer.length(); buffer.append(c); } - buffer.append("\n"); + + // Don't leave a bunch of spaces in our copy buffer. + if (buffer.length() > lastNonSpace) + buffer.delete(lastNonSpace + 1, buffer.length()); + + if (y != bottom) + buffer.append("\n"); } clipboard.setText(buffer.toString()); diff --git a/src/org/connectbot/PubkeyListActivity.java b/src/org/connectbot/PubkeyListActivity.java index 14c75f5..24dbdcf 100644 --- a/src/org/connectbot/PubkeyListActivity.java +++ b/src/org/connectbot/PubkeyListActivity.java @@ -23,22 +23,16 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; import java.util.EventListener; import java.util.LinkedList; import java.util.List; -import java.util.concurrent.Semaphore; import org.connectbot.service.TerminalManager; import org.connectbot.util.PubkeyDatabase; import org.connectbot.util.PubkeyUtils; -import com.trilead.ssh2.crypto.PEMDecoder; -import com.trilead.ssh2.crypto.PEMStructure; - import android.app.AlertDialog; import android.app.ListActivity; import android.content.ComponentName; @@ -64,7 +58,6 @@ import android.view.MenuItem.OnMenuItemClickListener; import android.widget.AdapterView; import android.widget.EditText; import android.widget.ImageView; -import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TableRow; import android.widget.TextView; @@ -72,6 +65,9 @@ import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; import android.widget.SimpleCursorAdapter.ViewBinder; +import com.trilead.ssh2.crypto.PEMDecoder; +import com.trilead.ssh2.crypto.PEMStructure; + public class PubkeyListActivity extends ListActivity implements EventListener { public final static String TAG = PubkeyListActivity.class.toString(); diff --git a/src/org/connectbot/TerminalView.java b/src/org/connectbot/TerminalView.java index d544344..01fae16 100644 --- a/src/org/connectbot/TerminalView.java +++ b/src/org/connectbot/TerminalView.java @@ -44,6 +44,7 @@ public class TerminalView extends View { protected final Paint cursorPaint; private Toast notification = null; + private String lastNotification = null; public int top = -1, bottom = -1, left = -1, right = -1; @@ -117,12 +118,18 @@ public class TerminalView extends View { public void notifyUser(String message) { if (notification != null) { + // Don't keep telling the user the same thing. + if (lastNotification != null && lastNotification.equals(message)) + return; + notification.setText(message); notification.show(); } else { notification = Toast.makeText(context, message, Toast.LENGTH_SHORT); notification.show(); } + + lastNotification = message; } /** diff --git a/src/org/connectbot/service/TerminalManager.java b/src/org/connectbot/service/TerminalManager.java index 054e24f..54f7ec1 100644 --- a/src/org/connectbot/service/TerminalManager.java +++ b/src/org/connectbot/service/TerminalManager.java @@ -18,10 +18,8 @@ package org.connectbot.service; -import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; diff --git a/src/org/connectbot/util/PubkeyDatabase.java b/src/org/connectbot/util/PubkeyDatabase.java index fa838e1..f7228b2 100644 --- a/src/org/connectbot/util/PubkeyDatabase.java +++ b/src/org/connectbot/util/PubkeyDatabase.java @@ -21,7 +21,6 @@ package org.connectbot.util; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; -import java.security.PublicKey; import java.security.spec.InvalidKeySpecException; import java.util.LinkedList; import java.util.List; @@ -30,14 +29,11 @@ import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; -import org.connectbot.service.PromptHelper; - import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import android.util.Log; /** * Public Key Encryption database. Contains private and public key pairs |