You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When the result of the execution of a line or a code block contains a bad constellation of \ and ", the there is no output und an error in the sniprun.log appears.
I found the example print("\\\"") in python 3.9. The expected output would be \". In the python terminal it works. Same for R (e.g. cat("\\\"")).
Sniprun don't print anything (I tested classic, virtualtext and terminal). The logoutput for the example shows this:
[00:00:00.156] (7f8e703b3640) INFO message '\"' cleaned out
[00:00:00.157] (7f8e703b3640) INFO done displaying virtual text, Err(NeovimError(0, "Vim(lua):E5107: Error loading lua [string ":lua"]:1: ')' expected near '","'"))
What do the bug concerns? Sniprun itself, a particular interpreter?
I tracked the problem down to the cleanup_and_escape function in display.rs
The first replace statement adds a second backslash ("\\""), the second removes it ("\"") and the last one escapes all quotes (\"\\"\"). This is than pasted to the lua command for printing, but the resulting command is not sane.
To Reproduce
Steps to reproduce the behavior:
Open an file in a language with sniprun support
add a line with a print statement, that contains "\\\"" for example in python print("\\\"")
run SnipRun
See error at the end of the log (~/.cache/sniprun/sniprun.log)
Expected behavior
Output of \".
Environment:
NVIM v0.6.0
OS: Linux thinkpad 5.15.6-arch2-1
rustc 1.57.0
LuaJIT 2.0.5
ldd (GNU libc) 2.33
Sniprun 1.0.5, (also tested the current master)
Additional context
My first intuition was to switch the first and the second replace statement. Sniprun is then able to print something, but the result is wrong. For the example print("\\\"") results in ".
The text was updated successfully, but these errors were encountered:
I tested it and yes it works. Thank you very much.
But (sorry) code block or prints with \n are not working in the terminal disply any more.
I wrote a terminal variant in this PR #123 and I also put a small fix to this in it. (Just a replace("\n", "\\n") locally in the display_terminal function.) Hope this is ok?
Nice catch also, I've missed that one! (since I my test config is also my work config, I don't always test all the features to check everything)
I should have no reason to refuse #123 , and while it's mixing up a bit the issues/fixes, I think it's alright as-is. For clarity purpose, the \n in out for terminal display problem now has its own issue #124
Describe the bug
When the result of the execution of a line or a code block contains a bad constellation of
\
and"
, the there is no output und an error in thesniprun.log
appears.I found the example
print("\\\"")
in python 3.9. The expected output would be\"
. In the python terminal it works. Same for R (e.g.cat("\\\"")
).Sniprun don't print anything (I tested classic, virtualtext and terminal). The logoutput for the example shows this:
What do the bug concerns? Sniprun itself, a particular interpreter?
I tracked the problem down to the
cleanup_and_escape
function in display.rssniprun/src/display.rs
Lines 330 to 333 in 545aa90
The first replace statement adds a second backslash (
"\\""
), the second removes it ("\""
) and the last one escapes all quotes (\"\\"\"
). This is than pasted to the lua command for printing, but the resulting command is not sane.To Reproduce
Steps to reproduce the behavior:
"\\\""
for example in pythonprint("\\\"")
Expected behavior
Output of
\"
.Environment:
Additional context
My first intuition was to switch the first and the second replace statement. Sniprun is then able to print something, but the result is wrong. For the example
print("\\\"")
results in"
.The text was updated successfully, but these errors were encountered: