Skip to content

Commit

Permalink
Merge pull request spyder-ide#22914 from jitseniesen/open-last-closed
Browse files Browse the repository at this point in the history
PR: Activate `Open last closed` shortcut in `EditorStack` (Editor)
  • Loading branch information
dalthviz authored Nov 12, 2024
2 parents 49783ca + e1519ba commit 5a2851f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spyder/plugins/editor/widgets/editorstack/editorstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ class EditorStack(QWidget, SpyderWidgetMixin):
sig_trigger_run_action = Signal(str)
sig_trigger_debugger_action = Signal(str)

sig_open_last_closed = Signal()
"""
This signal requests that the last closed tab be re-opened.
"""

sig_codeeditor_created = Signal(object)
"""
This signal is emitted when a codeeditor is created.
Expand Down Expand Up @@ -444,6 +449,7 @@ def register_shortcuts(self):
('Cycle to next file', lambda: self.tabs.tab_navigate(1)),
('New file', self.sig_new_file[()]),
('Open file', self.plugin_load[()]),
('Open last closed', self.sig_open_last_closed),
('Save file', self.save),
('Save all', self.save_all),
('Save As', self.sig_save_as),
Expand Down
1 change: 1 addition & 0 deletions spyder/plugins/editor/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ def register_editorstack(self, editorstack):
editorstack.sig_open_file.connect(self.report_open_file)
editorstack.sig_new_file.connect(lambda s: self.new(text=s))
editorstack.sig_new_file[()].connect(self.new)
editorstack.sig_open_last_closed.connect(self.open_last_closed)
editorstack.sig_close_file.connect(self.close_file_in_all_editorstacks)
editorstack.sig_close_file.connect(self.remove_file_cursor_history)
editorstack.file_saved.connect(self.file_saved_in_editorstack)
Expand Down

0 comments on commit 5a2851f

Please sign in to comment.