Skip to content
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

Split documents (e.g. diffs) with focus on left switches to the right on focus loss #22403

Closed
eamodio opened this issue Mar 10, 2017 · 6 comments
Assignees
Labels
api bug Issue identified by VS Code Team member as probable bug diff-editor Diff editor issues verified Verification succeeded

Comments

@eamodio
Copy link
Contributor

eamodio commented Mar 10, 2017

  • VSCode Version: Code - Insiders 1.11.0-insider (01091bb, 2017-03-10T07:05:03.565Z)
  • OS Version: Darwin x64 16.4.0

Steps to Reproduce:

  1. Open a diff split view
  2. Click into the left side (focus is now on the left "editor")
  3. Click on the statusbar, file tree, something that won't open another editor
  4. The left lost focus (correct), but now the active editor (extensions receive an onDidChangeActiveTextEditor event) is the right side (but still don't have focus which is fine)

You can notice this behavior much more easily with an extension like GitLens which provides "active line" annotations (you'll see them switch from the left side to the right) and statusbar updates. In GitLens specifically this causes an issue when a statusbar item is updated because of line selections on the left, and then you attempt to click on the statusbar item (to perform an action), but it fails, because the active editor switches out from under the click.

I've also noticed, when looking into this, that the line information in the statusbar isn't updated to reflect the line/column/selection of the left side -- only the right.

@ramya-rao-a ramya-rao-a added the diff-editor Diff editor issues label Mar 10, 2017
@rebornix rebornix added the bug Issue identified by VS Code Team member as probable bug label Apr 21, 2017
@eamodio
Copy link
Contributor Author

eamodio commented Dec 1, 2017

I feel like this one has gotten worse (or at least I'm noticing it more). I don't remember if quickpicks used to also cause the focus change, but they do now. This causes issues for GitLens.

If I have a diff open with revision A on the left and B on the right. While focused in the left (Revision A), if open the command palette to say Compare File with Working Tree or Compare File with Revision... I would expect that command to be executed with the context of Revision A, but because opening the command palette causes the left pane to lose focus (and resets to the right pane) it instead runs against Revision B -- which is completely unexpected to the user.

An aside, but I wasted quite a lot of time trying to track down a "bug" because I failed to notice this behavior. :(

@eamodio
Copy link
Contributor Author

eamodio commented Mar 30, 2018

Again, I feel like this is even worse now -- commands in the editor/title menu also cause a focus switch from the left side to the right, which can completely change the context of those menu items.

In GitLens if I want to turn on the blame in the left side, the button in the editor/title will not work -- because focus will switch from left to right and the blame will be toggled on the right (rather than the left as the user would be expecting)

cc @alexandrudima @bpasero

@alexdima
Copy link
Member

ping @jrieken @bpasero I remember you mentioned doing some work in this area. Could we perhaps use a timestamp to figure out the last focused editor in ICodeEditorService and use that as the active editor or is the workbench logic much more involved ?

@bpasero
Copy link
Member

bpasero commented Sep 22, 2018

We no longer react on blur events so I think we can close this issue. @eamodio can you try with latest insider builds if this reproduces still?

@bpasero bpasero added the info-needed Issue requires more information from poster label Sep 22, 2018
@eamodio
Copy link
Contributor Author

eamodio commented Sep 22, 2018

@bpasero it looks like the core issue is fixed! Though I did notice that the Uri provided to editor/title commands in a diff view is always the Uri for the right side, even if the left side is focused

@bpasero
Copy link
Member

bpasero commented Sep 23, 2018

@eamodio that sounds like a different bug you should report then.

@bpasero bpasero closed this as completed Sep 23, 2018
@bpasero bpasero added this to the September 2018 milestone Sep 23, 2018
@bpasero bpasero removed the info-needed Issue requires more information from poster label Sep 23, 2018
@bpasero bpasero assigned bpasero and jrieken and unassigned rebornix Sep 23, 2018
@mjbvz mjbvz added the verified Verification succeeded label Sep 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Issue identified by VS Code Team member as probable bug diff-editor Diff editor issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants