aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2016-01-24 23:31:11 -0800
committerKenny Root <kenny@the-b.org>2016-01-24 23:31:11 -0800
commitd447731bf5fcf1e13ca3164b7285360b45e150ca (patch)
tree9c2bad63d45214c08a8540229af334d87ce525c7 /app
parent7f0b65af7d0e3cefed97d103ece01f02834d016e (diff)
downloadconnectbot-d447731bf5fcf1e13ca3164b7285360b45e150ca.tar.gz
connectbot-d447731bf5fcf1e13ca3164b7285360b45e150ca.tar.bz2
connectbot-d447731bf5fcf1e13ca3164b7285360b45e150ca.zip
Avoid stair-stepping local text output
When multi-line output was used, this was creating a stair-step effect. This was most noticable during host-key-has-changed warnings.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/org/connectbot/service/TerminalBridge.java28
-rw-r--r--app/src/main/java/org/connectbot/transport/SSH.java4
2 files changed, 21 insertions, 11 deletions
diff --git a/app/src/main/java/org/connectbot/service/TerminalBridge.java b/app/src/main/java/org/connectbot/service/TerminalBridge.java
index a888cc3..9a1c995 100644
--- a/app/src/main/java/org/connectbot/service/TerminalBridge.java
+++ b/app/src/main/java/org/connectbot/service/TerminalBridge.java
@@ -320,23 +320,31 @@ public class TerminalBridge implements VDUDisplay {
}
/**
- * Convenience method for writing a line into the underlying MUD buffer.
+ * Convenience method for writing text into the underlying terminal buffer.
* Should never be called once the session is established.
*/
- public final void outputLine(String line) {
- if (transport != null && transport.isSessionOpen())
- Log.e(TAG, "Session established, cannot use outputLine!", new IOException("outputLine call traceback"));
+ public final void outputLine(String output) {
+ if (transport != null && transport.isSessionOpen()) {
+ Log.e(TAG, "Session established, cannot use outputLine!",
+ new IOException("outputLine call traceback"));
+ }
synchronized (localOutput) {
- final String s = line + "\r\n";
+ for (String line : output.split("\n")) {
+ if (line.length() > 0 && line.charAt(line.length() - 1) == '\r') {
+ line = line.substring(0, line.length() - 1);
+ }
- localOutput.add(s);
+ final String s = line + "\r\n";
- ((vt320) buffer).putString(s);
+ localOutput.add(s);
- // For accessibility
- final char[] charArray = s.toCharArray();
- propagateConsoleText(charArray, charArray.length);
+ ((vt320) buffer).putString(s);
+
+ // For accessibility
+ final char[] charArray = s.toCharArray();
+ propagateConsoleText(charArray, charArray.length);
+ }
}
}
diff --git a/app/src/main/java/org/connectbot/transport/SSH.java b/app/src/main/java/org/connectbot/transport/SSH.java
index 79b1d99..158b2c9 100644
--- a/app/src/main/java/org/connectbot/transport/SSH.java
+++ b/app/src/main/java/org/connectbot/transport/SSH.java
@@ -185,9 +185,11 @@ public class SSH extends AbsTransport implements ConnectionMonitor, InteractiveC
String border = new String(atsigns);
bridge.outputLine(border);
- bridge.outputLine(manager.res.getString(R.string.host_verification_failure_warning));
+ bridge.outputLine(header);
bridge.outputLine(border);
+ bridge.outputLine(manager.res.getString(R.string.host_verification_failure_warning));
+
bridge.outputLine(String.format(manager.res.getString(R.string.host_fingerprint),
algorithmName, fingerprint));