mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Merge branch 'BYK-fix-empty-line-bug'
This commit is contained in:
commit
ab19fa6ec1
2 changed files with 8 additions and 1 deletions
|
@ -79,6 +79,12 @@ def test_bad_indent():
|
|||
'x = 1\n')
|
||||
assert_raises(SyntaxError, check_parse, code)
|
||||
|
||||
def test_indent_with_empty_line():
|
||||
code = ('if True:\n'
|
||||
'\n'
|
||||
' some_command for_sub_process_mode\n')
|
||||
yield check_parse, code
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -178,7 +178,8 @@ class Execer(object):
|
|||
last_error_line = last_error_col = -1
|
||||
input = '\n'.join(lines)
|
||||
continue
|
||||
if last_error_line > 1 and lines[idx-1].rstrip()[-1] == ':':
|
||||
|
||||
if last_error_line > 1 and lines[idx-1].rstrip()[-1:] == ':':
|
||||
# catch non-indented blocks and raise error.
|
||||
prev_indent = len(lines[idx-1]) - len(lines[idx-1].lstrip())
|
||||
curr_indent = len(lines[idx]) - len(lines[idx].lstrip())
|
||||
|
|
Loading…
Add table
Reference in a new issue