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 580a1f3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions spyder/widgets/sourcecode/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,15 +1917,14 @@ 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(']')
or prevtext.strip().endswith('}')):
Expand Down

0 comments on commit 580a1f3

Please sign in to comment.