Skip to content

Commit 669aa70

Browse files
committed
Support ':' in interactive shell
1 parent 03d431e commit 669aa70

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

wasm/demo/src/main.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,24 @@ var input = "";
9797
term.on("data", (data) => {
9898
const code = data.charCodeAt(0);
9999
if (code == 13) { // CR
100-
term.write("\r\n");
101-
try {
102-
rp.pyEval(input, {
103-
stdout: print_to_console
104-
});
105-
} catch (err) {
106-
if (err instanceof WebAssembly.RuntimeError) {
107-
err = window.__RUSTPYTHON_ERROR || err;
100+
if (input[input.length - 1] == ':') {
101+
input += data
102+
term.write("\r\n.....");
103+
} else {
104+
term.write("\r\n");
105+
try {
106+
rp.pyEval(input, {
107+
stdout: print_to_console
108+
});
109+
} catch (err) {
110+
if (err instanceof WebAssembly.RuntimeError) {
111+
err = window.__RUSTPYTHON_ERROR || err;
112+
}
113+
print_to_console(err);
108114
}
109-
print_to_console(err);
115+
term.write(prompt);
116+
input = "";
110117
}
111-
term.write(prompt);
112-
input = "";
113118
} else if (code == 127) {
114119
term.write("\b \b");
115120
input = input.slice(0, -1);

0 commit comments

Comments
 (0)