diff options
author | Kenny Root <kenny@the-b.org> | 2016-01-25 14:18:35 -0800 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2016-01-25 14:18:35 -0800 |
commit | f80e9ec81597428faf07f5379abf680db6bed96a (patch) | |
tree | 9c2bad63d45214c08a8540229af334d87ce525c7 | |
parent | 5a78c97bff8e3615f1940fe28d3aee456f4ab37d (diff) | |
parent | d447731bf5fcf1e13ca3164b7285360b45e150ca (diff) | |
download | connectbot-f80e9ec81597428faf07f5379abf680db6bed96a.tar.gz connectbot-f80e9ec81597428faf07f5379abf680db6bed96a.tar.bz2 connectbot-f80e9ec81597428faf07f5379abf680db6bed96a.zip |
Merge pull request #371 from kruton/stairstep-effect
Avoid stair-stepping local text output
-rw-r--r-- | app/src/main/java/org/connectbot/service/TerminalBridge.java | 28 | ||||
-rw-r--r-- | app/src/main/java/org/connectbot/transport/SSH.java | 4 |
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)); |