From efca9088a3e774d952b1ea74f1a78a88191ff8f3 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sat, 4 Jun 2016 17:05:53 -0400 Subject: [PATCH] Fix previous commits changing some \r to \n f016a0f874d25fdb3941881c7dd4157fa1a32d64 incorrectly changed all sendTextToTerminal to send an \n - some previously had \r --- src/MainWindow.cpp | 2 +- src/Session.cpp | 8 ++------ src/Session.h | 4 ++-- src/SessionController.cpp | 10 +++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 663220f44..f9d0c44ef 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -499,7 +499,7 @@ Session* MainWindow::createSSHSession(Profile::Ptr profile, const QUrl& url) sshCommand += url.host(); } - session->sendTextToTerminal(sshCommand, true); + session->sendTextToTerminal(sshCommand, '\r'); // create view before starting the session process so that the session // doesn't suffer a change in terminal size right after the session diff --git a/src/Session.cpp b/src/Session.cpp index ee2b43bc0..0f17cea43 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -814,13 +814,9 @@ bool Session::closeInForceWay() } } -void Session::sendTextToTerminal(const QString& text, bool addNewline) const +void Session::sendTextToTerminal(const QString& text, const QChar& eol) const { - if (addNewline) { - _emulation->sendText(text + '\n'); - } else { - _emulation->sendText(text); - } + _emulation->sendText(text + eol); } // Only D-Bus calls this function (via SendText or runCommand) diff --git a/src/Session.h b/src/Session.h index fd0680730..6c63175f5 100644 --- a/src/Session.h +++ b/src/Session.h @@ -473,9 +473,9 @@ public slots: /** * Sends @p text to the current foreground terminal program. - * @param addNewline if true, adds a newline "\n" to end of text + * @param eol send this after @p text */ - void sendTextToTerminal(const QString& text, bool addNewline = false) const; + void sendTextToTerminal(const QString& text, const QChar& eol = QChar()) const; #if defined(REMOVE_SENDTEXT_RUNCOMMAND_DBUS_METHODS) void sendText(const QString& text) const; diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 86eb126e2..79db44479 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -293,19 +293,19 @@ void SessionController::openUrl(const QUrl& url) // Clear shell's command line if (!_session->isForegroundProcessActive() && _bookmarkValidProgramsToClear.contains(_session->foregroundProcessName())) { - _session->sendTextToTerminal(QChar(0x03), true); // Ctrl+C + _session->sendTextToTerminal(QChar(0x03), '\n'); // Ctrl+C } // handle local paths if (url.isLocalFile()) { QString path = url.toLocalFile(); - _session->sendTextToTerminal("cd " + KShell::quoteArg(path), true); + _session->sendTextToTerminal("cd " + KShell::quoteArg(path), '\r'); } else if (url.scheme().isEmpty()) { // QUrl couldn't parse what the user entered into the URL field // so just dump it to the shell QString command = url.toDisplayString(); if (!command.isEmpty()) - _session->sendTextToTerminal(command, true); + _session->sendTextToTerminal(command, '\r'); } else if (url.scheme() == "ssh") { QString sshCommand = "ssh "; @@ -318,7 +318,7 @@ void SessionController::openUrl(const QUrl& url) if (!url.host().isEmpty()) { sshCommand += url.host(); } - _session->sendTextToTerminal(sshCommand, true); + _session->sendTextToTerminal(sshCommand, '\r'); } else if (url.scheme() == "telnet") { QString telnetCommand = "telnet "; @@ -333,7 +333,7 @@ void SessionController::openUrl(const QUrl& url) telnetCommand += QString::number(url.port()); } - _session->sendTextToTerminal(telnetCommand, true); + _session->sendTextToTerminal(telnetCommand, '\r'); } else { //TODO Implement handling for other Url types