Skip to content

Commit

Permalink
Backport PR spyder-ide#22914: PR: Activate Open last closed shortcu…
Browse files Browse the repository at this point in the history
…t in `EditorStack` (Editor)
  • Loading branch information
dalthviz authored and meeseeksmachine committed Nov 12, 2024
1 parent df51e61 commit a81b138
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 @@ -137,6 +137,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 @@ -442,6 +447,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 @@ -1612,6 +1612,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 a81b138

Please sign in to comment.