Skip to content

Commit

Permalink
Merge from 3.x: PR #5229
Browse files Browse the repository at this point in the history
Fixes #5226
  • Loading branch information
ccordoba12 committed Sep 15, 2017
2 parents ddc929a + 9224248 commit 08fca6f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions spyder/widgets/editor.py
Expand Up @@ -304,7 +304,12 @@ def __len__(self):
return len(self.history)

def __getitem__(self, i):
return self.id_list.index(self.history[i])
self._update_id_list()
try:
return self.id_list.index(self.history[i])
except ValueError:
self.refresh()
raise IndexError

def __delitem__(self, i):
del self.history[i]
Expand Down Expand Up @@ -1759,12 +1764,11 @@ def current_changed(self, index):
pass

def _get_previous_file_index(self):
if len(self.stack_history) > 1:
last = len(self.stack_history)-1
w_id = self.stack_history.pop(last)
self.stack_history.insert(0, w_id)

return self.stack_history[last]
"""Return the penultimate element of the stack history."""
try:
return self.stack_history[-2]
except IndexError:
return None

def tab_navigation_mru(self, forward=True):
"""
Expand Down

0 comments on commit 08fca6f

Please sign in to comment.