Skip to content

Commit

Permalink
fixes issue spyder-ide#3800
Browse files Browse the repository at this point in the history
If the previous line is unindented, the next one will be aswell.
  • Loading branch information
pwoosam committed Dec 11, 2016
1 parent 2f50115 commit 45fd7fe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spyder/widgets/sourcecode/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,14 +1917,13 @@ def fix_indent(self, forward=True, comment_or_string=False):
diff_curly = 0
add_indent = False
prevline = None
if not self.get_block_indentation(block_nb - 1):
return False
for prevline in range(block_nb-1, -1, -1):
cursor.movePosition(QTextCursor.PreviousBlock)
prevtext = to_text_string(cursor.block().text()).rstrip()

if ((self.is_python_like()
and not prevtext.strip().startswith('#')
and prevtext)
or prevtext):

if prevtext:

if (prevtext.strip().endswith(')')
or prevtext.strip().endswith(']')
Expand Down

0 comments on commit 45fd7fe

Please sign in to comment.