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

call onSetActive consistently whenever a bufpane receives focus #3584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthias314
Copy link
Contributor

@matthias314 matthias314 commented Dec 20, 2024

I find the current behavior of onSetActive quite strange (as remarked in #3563 already):

  • When you start micro, 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.
  • When you open a new tab or switch between tabs, onSetActive is called. When you close a tab (that is not the only tab), then most of the time onSetActive is called. However, if you open several files on startup and then close one tab after the other, onSetActive is never called.
  • When you open a new split, onSetActive is not called. When you switch between splits or close a split, onSetActive is called.
  • On top of that, if you open a "raw" buffer, then onSetActive is called with nil 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 of onSetActive 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 use onSetActive in a meaningful way.

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.

1 participant