terminal: trim command when matching command for smart execution and when smart execu...
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Wed, 12 Aug 2020 16:07:39 +0000 (19:07 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 12 Aug 2020 16:08:06 +0000 (16:08 +0000)
GitOrigin-RevId: 48dd7913e0288df8d2f6c1e095310e7b6dc3fe59

plugins/terminal/src/org/jetbrains/plugins/terminal/ShellTerminalWidget.java
plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalShellCommandHandlerHelper.java

index 1ebd6076c22c32bf811e09427e82f43840ef32e1..bcb16702099f0d6e6c2b2370623ba9ef274a2252 100644 (file)
@@ -57,7 +57,7 @@ public class ShellTerminalWidget extends JBTerminalWidget {
 
       if (e.getKeyCode() == KeyEvent.VK_ENTER || TerminalShellCommandHandlerHelper.matchedExecutor(e) != null) {
         TerminalUsageTriggerCollector.Companion.triggerCommandExecuted(myProject);
-        if (myShellCommandHandlerHelper.processEnterKeyPressed(getTypedShellCommand(), e)) {
+        if (myShellCommandHandlerHelper.processEnterKeyPressed(e)) {
           e.consume();
         }
         if (!e.isConsumed()) {
index 65e4d9d9582a12841addc585a13e583550b5caf3..518dde539e13a2883e6620e96e1848827825a014 100644 (file)
@@ -204,11 +204,12 @@ public final class TerminalShellCommandHandlerHelper {
     });
   }
 
-  public boolean processEnterKeyPressed(@NotNull String command, @NotNull KeyEvent keyPressed) {
+  public boolean processEnterKeyPressed(@NotNull KeyEvent keyPressed) {
     if (!isFeatureEnabled() || !isEnabledForProject()) {
       onShellCommandExecuted();
       return false;
     }
+    String command = myWidget.getTypedShellCommand().trim();
     if (LOG.isDebugEnabled()) {
       LOG.debug("typed shell command to execute: " + command);
     }