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

feat: on_result_diagnostics_quickfix can preserve window focus #237

Merged
merged 2 commits into from
Dec 5, 2023
Merged

feat: on_result_diagnostics_quickfix can preserve window focus #237

merged 2 commits into from
Dec 5, 2023

Conversation

jpetrie
Copy link
Contributor

@jpetrie jpetrie commented Nov 26, 2023

This PR addresses my request in #234 to allow the opening of the quickfix window by on_result_diagnostics_quickfix to keep the focus where it was (by saving the current window ID before copen and then restoring it).

This is implemented as an option, defaulting off to preserve existing behavior for users who may want that. I noticed while looking for other places to apply this, however, that on_output_quickfix preserves the window focus in the same way I did, which makes me wonder if the focus-stealing that on_result_diagnostics_quickfix does is really a bug and whether the desired solution would be to never steal the focus? It would be a simpler change, but would also change behavior for anybody who has been relying on on_result_diagnostics_quickfix putting the cursor into the quickfix window when it opens.

Copy link
Owner

@stevearc stevearc left a comment

Choose a reason for hiding this comment

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

I appreciate making the PR in a way that doesn't change the existing behavior, but in this case I do think the behavior is more of an oversight than anything. Maybe not a bug, but I don't think it's a feature. I think it makes sense to make it consistent with on_output_quickfix, and if anyone wants the old behavior of focusing the quickfix they can submit a PR that adds this option.

@jpetrie jpetrie requested a review from stevearc December 5, 2023 05:08
@stevearc
Copy link
Owner

stevearc commented Dec 5, 2023

Awesome, thanks!

@stevearc stevearc merged commit 6e3ab7e into stevearc:master Dec 5, 2023
7 checks passed
@jpetrie jpetrie deleted the on_result_diagnostics_quickfix_keep_focus branch December 19, 2023 17:23
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