call onSetActive
consistently whenever a bufpane receives focus
#3584
+18
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I find the current behavior of
onSetActive
quite strange (as remarked in #3563 already):onSetActive
is not called. This also applies if you list one or more files on the command line that are opened in separate tabs or splits.onSetActive
is called. When you close a tab (that is not the only tab), then most of the timeonSetActive
is called. However, if you open several files on startup and then close one tab after the other,onSetActive
is never called.onSetActive
is not called. When you switch between splits or close a split,onSetActive
is called.onSetActive
is called withnil
as argument.This PR changes the behavior as follows: "active" is interpreted as the bufpane that can receive user input. Hence there is exactly one active bufpane at any time (or none if the "raw" buffer is open). Whenever a bufpane becomes active,
onSetActive
is called. This may happen through opening, switching or closing tabs or splits and also at startup. Th call for a "raw" buffer is eliminated, and the double mentioning ofonSetActive
in the documentation is corrected.I've used this patch for some time now and it seems to work well. Nevertheless, please have a look at the changes. Maybe there are better ways to achieve the goal. Or maybe you want
onSetActive
to behave differently. I myself find if difficult at present to useonSetActive
in a meaningful way.