|
17 | 17 | from .plugin.configuration import LspDisableLanguageServerInProjectCommand
|
18 | 18 | from .plugin.configuration import LspEnableLanguageServerGloballyCommand
|
19 | 19 | from .plugin.configuration import LspEnableLanguageServerInProjectCommand
|
| 20 | +from .plugin.core.constants import ST_VERSION |
20 | 21 | from .plugin.core.css import load as load_css
|
21 | 22 | from .plugin.core.open import opening_files
|
22 | 23 | from .plugin.core.panels import PanelName
|
@@ -226,18 +227,18 @@ def on_new_window_async(self, w: sublime.Window) -> None:
|
226 | 227 | def on_pre_close_window(self, w: sublime.Window) -> None:
|
227 | 228 | windows.discard(w)
|
228 | 229 |
|
229 |
| - # Note: EventListener.on_post_move_async does not fire when a tab is moved out of the current window in such a way |
230 |
| - # that a new window is created: https://github.com/sublimehq/sublime_text/issues/4630 |
231 |
| - # Hence, as a workaround we use on_pre_move, which still works in that case. |
232 | 230 | def on_pre_move(self, view: sublime.View) -> None:
|
233 |
| - listeners = sublime_plugin.view_event_listeners.get(view.id()) |
234 |
| - if not isinstance(listeners, list): |
235 |
| - return |
236 |
| - for listener in listeners: |
237 |
| - if isinstance(listener, DocumentSyncListener): |
238 |
| - # we need a small delay here, so that the DocumentSyncListener will recognize a possible new window |
239 |
| - sublime.set_timeout_async(listener.on_post_move_window_async, 1) |
| 231 | + if ST_VERSION < 4184: # https://github.com/sublimehq/sublime_text/issues/4630#issuecomment-2502781628 |
| 232 | + # Workaround for ViewEventListener.on_post_move_async not being triggered when air-dropping a tab: |
| 233 | + # https://github.com/sublimehq/sublime_text/issues/4630 |
| 234 | + listeners = sublime_plugin.view_event_listeners.get(view.id()) |
| 235 | + if not isinstance(listeners, list): |
240 | 236 | return
|
| 237 | + for listener in listeners: |
| 238 | + if isinstance(listener, DocumentSyncListener): |
| 239 | + # we need a small delay here, so that the DocumentSyncListener will recognize a possible new window |
| 240 | + sublime.set_timeout_async(listener.on_post_move_window_async, 1) |
| 241 | + return |
241 | 242 |
|
242 | 243 | def on_load(self, view: sublime.View) -> None:
|
243 | 244 | file_name = view.file_name()
|
|
0 commit comments