use setting for delay before updating preview

This commit is contained in:
Mathieu PATUREL
2017-03-22 17:40:20 +11:00
parent 6a3dd6ac2f
commit 7126c0e090
2 changed files with 5 additions and 2 deletions

View File

@ -12,5 +12,8 @@
// Choose what to do with YAML/TOML (---/+++ respectively) headers
// Valid values: "wrap_in_pre", "remove".
"header_action": "wrap_in_pre"
"header_action": "wrap_in_pre",
// Wait at least the specified *seconds* before updating the preview.
"update_preview_every": 0
}

View File

@ -48,7 +48,7 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
def update(self, view):
vsettings = view.settings()
now = time.time()
if now - vsettings.get(LAST_RUN, 0) < 0.8:
if now - vsettings.get(LAST_RUN, 0) < get_settings().get('update_preview_every'):
return
vsettings.set(LAST_RUN, now)
if not vsettings.get(PREVIEW_ENABLED):