murex / TCR

TCR (Test && Commit || Revert) utility
MIT License
43 stars 4 forks source link

[Bug]: Response to keypress in solo mode with Jetbrains 2024.1+ IDE's new embedded terminal on Windows #704

Closed mengdaming closed 2 weeks ago

mengdaming commented 2 weeks ago

Contact Details

damien.menanteau@gmail.com

Describe the bug

When using versions of JetBrains Windows IDE's (Intellij, Goland, PyCharm, etc) that come with a new terminal implementation (Cf. this page), TCR's interactive terminal is no longer able, when running in solo mode, to handle keyboard shortcuts as expected (e.g. direct reaction to keypress without pressing the Enter key, as well as disabling keypress echo)

To Reproduce

Steps to reproduce the behavior:

  1. Open a JetBrains Windows IDE with version 2024.1 or newer
  2. Open a terminal (View / Tool Windows / Terminal)
  3. Launch TCR on solo mode: tcr solo
  4. Type one of the provided key shortcuts, for example ?
  5. TCR displays the ? character but does not activate the related action. The user needs to type Enter in order to trigger the action

Expected behavior

Working Environment

  1. OS: Windows 10
  2. JetBrains Goland 2024.1.4
  3. TCR 1.1.0

Additional Context

After investigation, this seems to be related to JetBrain's new terminal implementation periodically resetting Windows console flags ENABLE_LINE_INPUT and ENABLE_ECHO_INPUT values (Cf. https://docs.microsoft.com/en-us/windows/console/setconsolemode) . These flags are disabled by TCR in order to get the expected behaviour in Windows terminals)

Code of Conduct