focus the md_view back

This commit is contained in:
Mathieu PATUREL
2017-01-05 09:18:09 +11:00
parent 4a3caf30bb
commit fd633e0bc0
3 changed files with 10 additions and 7 deletions

View File

@ -42,9 +42,10 @@ def create_preview(md_view):
preview.set_name(get_preview_name(md_view)) preview.set_name(get_preview_name(md_view))
preview.set_scratch(True) preview.set_scratch(True)
md_view_settings.set(PREVIEW_ID, preview.id()) md_view_settings.set(PREVIEW_ID, preview.id())
window.run_command('new_pane') # move to new group def move_and_focus_md_view():
return preview window.run_command('new_pane')
sublime.set_timeout_async(lambda: window.focus_view(md_view), 50)
sublime.set_timeout_async(move_and_focus_md_view, 250)
return preview return preview

View File

@ -18,6 +18,7 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
id = vsettings.get(PREVIEW_ID) id = vsettings.get(PREVIEW_ID)
if id is None or get_view_from_id(window, id) is None: if id is None or get_view_from_id(window, id) is None:
preview = create_preview(view) preview = create_preview(view)
return
def on_activated(self, view): def on_activated(self, view):
# if view is md_view and has no preview # if view is md_view and has no preview

View File

@ -1,7 +1,8 @@
# DuckDuckGo - The Search engine you'll fall in love with # DuckDuckGo - The Search engine you'll fall in love with
This is a test
![image](http://afterishtar.pl/images/100x100.gif) ![image](http://afterishtar.pl/images/100x100.gif)
this is a test
hello world... hello world