-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[O
erroneously inputted after exiting from Neovim 0.7.0 in latest Terminal Preview
#13238
Comments
Is it |
Oh, you're right, |
[0
erroneously inputted after exiting from Neovim 0.7.0 in latest Terminal Preview[O
erroneously inputted after exiting from Neovim 0.7.0 in latest Terminal Preview
Hmm. Brainstorming, not debugging.
that's where I should start looking. What does neovim do on exit. |
Just to add one datapoint, latest Alacritty handles it correctly, not sure if it supports Focus events. |
FYI, I had a brief look at this, and Neovim does turn off focus events on exit, but prior to that happening, it appears that someone is calling |
It looks like there was an issue open on Neovim for something similar: neovim/neovim#17985 |
will continue adding notes here...
Thanks for that! That really made this investigation WAY easier.
The 0th process in the list is the one that sent it Looks like the message is coming from neovim.
So, the console is in VT input mode, and is expecting the client can accept focus events. So this must be happening before neovim disables focus events mode... Yep. Sticking a breakpoint in |
neovim is sending a win32 console focus event right as it exits? I can't fathom why they'd do that: a synthetic focus event doesn't even say anything about the state of the world -- the absolute best it can accomplish is making a console app think it's in focus when it actually doesn't have win32 focus... |
Yea why are they doing that?
I guess that doesn't explicitly state "don't use this", but why |
@justinmk any chances you know how/why neovim would be doing this? I reckon this is something that should get moved over to neovim, but I just want to be sure. |
Probably not intentional.
Maybe. If someone decides to create an issue at Nvim, please reference this issue. |
Filed neovim/neovim#18899 for investigation. Theoretically, we might be able to route input in such a way that focus events from the API don't hit this path. Ultimately, I am curious why this is being sent in the first place. That might affect the route we want to go in mitigating this. |
Hmm. Considering this is something who's root cause is up in libuv (neovim/neovim#18899 (comment)), maybe we do need to think about this. |
@zadjii-msft I'm quite partial to your idea of not sending the If you look at the So I was thinking we could add a flag in |
Note that this fix works for both conhost and Terminal. In the case of conhost, the genuine |
Sync'd with Dustin, I think we're both cool with the |
As described in #13238. libuv sends a focus event to jiggle the handle. Now that we support focus events as VT input (#12900), we'd translate those focus events to VT input as well. That combination of things caused exiting neovim to emit a `\x1b[O` to the input line of the shell when exited. To fix this, we're going to secretly filter out any focus events that came from the API, before translating to VT. We're fortunate here, the `FOCUS_EVENT_RECORD` version of the ctor is only called by the API. * [x] Closes #13238
As described in #13238. libuv sends a focus event to jiggle the handle. Now that we support focus events as VT input (#12900), we'd translate those focus events to VT input as well. That combination of things caused exiting neovim to emit a `\x1b[O` to the input line of the shell when exited. To fix this, we're going to secretly filter out any focus events that came from the API, before translating to VT. We're fortunate here, the `FOCUS_EVENT_RECORD` version of the ctor is only called by the API. * [x] Closes #13238 (cherry picked from commit b22684e) Service-Card-Id: 83027721 Service-Version: 1.14
🎉This issue was addressed in #13260, which has now been successfully released as Handy links: |
🎉This issue was addressed in #13260, which has now been successfully released as Handy links: |
This is an improved fix for #13238. Instead of handling focus events in the `TerminalInput::HandleKey` function and the need to filter them out depending on where they came from, we simply don't call `HandleKey` in the first place. This makes the somewhat unreliable `CameFromApi` function unnecessary and the code a bit more robust. This change is required because `CameFromApi` is not representable in a `INPUT_RECORD` and I'm getting rid of `IInputEvent`. ## Validation Steps Performed * No `[O` when exiting nvim ✅ * Mouse input in nvim works ✅
Windows Terminal version
1.14.1451.0
Windows build number
10.0.19044.1706
Other Software
Neovim 0.7.0 (https://github.com/neovim/neovim/releases/tag/v0.7.0)
Steps to reproduce
nvim
in your shell (works both incmd
andpwsh
):q
)Expected Behavior
Neovim exits, nothing else happens.
Actual Behavior
Neovim exits, and the shell receives
[O
on its console input.My guess would be that the characters are part of a response to some VT escape code from Neovim, but for some reason they get written separately and the shell gets them instead of Neovim.
The text was updated successfully, but these errors were encountered: