Skip to content

Commit

Permalink
fix: Status bar editmode info are not hidden when editor is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin7 committed Jul 9, 2023
1 parent 851f3db commit 765d5ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions biscuit/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def late_setup(self):
self.focus_set()
self.binder.late_bind_all()
self.setup_references()
self.editorsmanager.add_default_editors()
self.palette.register_actionset(lambda: self.settings.actionset)
self.setup_extensions()

Expand Down
14 changes: 6 additions & 8 deletions biscuit/core/layout/base/content/editors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __init__(self, master, *args, **kwargs):
self.emptytab.grid(column=0, row=1, sticky=tk.NSEW)

self.default_editors = [Editor(self, '::welcome::', False, False, False)]

def add_default_editors(self):
self.add_editors(self.default_editors)

def add_editors(self, editors):
Expand Down Expand Up @@ -83,7 +85,6 @@ def close_editor(self, editor):
# not keeping diff/games in cache
if not editor.diff and editor.content:
self.closed_editors[editor.path] = editor
self.refresh()

def close_active_editor(self):
"Closes the active tab"
Expand All @@ -96,14 +97,7 @@ def delete_editor(self, editor):
self.closed_editors.remove(editor)

editor.destroy()
self.refresh()

def delete_editor(self, editor):
"Permanently delete a editor."
self.editors.remove(editor)
editor.destroy()
self.refresh()

def set_active_editor(self, editor):
"set an existing editor to currently shown one"
for tab in self.tabs.tabs:
Expand All @@ -113,6 +107,9 @@ def set_active_editor(self, editor):
@property
def active_editor(self):
"Get active editor."
if not self.tabs.active_tab:
return

return self.tabs.active_tab.editor

def refresh(self):
Expand All @@ -121,3 +118,4 @@ def refresh(self):
elif len(self.editors) and not self.empty:
self.emptytab.grid_remove()
self.empty = not self.empty
self.base.update_statusbar()
5 changes: 4 additions & 1 deletion biscuit/core/layout/base/content/editors/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ def close_tab(self, tab):
tab.editor.grid_forget()
self.master.master.close_editor(tab.editor)
tab.destroy()

if self.tabs:
if i < len(self.tabs):
self.tabs[i].select()
else:
self.tabs[i-1].select()
else:
self.active_tab = None
self.master.master.refresh()

def set_active_tab(self, selected_tab):
self.active_tab = selected_tab
Expand Down

0 comments on commit 765d5ce

Please sign in to comment.