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

use window id instead of number in all async jobs #1734

Merged
merged 1 commit into from
Apr 4, 2018

Conversation

bhcleek
Copy link
Collaborator

@bhcleek bhcleek commented Mar 21, 2018

Use window ids instead of window numbers to select windows in all async
job callbacks so that the correct window is selected even when the user
modifies the window layout between when the job is started and when the
callback is executed.

Use window ids instead of window numbers to select windows in all async
job callbacks so that the correct window is selected even when the user
modifies the window layout between when the job is started and when the
callback is executed.
let l:listtype = go#list#Type(self.for)
if a:exit_status == 0
call go#list#Clean(l:listtype)
call win_gotoid(l:winid)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is slightly confusing. We jump two times. First to the windows where the job was started, and then to the current window. Why do we have a logic like this? If we jump to the window the job was started, I wouldn't want to go back, but I think here we jump back because there are no errors right ? Maybe we should have an if .. else ... clause instead of jumping twice.

Copy link
Collaborator Author

@bhcleek bhcleek Mar 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume the user has 2 windows open. While in window 1, the user runs an async command whose list type is locationlist. Before the async command completes, the user moves to window 2. Then the async command completes successfully. We need to clean the list of window 1 (hence the first jump). And we want to avoid stealing window focus, so we make window 2 active again before returning from the callback.

@fatih
Copy link
Owner

fatih commented Apr 4, 2018

lgtm

@bhcleek bhcleek merged commit 57ea4f0 into fatih:master Apr 4, 2018
@bhcleek bhcleek deleted the handle-async-winnr-changes branch April 4, 2018 20:12
bhcleek added a commit that referenced this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants