sending actions when switching between files

This commit is contained in:
Alan Hamlett 2013-07-07 19:43:26 -07:00
parent 75b64c58e2
commit b5b76ffb1f
1 changed files with 8 additions and 6 deletions

View File

@ -76,17 +76,19 @@ class WakatimeListener(sublime_plugin.EventListener):
def on_activated(self, view):
now = time.time()
if enough_time_passed(now):
targetFile = view.file_name()
if enough_time_passed(now) or targetFile != LAST_FILE:
if away(now):
api(view.file_name(), LAST_ACTION, endtime=now)
api(targetFile, LAST_ACTION, endtime=now)
else:
api(view.file_name(), now)
api(targetFile, now)
def on_selection_modified(self, view):
now = time.time()
if enough_time_passed(now):
targetFile = view.file_name()
if enough_time_passed(now) or targetFile != LAST_FILE:
if away(now):
api(view.file_name(), LAST_ACTION, endtime=now)
api(targetFile, LAST_ACTION, endtime=now)
else:
api(view.file_name(), now)
api(targetFile, now)