Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Wagner committed Aug 13, 2015
1 parent dc7a388 commit ed08f01
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spyderlib/widgets/sourcecode/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,7 @@ def fix_indent(self, forward=True, comment_or_string=False):
# find the line that contains our scope
diff = 0
add_indent = False
prevline = None
for prevline in range(block_nb-1, -1, -1):
cursor.movePosition(QTextCursor.PreviousBlock)
prevtext = to_text_string(cursor.block().text()).rstrip()
Expand All @@ -1903,7 +1904,11 @@ def fix_indent(self, forward=True, comment_or_string=False):
break

indent = self.get_block_indentation(block_nb)
correct_indent = self.get_block_indentation(prevline)

if prevline:
correct_indent = self.get_block_indentation(prevline)
else:
correct_indent = indent

if add_indent:
correct_indent += len(self.indent_chars)
Expand Down

0 comments on commit ed08f01

Please sign in to comment.