diff --git a/plugins/terminal/resources/META-INF/terminal.xml b/plugins/terminal/resources/META-INF/terminal.xml
index 75f7813f3113..46065bc3c7d8 100644
--- a/plugins/terminal/resources/META-INF/terminal.xml
+++ b/plugins/terminal/resources/META-INF/terminal.xml
@@ -28,6 +28,8 @@
description="Enable new terminal for PowerShell on Windows 11"/>
+
{
- // Simulate pressing Ctrl+Home to delete all the characters from
- // the cursor's position to the beginning of a line.
- terminal.getCodeForKey(VK_HOME, CTRL_MASK)!!.toString(Charsets.UTF_8)
+ // TODO SystemInfo will not work for SSH and WSL sessions.
+ when {
+ SystemInfo.isUnix -> {
+ SHORTCUT_CTRL_U
+ }
+ else -> {
+ // Simulate pressing Ctrl+Home to delete all the characters from
+ // the cursor's position to the beginning of a line.
+ terminal.getCodeForKey(VK_HOME, CTRL_MASK)!!.toString(Charsets.UTF_8)
+ }
+ }
}
// Simulate pressing Ctrl+U in the terminal to clear all typings in the prompt (IDEA-337692)
- else -> "\u0015"
+ else -> SHORTCUT_CTRL_U
}
}
@@ -331,6 +340,7 @@ internal class ShellCommandExecutionManager(private val session: BlockTerminalSe
companion object {
private val NEXT_REQUEST_ID = AtomicInteger(0)
private const val GENERATOR_COMMAND = "__jetbrains_intellij_run_generator"
+ private const val SHORTCUT_CTRL_U = "\u0015"
@Suppress("SpellCheckingInspection")
private val pwshCharsToEscape: Map = mapOf(
diff --git a/plugins/terminal/tests/org/jetbrains/plugins/terminal/exp/util/TerminalSessionTestUtil.kt b/plugins/terminal/tests/org/jetbrains/plugins/terminal/exp/util/TerminalSessionTestUtil.kt
index 00790aa617eb..8cf16ba489fb 100644
--- a/plugins/terminal/tests/org/jetbrains/plugins/terminal/exp/util/TerminalSessionTestUtil.kt
+++ b/plugins/terminal/tests/org/jetbrains/plugins/terminal/exp/util/TerminalSessionTestUtil.kt
@@ -39,6 +39,7 @@ internal object TerminalSessionTestUtil {
Registry.get(LocalBlockTerminalRunner.BLOCK_TERMINAL_FISH_REGISTRY).setValue(true, parentDisposable)
Registry.get(LocalBlockTerminalRunner.BLOCK_TERMINAL_POWERSHELL_WIN11_REGISTRY).setValue(true, parentDisposable)
Registry.get(LocalBlockTerminalRunner.BLOCK_TERMINAL_POWERSHELL_WIN10_REGISTRY).setValue(true, parentDisposable)
+ Registry.get(LocalBlockTerminalRunner.BLOCK_TERMINAL_POWERSHELL_UNIX_REGISTRY).setValue(true, parentDisposable)
val runner = LocalBlockTerminalRunner(project)
val baseOptions = ShellStartupOptions.Builder().shellCommand(listOf(shellPath)).initialTermSize(initialTermSize)
.envVariables(mapOf(EnvironmentUtil.DISABLE_OMZ_AUTO_UPDATE to "true"))