mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Merge pull request #2441 from xonsh/tq
fixed triple quote issue when open triple quotes are on the last line
This commit is contained in:
commit
075b6038da
3 changed files with 15 additions and 1 deletions
13
news/tq.rst
Normal file
13
news/tq.rst
Normal file
|
@ -0,0 +1,13 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed issue with starting triple quote strings being run as a command.
|
||||
|
||||
**Security:** None
|
|
@ -403,6 +403,7 @@ mom"""
|
|||
" --option2 value2 \\\n"
|
||||
" --optionZ valueZ",
|
||||
1, "echo --option1 value1 --option2 value2 --optionZ valueZ", 3),
|
||||
('"""\n', 0, '"""', 1),
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize('src, idx, exp_line, exp_n', LOGICAL_LINE_CASES)
|
||||
|
|
|
@ -445,7 +445,7 @@ def get_logical_line(lines, idx):
|
|||
start = idx
|
||||
line = lines[idx]
|
||||
open_triple = _have_open_triple_quotes(line)
|
||||
while (line.endswith(linecont) or open_triple) and idx < nlines:
|
||||
while (line.endswith(linecont) or open_triple) and idx < nlines - 1:
|
||||
n += 1
|
||||
idx += 1
|
||||
if line.endswith(linecont):
|
||||
|
|
Loading…
Add table
Reference in a new issue