Extended keyboard: allow inline input

Ff the buffer is empty, send a newline, otherwise send the content of
the buffer with the newline stripped. This way <Enter><Enter> means
"insert the buffer content and send a newline", while a single <Enter>
means just "insert the buffer content". Fixes #261.
This commit is contained in:
Fredrik Fornwall
2017-02-28 00:42:36 +01:00
parent 29e62e608f
commit fc92a27cb2

View File

@@ -250,7 +250,9 @@ public final class TermuxActivity extends Activity implements ServiceConnection
TerminalSession session = getCurrentTermSession();
if (session != null) {
if (session.isRunning()) {
session.write(editText.getText().toString() + "\n");
String textToSend = editText.getText().toString();
if (textToSend.length() == 0) textToSend = "\n";
session.write(textToSend);
} else {
removeFinishedSession(session);
}