Skip to content

Commit f5dc615

Browse files
author
Jean-Baptiste Doderlein
committed
Fix All file execution
1 parent fb58fed commit f5dc615

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/css/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ label {
588588
color: var(--text-color);
589589
overflow: auto;
590590
overflow-x: hidden;
591+
overflow-y: hidden;
591592
font-family: monospace, monospace;
592593
}
593594

src/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,17 @@ <h4>Graphics main window</h4>
271271
<mpy-config>
272272
interpreter = "js/micropython/micropython.mjs"
273273
</mpy-config>
274-
<script id="toplevel-terminal" type="mpy" terminal worker name="toplevel">
274+
275+
<script id="toplevel-terminal" type="mpy" terminal worker name="toplevel" env="main">
275276
import code
277+
import asyncio
278+
# Import pyscript event handler to create file in filesystem
276279
from pyscript import window
277-
window.change_font_size("toplevel",0)
280+
def _execute_current():
281+
current = int(window.current_editor())
282+
value = window.editors[current].getValue()
283+
exec(value)
284+
278285
code.interact()
279286
</script>
280287

@@ -326,6 +333,7 @@ <h4>Graphics main window</h4>
326333
$('#loader-wrapper').addClass("tester")
327334
terminal.terminal.loadAddon(terminalFitter);
328335
terminalFitter.fit();
336+
change_font_size("toplevel",0);
329337
});
330338
document.getElementById("loader-wrapper").addEventListener("animationend", (ev) => {
331339
if (ev.type === "animationend") {

src/js/editor_change.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ var MOBILE = false;
2121
* @return {void} Nothing
2222
*/
2323
function change_font_size(type, change) {
24-
2524
let r = document.querySelector(':root')
26-
let value = parseFloat(r.style.getPropertyValue('--' + type + "-font-size").slice(0, -2)) + change;
25+
let value = parseFloat(r?.style?.getPropertyValue('--' + type + "-font-size").slice(0, -2)) + change;
2726
r.style.setProperty('--' + type + '-font-size', value + "em");
2827
if (type == 'editor') { // If editor, need to change the hint font size
2928
r.style.setProperty('--hint-font-size', (value * 0.8) + "em");
@@ -78,21 +77,7 @@ let exec_last = function (instance) {
7877
*/
7978
let exec_all = function (instance) {
8079
autosave_editor(instance.id);
81-
let intervalles = calculate_interval(instance);
82-
intervalles.forEach((intervalle) => {
83-
let code = instance.getRange({
84-
line: intervalle.start.row,
85-
ch: intervalle.start.column
86-
}, {
87-
line: intervalle.end.row,
88-
ch: intervalle.end.column
89-
});
90-
91-
if (!(intervalle.type=="expr")) {
92-
code += '\n';
93-
}
94-
terminal.process(code);
95-
})
80+
terminal.process("_execute_current()");
9681
//terminal.process(instance.getValue());
9782
autoscroll_output();
9883
};

0 commit comments

Comments
 (0)