title: Powershell ISE addon working when using GUI menu but not when using its assigned custom keyboard shortcut
body: <p>I still use the ISE on occasion and decided to attempt a custom ISE addon that emulates VS Code's Delete Line <code>Ctrl+Shift+K</code> keyboard shortcut.  For the moment, this rough draft doesn't delete multiple lines if selected (that functionality will be added later), only the line the cursor is on:<BR></p>
  <pre><code>[void]$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(&quot;Delete Line&quot;, {
      $psise.CurrentFile.Editor.SelectCaretLine()
      [System.Windows.Forms.SendKeys]::SendWait(&quot;{DEL}&quot;)
      [System.Windows.Forms.SendKeys]::SendWait(&quot;{DEL}&quot;)
  }, &quot;Ctrl+Shift+K&quot;)
  </code></pre>
  <p>What I discovered is that this runs as intended when using clicking on the ISE's menu (<code>Add-ons &gt; Delete Line</code>) but not when using its assigned keyboard shortcut (<code>Ctrl+Shift+K</code>).  Using the keyboard shortcut runs everything I've put in the code block thus far except the SendWait() method(s).<BR><BR>The result when using the keyboard shortcut is what you would expect <code>$psise.CurrentFile.Editor.SelectCaretLine()</code> to do - highlight the line that the cursor is currently on - it just doesn't send 'Delete' twice.  The console output is identical when using either method (GUI vs keyboard shortcut).  I've run into some goofy things when using Winforms classes within the ISE, but the difference in behavior between using the ISE Add-ons menu vs keyboard shortcut is new to me.  I've googled for PowerShell ISE SendKeys and ISE SendWait etc and have come up empty.<BR><BR>I'm open to suggestions on a better method (regex, pinvoke/embedded Win32, etc) but am hoping to gain some insight into what's happening under the hood within ISE.<BR><BR>I know, I know - I already use VS Code for a lot and ISE is dying, but this has me curious now and I'd like to know either how to fix this or at least understand why the SendWait method isn't playing well with the ISE.<BR><BR>Any help is much appreciated!</p>