MCPcopy
hub / github.com/csev/py4e / enter

Function enter

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:81–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79 }
80
81 function enter() {
82 var text = mirror.getLine(line);
83 var input = text.slice(ch);
84 user = false;
85
86 ch = 0;
87 buffer.push(input);
88 n = history.push(input);
89 mirror.setLine(line++, text + '\n');
90 var code = buffer.join('\n').replace(/\r/g, '\n');
91 var balanced = repl.isBalanced(code);
92
93 if (balanced) {
94 repl.eval(code);
95 buffer.length = 0;
96 mirror.setMarker(line, ">>>");
97 } else {
98 if (balanced === null) {
99 buffer.pop();
100 code = buffer.join('\n').replace('\r', '\n');
101 mirror.setMarker(line, repl.isBalanced(code) ? ">>>" : "..");
102 } else mirror.setMarker(line, "...");
103 }
104
105
106 setTimeout(function () {
107 user = true;
108 }, 0);
109 }
110
111 function select() {
112 var length = mirror.getLine(line).slice(ch).length;

Callers 1

changeFunction · 0.85

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected