+3

on_selection_modified is invoked only with the first view, not the view whose selection was modified

glyph 12 years ago updated 12 years ago 0
I expected that in my event listener, on_selection_modified(view) would take the view whose selection was modified.

However, as per the API documentation, "many of these events are triggered by the buffer underlying the view, and thus the method is only called once, with the first view as the parameter".  So on_selection_modified is just invoked with whatever the open view happens to be.  However, this does not seem accurate: my understanding is that the selection is a property of the view, not the buffer.  (This is borne out by the fact that different View objects with the same buffer_id() will return different values from sel().)

This means that plugins such as SublimeLinter will only show me errors in the leftmost pane that happens to have a particular file open.

Worse, I can't find a way to quickly find all other open views so that I can easily update them, other than scanning through every view open in the non-current group, looking for matching buffer_id()s.