I override on_selection_modified.
I have had problems with my plugin (Emacs Pro Essentials) that I couldn’t sort out for the longest time, and now I finally understand what is happening.
If I have the same view displayed in multiple panes (say 3), on_selection_modified is called 3 times, with the same view ID. I have 3 views on the same file, each with its own view.id(), but on_selection_modified is called 3 times with the view ID of the first one in the list.
I submit that it should only be called once, because selections are per view, right? Each view can have its own separate set of selections.
This only seems to happen when on_selection_modified is called while dragging the mouse. If I extend the selection with keyboard commands, the view is always right.
This seems like a bug. I cannot really think how to work around it at the moment.