Commit efca9088 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Fix previous commits changing some \r to \n

f016a0f8 incorrectly changed all
sendTextToTerminal to send an \n - some previously had \r
parent 1cb76ffc
......@@ -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
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment