scroll preview when writing: OK
it does not show at the center when possible, though
This commit is contained in:
@ -65,6 +65,7 @@ def create_preview(window, md_view):
|
|||||||
|
|
||||||
preview_settings = preview.settings()
|
preview_settings = preview.settings()
|
||||||
preview_settings.set('gutter', False)
|
preview_settings.set('gutter', False)
|
||||||
|
preview_settings.set('scroll_past_end', False)
|
||||||
preview_settings.set('is_markdown_preview', True)
|
preview_settings.set('is_markdown_preview', True)
|
||||||
preview_settings.set('markdown_view_id', md_view.id())
|
preview_settings.set('markdown_view_id', md_view.id())
|
||||||
|
|
||||||
@ -83,6 +84,8 @@ def show_html(md_view, preview):
|
|||||||
html,
|
html,
|
||||||
sublime.LAYOUT_INLINE,
|
sublime.LAYOUT_INLINE,
|
||||||
lambda href: sublime.run_command('open_url', {'url': href}))
|
lambda href: sublime.run_command('open_url', {'url': href}))
|
||||||
|
y = md_view.layout_extent()[1] / md_view.text_to_layout(md_view.sel()[0].begin())[1]
|
||||||
|
preview.set_viewport_position((0, y * preview.layout_extent()[1]), False)
|
||||||
|
|
||||||
def get_view_content(view):
|
def get_view_content(view):
|
||||||
return view.substr(sublime.Region(0, view.size()))
|
return view.substr(sublime.Region(0, view.size()))
|
||||||
|
|||||||
15
sample.md
15
sample.md
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||||
|
|
||||||
|
|
||||||
#### The Zen of Python, by Tim Peters
|
#### The Zen of Python, by Tim Peters
|
||||||
|
|
||||||
> Beautiful is better than ugly.
|
> Beautiful is better than ugly.
|
||||||
@ -40,7 +41,19 @@ This is some `code`
|
|||||||
- a
|
- a
|
||||||
- list
|
- list
|
||||||
|
|
||||||
1. an
|
1. and
|
||||||
2. other
|
2. other
|
||||||
3. list
|
3. list
|
||||||
|
|
||||||
|
|
||||||
|
this
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
a
|
||||||
|
|
||||||
|
lot
|
||||||
|
|
||||||
|
of
|
||||||
|
|
||||||
|
paragraph
|
||||||
2
todo.md
2
todo.md
@ -1,8 +1,8 @@
|
|||||||
# todo
|
# todo
|
||||||
|
|
||||||
- sync scroll
|
|
||||||
- add message in status bar
|
- add message in status bar
|
||||||
- add **custom css** feature
|
- add **custom css** feature
|
||||||
|
- sync scroll @done @improve: scroll preview to center when possible
|
||||||
- regive focus to the right markdown view @done
|
- regive focus to the right markdown view @done
|
||||||
- set the title of the preview @done
|
- set the title of the preview @done
|
||||||
- disable previewing when the preview is closed @done
|
- disable previewing when the preview is closed @done
|
||||||
|
|||||||
Reference in New Issue
Block a user