Skip to content

Commit

Permalink
Merge from 3.x: PR #9023
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Mar 25, 2019
2 parents 05a7930 + e47ddce commit c390a1b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,11 +1387,7 @@ def update_warning_menu(self):
error = 'syntax' in message
text = message[:1].upper() + message[1:]
icon = ima.icon('error') if error else ima.icon('warning')

def slot():
self.switch_to_plugin()
self.load(filename, goto=line_number)

slot = lambda _checked, _l=line_number: self.load(filename, goto=_l)
action = create_action(self, text=text, icon=icon, triggered=slot)
self.warning_menu.addAction(action)

Expand All @@ -1403,11 +1399,7 @@ def update_todo_menu(self):
filename = self.get_current_filename()
for text, line0 in results:
icon = ima.icon('todo')

def slot():
self.switch_to_plugin()
self.load(filename, goto=line0)

slot = lambda _checked, _l=line0: self.load(filename, goto=_l)
action = create_action(self, text=text, icon=icon, triggered=slot)
self.todo_menu.addAction(action)
self.update_todo_actions()
Expand Down Expand Up @@ -1692,6 +1684,12 @@ def load(self, filenames=None, goto=None, word='',
end of this method (set to False to prevent keyboard events from
creeping through to the editor during debugging)
"""
# Switch to editor before trying to load a file
try:
self.switch_to_plugin()
except AttributeError:
pass

editor0 = self.get_current_editor()
if editor0 is not None:
position0 = editor0.get_position('cursor')
Expand Down

0 comments on commit c390a1b

Please sign in to comment.