mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
bad fix
This commit is contained in:
parent
8074280dc6
commit
41e863f330
2 changed files with 10 additions and 1 deletions
|
@ -68,6 +68,12 @@ def test_subproc_toks_indent_ls_no_min_nl():
|
|||
obs = subproc_toks(INDENT + s + '\n', lexer=LEXER, returnline=True)
|
||||
assert_equal(exp, obs)
|
||||
|
||||
def test_subproc_toks_indent_ls_no_min_semi():
|
||||
s = 'ls'
|
||||
exp = INDENT + '$[{0}];'.format(s)
|
||||
obs = subproc_toks(INDENT + s + ';', lexer=LEXER, returnline=True)
|
||||
assert_equal(exp, obs)
|
||||
|
||||
def test_subproc_toks_ls_comment():
|
||||
s = 'ls -l'
|
||||
com = ' # lets list'
|
||||
|
|
|
@ -51,7 +51,8 @@ def subproc_toks(line, mincol=-1, maxcol=None, lexer=None, returnline=False):
|
|||
break
|
||||
if len(toks) == 0 and tok.type in ('WS', 'INDENT'):
|
||||
continue # handle indentation
|
||||
elif len(toks) > 0 and toks[-1].type == 'SEMI':
|
||||
elif len(toks) > 0 and toks[-1].type == 'SEMI' and pos < maxcol and \
|
||||
tok.type not in ('NEWLINE', 'DEDENT', 'WS'):
|
||||
toks.clear()
|
||||
if pos < mincol:
|
||||
continue
|
||||
|
@ -77,6 +78,8 @@ def subproc_toks(line, mincol=-1, maxcol=None, lexer=None, returnline=False):
|
|||
else:
|
||||
el = line[pos:].split('#')[0].rstrip()
|
||||
end_offset = len(el)
|
||||
if toks[-1].type == 'SEMI':
|
||||
toks.pop()
|
||||
if len(toks) == 0:
|
||||
return # handle comment lines
|
||||
beg, end = toks[0].lexpos, (toks[-1].lexpos + end_offset)
|
||||
|
|
Loading…
Add table
Reference in a new issue