Skip to content

Commit

Permalink
Backport PR #2615
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Aug 20, 2015
1 parent 4c272f3 commit 702d7a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spyderlib/widgets/sourcecode/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1812,12 +1812,16 @@ def fix_indent(self, forward=True, comment_or_string=False):
return
cursor = self.textCursor()
block_nb = cursor.blockNumber()
prevline = None
for prevline in range(block_nb-1, -1, -1):
cursor.movePosition(QTextCursor.PreviousBlock)
prevtext = to_text_string(cursor.block().text()).rstrip()
if not prevtext.strip().startswith('#'):
break

if not prevline:
return False

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

Expand Down

0 comments on commit 702d7a6

Please sign in to comment.