Skip to content

Commit

Permalink
fix a bug in auto_close
Browse files Browse the repository at this point in the history
  • Loading branch information
randy3k committed Dec 22, 2021
1 parent fcbb945 commit 6fe1bef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
16 changes: 9 additions & 7 deletions terminus/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .terminal import Terminal
from .utils import shlex_split
from .utils import available_panel_name
from .view import panel_window, panel_is_visible, view_is_visible
from .view import panel_window, panel_is_visible, view_is_visible, get_panel_name


KEYS = [
Expand Down Expand Up @@ -437,12 +437,14 @@ def run(self, _):
terminal = Terminal.from_id(view.id())
if terminal:
terminal.close()
if terminal.show_in_panel:
window = panel_window(terminal.view)
if window:
window.destroy_output_panel(terminal.panel_name)
else:
view.close()

panel_name = get_panel_name(view)
if panel_name:
window = panel_window(view)
if window:
window.destroy_output_panel(panel_name)
else:
view.close()


class TerminusCloseAllCommand(sublime_plugin.WindowCommand):
Expand Down
9 changes: 9 additions & 0 deletions terminus/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ def panel_window(view):
return None


def get_panel_name(view):
for w in sublime.windows():
for panel in w.panels():
v = w.find_output_panel(panel.replace("output.", ""))
if v and v.id() == view.id():
return panel.replace("output.", "")
return None


def panel_is_visible(view):
window = panel_window(view)
if not window:
Expand Down

0 comments on commit 6fe1bef

Please sign in to comment.