Terminus icon indicating copy to clipboard operation
Terminus copied to clipboard

Terminus panel opens without focus on Windows 10

Open ilidemi opened this issue 1 year ago • 4 comments

Steps to reproduce:

  1. Open a folder in ST4
  2. Press the toggle_terminus_panel shortcut, the panel opens
  3. Start typing
  4. Key presses don't register because the entire Sublime Text window went out of focus. Clicking on the panel is necessary to bring it back.

I initially suspected something running on cmd startup and stealing focus, but trying it in a Windows Sandbox on a fresh ST4 + Terminus install results in the same outcome.

ilidemi avatar Oct 29 '24 20:10 ilidemi

Same for normal views. Fixable by forcing the plugin to run on py33.

Noticeable is that on py38 typing lags, e.g. ipython really has some input lag. Downgrading to py33 solves that too.

kaste avatar Dec 15 '24 16:12 kaste

Downgrading worked, thanks for the suggestion!

To save time for anyone hitting this issue in the future, here's how to do it:

  1. Create a new directory %APPDATA%\Sublime Text\Packages\Terminus if one doesn't exist yet
  2. Add a new file .python-version there with content 3.3
  3. Restart Sublime Text

ilidemi avatar Dec 15 '24 22:12 ilidemi

That makes it hard to fix as it looks like -- py38 itself cannot be the cause, can it? -- that the dependencies, the specific versions that load for py38 aren't that good. From top of my head, I wouldn't even know how to find out which versions Terminus use, and if there are newer/older ones that could work. How could we bisect the dependency versions.

Do you actually use the new console/Terminal or the old conhost. I wonder if newer versions try to use the newer console API. I'm running the new one not the legacy. (https://learn.microsoft.com/en-us/windows/console/legacymode)

kaste avatar Dec 16 '24 09:12 kaste

Ok. I cannot reproduce this on the command line, in an ipython repl running 3.8. Code to execute is

>>> from winpty import PtyProcess
>>> proc = PtyProcess.spawn('python') 

The same code also works when I run it in Sublime's py33 console, and it steals/destroys focus when it is run on the py38 console. (But only on the first invocation! A subsequent call will work as usual.) So my hunch is that it is a Sublime issue.

For the lag, it is a known issue https://github.com/andfoy/pywinpty/issues/463 The issue is closed as "wait for upstream" right now.

kaste avatar Dec 16 '24 11:12 kaste