Skip to content

Commit

Permalink
Little fix to open the first tab after gdb session end
Browse files Browse the repository at this point in the history
  • Loading branch information
depsir authored and ProPuke committed Apr 1, 2012
1 parent 6ccc502 commit 3c2d972
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions sublimegdb.py
Expand Up @@ -52,7 +52,9 @@ def get_setting(key, default=None):
gdb_cursor = ""
gdb_cursor_position = 0
gdb_last_cursor_view = None
gdb_bkp_view = {}
gdb_bkp_layout = {}
gdb_bkp_window = None
gdb_bkp_view = None

gdb_process = None
gdb_stack_frame = None
Expand Down Expand Up @@ -1164,11 +1166,12 @@ def run(self):
executable = get_setting("executable")
gdb_process = subprocess.Popen(["gdb","--interpreter=mi",executable], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)

w = sublime.active_window()
gdb_bkp_window = sublime.active_window()
#back up current layout before opening the debug one
#it will be restored when debog is finished
gdb_bkp_view = w.get_layout()
w.set_layout(
gdb_bkp_layout = gdb_bkp_window.get_layout()
gdb_bkp_view = gdb_bkp_window.active_view()
gdb_bkp_window.set_layout(
get_setting("layout",
{
"cols": [0.0, 0.5, 1.0],
Expand Down Expand Up @@ -1239,7 +1242,10 @@ def run(self):
run_cmd("-gdb-exit", True)
for view in gdb_views:
view.close()
sublime.active_window().set_layout(gdb_bkp_view)
sublime.active_window().set_layout(gdb_bkp_layout)
# sublime.active_window().focus_view(gdb_bkp_view)
sublime.active_window().focus_view(sublime.active_window().views()[0])


def is_enabled(self):
return is_running()
Expand Down

0 comments on commit 3c2d972

Please sign in to comment.