Skip to content

Commit f2ff704

Browse files
WebUSB: Focus REPL when activated, and remove all daplink serial listeners when closed.
1 parent e5e792b commit f2ff704

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python-main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,18 +1627,21 @@ function web_editor(config) {
16271627

16281628
var daplink = usePartialFlashing ? window.dapwrapper.daplink : window.daplink;
16291629
daplink.stopSerialRead();
1630+
daplink.removeAllListeners(DAPjs.DAPLink.EVENT_SERIAL_DATA);
1631+
REPL.uninstallKeyboard();
1632+
REPL.io.pop();
16301633
REPL = null;
16311634
}
16321635

16331636
function doSerial() {
1634-
console.log("Setting Up Serial Terminal");
1635-
// Hide terminal
1637+
// Hide terminal if it is currently shown
16361638
var serialButton = config["translate"]["static-strings"]["buttons"]["command-serial"];
16371639
if ($("#repl").css('display') != 'none') {
16381640
closeSerial();
16391641
return;
16401642
}
16411643

1644+
console.log("Setting Up Serial Terminal");
16421645
// Check if we need to connect
16431646
if ($("#command-connect").is(":visible")){
16441647
doConnect(true);

0 commit comments

Comments
 (0)