Skip to content

Commit

Permalink
Do not update status bar for 'widgets'
Browse files Browse the repository at this point in the history
Sublime widgets are e.g. the command palette, and the input box at the bottom.
For these views we generally do not need to update the status bar.

Views without a window are also now called transient. These are detached views
after close.
  • Loading branch information
kaste committed Jan 16, 2019
1 parent f4c97be commit aef40b2
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions core/commands/status_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@ def on_post_save(self, view):
update_status_bar_soon = False


def view_is_transient(view):
window = view.window()
if not window:
return True

group, index = window.get_view_index(view)
if index == -1: # input panels, aka 'widgets'
return True

if window.transient_view_in_group(window.active_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 aef40b2

Please sign in to comment.