Skip to content

Commit dfd453a

Browse files
committed
Revert sending extra newline (PR #81 as first fix for #18)
1 parent cad95bb commit dfd453a

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/manimShell.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ const IPYTHON_CELL_START_REGEX = /^\s*In \[\d+\]:/gm;
1919
*/
2020
const LOG_INFO_MESSAGE_REGEX = /^\s*\[.*\] INFO/m;
2121

22-
/**
23-
* Regular expression to match IPython multiline input "...:"
24-
* Sometimes IPython does not execute code when entering a newline, but enters a
25-
* multiline input mode, where it expects another line of code. We detect that
26-
* this happens and send an extra newline to run the code
27-
* See: https://github.com/Manim-Notebook/manim-notebook/issues/18
28-
*/
29-
const IPYTHON_MULTILINE_START_REGEX = /^\s*\.{3}:\s+$/m;
30-
3122
/**
3223
* Regular expression to match a KeyboardInterrupt.
3324
*/
@@ -577,9 +568,8 @@ export class ManimShell {
577568
*
578569
* @param shell The shell to execute the command in.
579570
* @param command The command to execute in the shell.
580-
* @param useShellIntegration Whether to use shell integration if available
581571
*/
582-
private exec(shell: Terminal, command: string, useShellIntegration = true) {
572+
private exec(shell: Terminal, command: string) {
583573
if (!shell) {
584574
Window.showErrorMessage("No shell to execute command in. Internal extension error.");
585575
return;
@@ -588,7 +578,7 @@ export class ManimShell {
588578
this.detectShellExecutionEnd = false;
589579
Logger.debug("🔒 Shell execution end detection disabled");
590580

591-
if (useShellIntegration && shell.shellIntegration) {
581+
if (shell.shellIntegration) {
592582
Logger.debug(`💨 Sending command to terminal (with shell integration): ${command}`);
593583
shell.shellIntegration.executeCommand(command);
594584
} else {
@@ -775,14 +765,6 @@ export class ManimShell {
775765
}
776766
}
777767

778-
if (this.isExecutingCommand && data.match(IPYTHON_MULTILINE_START_REGEX)) {
779-
Logger.debug("💨 IPython multiline detected, sending extra newline");
780-
// do not use shell integration here, as it might send a CTRL-C
781-
// while the prompt is not finished yet
782-
// \x7F deletes the extra line ("...:") from IPython
783-
this.exec(this.activeShell, "\x7F", false);
784-
}
785-
786768
if (data.match(ERROR_REGEX)) {
787769
Logger.debug("🚨 Error in IPython cell detected");
788770
this.activeShell?.show();

0 commit comments

Comments
 (0)