Sublime Forum

Bug with how on_selection_modified is called


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, 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.

1 Like


I’ve worked around the issue, I think, by iterating the views with the same buffer id, and choosing the one which has the most recent ‘touched’ time, which is something I maintain for each view.

It’s OK, not great. It is called often …


1 Like