ctrl+d/r event handler (resume)
This commit is contained in:
parent
cb064c8053
commit
bf6fb94e7c
|
@ -135,7 +135,7 @@ function backspace(isCtrl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param { KeyboardEvent } dom */
|
/** @param { KeyboardEvent } dom */
|
||||||
function control_char(id, dom) {
|
async function control_char(id, dom) {
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
|
||||||
|
@ -168,17 +168,41 @@ function control_char(id, dom) {
|
||||||
case 86:
|
case 86:
|
||||||
if (dom.altKey) break;
|
if (dom.altKey) break;
|
||||||
|
|
||||||
default:
|
case 82:
|
||||||
if (dom.ctrlKey && (dom.key.length == 1)) {
|
// Why it checks if letter is 'r':
|
||||||
terminal.write('^' + dom.key.toUpperCase());
|
// For some reason, ctrl+(v|r|d) executed this code.
|
||||||
|
// This is a simple fix
|
||||||
|
// (same works for any other code like this in this function)
|
||||||
|
if (dom.ctrlKey && dom.key.toLowerCase() == 'r') {
|
||||||
|
if (Math.random() < 0.1) terminal.write('uwu');
|
||||||
|
window.location.reload();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.write('<');
|
case 68:
|
||||||
if (dom.ctrlKey) terminal.write('C');
|
if (dom.ctrlKey && dom.key.toLowerCase() == 'd') {
|
||||||
if (dom.altKey) terminal.write('A');
|
terminal.writeln('');
|
||||||
if (dom.shiftKey) terminal.write('S');
|
pr_char = () => {};
|
||||||
terminal.write(`${id}>`)
|
exec_cmd = pr_char;
|
||||||
|
control_char = () => {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
const wr = (t) => {
|
||||||
|
terminal.write(t);
|
||||||
|
cmd += t;
|
||||||
|
}
|
||||||
|
if (dom.ctrlKey && (dom.key.length == 1)) {
|
||||||
|
wr('^' + dom.key.toUpperCase());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wr('<');
|
||||||
|
if (dom.ctrlKey) wr('C');
|
||||||
|
if (dom.altKey) wr('A');
|
||||||
|
if (dom.shiftKey) wr('S');
|
||||||
|
wr(`${id}>`)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue