You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The View.is_primary() only tells if the view is the "primary". If the view is the "primary", it does not tell whether it has multiple views into the underlying buffer.
Nowadays, I am worried about performance, and I am running this is_cloned_view() very often. Then, for my new Package, I wrote a optimized version which caches whether a given buffer has several views into the same buffer.
How such peculiar API is_cloned(view) which requires to extend the sublime_plugin.EventListener be distributed and shared between several packages? Could it be added to sublime_lib?
Something very similar was already requested to be added into Sublime Text Core:
Using that API, it would only require me to call len( view.clones() ) > 1 to know where some view is cloned, i.e., has clones, i.e., has several views into the same buffer. Then, optimally when integrating my implementation into sublime_lib, my original implementation could be extended to support this feature of returning all clones instead of only saying some view has clones or not.
The
View.is_primary()only tells if the view is the "primary". If the view is the "primary", it does not tell whether it has multiple views into the underlying buffer.Some years ago, I wrote this code into my fork of
BufferScroll:https://github.com/evandrocoan/BufferScroll/blob/master/BufferScroll.py#L105-L117
And today, I need to write the same code for my new package:
https://github.com/evandrocoan/SkipCloseForClonedViews/blob/master/skip_close_for_cloned_views.py#L5-L70
Which implements this feature asked on Core:
Nowadays, I am worried about performance, and I am running this
is_cloned_view()very often. Then, for my new Package, I wrote a optimized version which caches whether a given buffer has several views into the same buffer.How such peculiar API is_cloned(view) which requires to extend the
sublime_plugin.EventListenerbe distributed and shared between several packages? Could it be added tosublime_lib?Something very similar was already requested to be added into Sublime Text Core:
Using that API, it would only require me to call
len( view.clones() ) > 1to know where some view is cloned, i.e., has clones, i.e., has several views into the same buffer. Then, optimally when integrating my implementation intosublime_lib, my original implementation could be extended to support this feature of returning all clones instead of only saying some view has clones or not.