Skip to content

Commit

Permalink
Merge pull request #5083 from jnsebgosselin/fix_unable_to_split_editor
Browse files Browse the repository at this point in the history
PR: Fix unable to split editor
  • Loading branch information
ccordoba12 authored Sep 7, 2017
2 parents b84adc9 + cbc5551 commit 1ad98e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 7 additions & 5 deletions spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ def register_editorstack(self, editorstack):
self.set_last_focus_editorstack(self, editorstack)
editorstack.set_closable( len(self.editorstacks) > 1 )
if self.outlineexplorer is not None:
editorstack.set_outlineexplorer(self.outlineexplorer)
editorstack.set_outlineexplorer(self.outlineexplorer.explorer)
editorstack.set_find_widget(self.find_widget)
editorstack.reset_statusbar.connect(self.readwrite_status.hide)
editorstack.reset_statusbar.connect(self.encoding_status.hide)
Expand Down Expand Up @@ -1472,13 +1472,15 @@ def get_filename_index(self, filename):
def get_current_editorstack(self, editorwindow=None):
if self.editorstacks is not None:
if len(self.editorstacks) == 1:
return self.editorstacks[0]
editorstack = self.editorstacks[0]
else:
editorstack = self.__get_focus_editorstack()
if editorstack is None or editorwindow is not None:
return self.get_last_focus_editorstack(editorwindow)
return editorstack

editorstack = self.get_last_focus_editorstack(editorwindow)
if editorstack is None:
editorstack = self.editorstacks[0]
return editorstack

def get_current_editor(self):
editorstack = self.get_current_editorstack()
if editorstack is not None:
Expand Down
10 changes: 6 additions & 4 deletions spyder/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,12 @@ def add_corner_widgets_to_tabbar(self, widgets):
def closeEvent(self, event):
self.threadmanager.close_all_threads()
self.analysis_timer.timeout.disconnect(self.analyze_script)

# Remove editor references from the outline explorer settings
if self.outlineexplorer is not None:
for finfo in self.data:
self.outlineexplorer.remove_editor(finfo.editor)

QWidget.closeEvent(self, event)
if is_pyqt46:
self.destroyed.emit()
Expand Down Expand Up @@ -2040,10 +2046,6 @@ def create_new_editor(self, fname, enc, txt, set_current, new=False,
editor.zoom_out.connect(lambda: self.zoom_out.emit())
editor.zoom_reset.connect(lambda: self.zoom_reset.emit())
editor.sig_eol_chars_changed.connect(lambda eol_chars: self.refresh_eol_chars(eol_chars))
if self.outlineexplorer is not None:
# Removing editor reference from outline explorer settings:
editor.destroyed.connect(lambda obj=editor:
self.outlineexplorer.remove_editor(obj))

self.find_widget.set_editor(editor)

Expand Down
1 change: 0 additions & 1 deletion spyder/widgets/editortools.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ def activated(self, item):
parent = self.current_editor.parent()
for editor_id, i_item in list(self.editor_items.items()):
if i_item is root_item:
#XXX: not working anymore!!!
for editor, _id in list(self.editor_ids.items()):
if _id == editor_id and editor.parent() is parent:
self.current_editor = editor
Expand Down

0 comments on commit 1ad98e6

Please sign in to comment.