]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/terminal/terminalpanel.cpp
port to KIO::createDefaultJobUiDelegate
[dolphin.git] / src / panels / terminal / terminalpanel.cpp
index 86d3fd55573f2ee284458c63061ae9c5a9b1d1b0..22f840f5c930c7cd58cf31b9984bb5ee62baec36 100644 (file)
@@ -239,18 +239,10 @@ void TerminalPanel::sendCdToTerminal(const QString& dir, HistoryPolicy addToHist
         return;
     }
 
-#ifndef Q_OS_WIN
-    if (!m_clearTerminal) {
-        // The TerminalV2 interface does not provide a way to delete the
-        // current line before sending a new input. This is mandatory,
-        // otherwise sending a 'cd x' to a existing 'rm -rf *' might
-        // result in data loss. As workaround SIGINT is sent.
-        const int processId = m_terminal->terminalProcessId();
-        if (processId > 0) {
-            kill(processId, SIGINT);
-        }
-    }
-#endif
+    // Send prior Ctrl-E, Ctrl-U to ensure the line is empty. This is
+    // mandatory, otherwise sending a 'cd x\n' to a prompt with 'rm -rf *'
+    // would result in data loss.
+    m_terminal->sendInput(QStringLiteral("\x05\x15"));
 
     // We want to ignore the currentDirectoryChanged(QString) signal, which we will receive after
     // the directory change, because this directory change is not caused by a "cd" command that the