Closed wchill closed 9 years ago
Part of the problem is in terminal.js
, lines 464 and 521.
464: document.dispatchEvent(new CustomEvent("jor1k_terminal_put_char", { detail: { character: "\n" }}));
521: document.dispatchEvent(new CustomEvent("jor1k_terminal_put_char", { detail: { character: String.fromCharCode(c) }}));
This is a straightforward fix; just pass in a terminal ID when constructing the Terminal and use that as part of the event name (example: jor1k_terminal_put_char_tty0
). Then register two putCharListeners
listening on both terminal devices and update any usage of the original putCharListener
.
But wouldn't this require a mod in jor1k's code since terminal.js
is their file, so maybe you should open up this issue in their repo also.
jor1k actually revamped their terminal code (https://github.com/s-macke/jor1k/blob/master/js/plugins/terminal-macke.js) and it's structured completely differently. So this fix should be implemented in our jor1k fork (sysbuild-stable branch) for the time being.
I'm very close to upgrading jor1k (issue #51), in which case we can have our own custom terminal implementation.
Just to be sure, is putCharListener being used anywhere? I suspect it's used to parse gcc's output, but I'm not entirely sure.
It is used to update the status for the vm and compiler also. There are some custom listeners that wait for these events such as the compile button, so they are directly tied to putcharlistener's output
The
putCharListener
insys-runtime.js:20
currently does not differentiate between the outputs of the two terminals. This means that if both terminals are being used simultaneously, a race condition will occur and the captured output will be garbage.