-
-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Syntax error handling in console.html #1286
Comments
Thanks @hoodmane for catching this. I'll investigate. |
I am pretty sure it was working after #1155. |
I will check (unfortunately, #1155 was before the emscripten update was merged so I have to rebuild everything). |
Doing pyconsole.stderr_callback = $.terminal.active().error in JS console makes it work (with newline of course). |
So it seems related to newline stuff since it works with pyconsole.stderr_callback = $.terminal.active().echo but not with pyconsole.stderr_callback = (s) => $.terminal.active().echo(s, {newline : false}) |
Does that prevent |
This is |
I suspect something like syntax error occurs when terminal is paused which |
Okay it definitely does work after #1155. |
I think I got it. In async function interpreter(command) {
// multiline should be splitted (usefull when pasting)
term.pause();
for( const c of command.split('\n') ) {
const prompt = pyconsole.push(c) ? ps2 : ps1;
term.set_prompt(prompt);
await pyconsole.run_complete;
}
term.resume();
} which disturb |
|
Commenting our |
It's weird actually: term.__set_prompt = term.set_prompt; but then it never does the monkey patch. It would work much better if it monkey patched |
I remember I've seen this when trying to make |
Partially reverting #1274 restoring my pyconsole.stdout_callback = term.echo_no_newline;
pyconsole.stderr_callback = (s) => term.echo_no_newline(`[[;red;]${$.terminal.escape_brackets(s)}\u200B]`); makes it work without loading |
I can submit a PR with this correction or we can wait for an upstream fix. WDYT? |
I opened a PR: jcubic/jquery.terminal#652 |
The why it happens only for syntax errors (and not runtime errors) can be understood with this three lines: const prompt = pyconsole.push(c) ? ps2 : ps1;
term.set_prompt(prompt);
await pyconsole.run_complete; Execution steps for runtime errors (or even code exec without any error) are:
While for syntax error, we have:
|
So as an update, my jquery terminal PR has been reviewed and has received positive feedback so it will probably be merged soon. It looks like releases of |
Closed by #1480. |
Syntax errors in console.html are not printed immediately, only after the next command is submitted. E.g., type
1+<ENTER>
into console.html.I think this was introduced in #1125. I investigated but I can't figure out why it's happening. Any ideas @casatir?
The text was updated successfully, but these errors were encountered: