zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.39k stars 1.16k forks source link

Add `onAnyEvent` callback #3244

Closed dmaluka closed 1 month ago

dmaluka commented 2 months ago

Implement a radical approach to improving abilities of plugins to detect and handle various changes of micro's state: add onAnyEvent callback which is called, literally, after any event. A plugin can use this callback to compare a state after the previous event and after the current event, and thus is able to catch various events that cannot be detected using other callbacks.

This may be a crazy idea, but maybe let's try it.

Some examples of such events that can be detected with onAnyEvent but not with other callbacks: