Skip to content

Commit

Permalink
Merge 41387cc into f4c97be
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste committed Jan 21, 2019
2 parents f4c97be + 41387cc commit 2081e3a
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions core/commands/status_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,39 @@ def on_post_save(self, view):
update_status_bar_soon = False


def view_is_transient(view):
"""Return whether a view can be considered 'transient'.
Transient views are 'detached' views, widgets (aka quick or input panels), and preview
views.
"""

# 'Detached' (already closed) views don't have a window.
window = view.window()
if not window:
return True

# Widgets are normal views but the typical getter don't list them.
group, index = window.get_view_index(view)
if index == -1:
return True

# Transient views are the views used to preview files when using goto anything.
# (This does not catch previewing by clicking the sidebar.)
if window.transient_view_in_group(group) == view:
return True

return False


class GsUpdateStatusBarCommand(TextCommand, GitCommand):

"""
Update the short Git status in the Sublime status bar.
"""

def run(self, edit):

window = self.view.window()
if not window or \
(self.view.file_name() and
self.view == window.transient_view_in_group(window.active_group())):
# it means it is an transient view of a regular file
if view_is_transient(self.view):
return

global last_execution, update_status_bar_soon
Expand Down

0 comments on commit 2081e3a

Please sign in to comment.