-
-
Notifications
You must be signed in to change notification settings - Fork 576
Open
Labels
Description
Issue summary
Typing on the keyboard works partially but is also partially broken. I noticed when it has more than one terminal so I tried with two and same problem
Expected behavior
The cursor should always be at the end of the input in jquery terminal
Steps to reproduce
Changing the position of the cursor in the keyboard isnt reflected in the terminal and you can see its always 4 chars or so behind the end of the input
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Two Terminals</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/jcubic/jquery.terminal@devel/js/jquery.terminal.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal/css/jquery.terminal.min.css">
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
background-color: black;
overflow: hidden;
}
#container {
display: flex;
width: 100%;
height: 100%;
}
.terminal-box {
flex: 1;
height: 100%;
font-family: monospace;
font-size: 16px;
line-height: 1;
letter-spacing: 0;
}
/* Styling for the message box */
#usageBox {
position: fixed;
bottom: 20px;
right: 20px;
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 10px;
border-radius: 5px;
font-family: Arial, sans-serif;
font-size: 14px;
z-index: 9999;
}
</style>
</head>
<body>
<div id="container">
<div id="terminal-left" class="terminal-box"></div>
<div id="terminal-right" class="terminal-box"></div>
</div>
<div id="usageBox">Script is running...</div>
<script>
function initTerminal(selector, greeting) {
$(selector).terminal(function (command) {
if (command.trim() === "") {
this.echo("Invalid command.");
return;
}
const args = command.split(' ');
const term = this;
if (args[0] === "sleep") {
args.shift();
// do sleep here
} else {
this.echo("Invalid command.");
}
}, {
greetings: greeting,
name: selector,
height: '100%',
prompt: '$ ',
pauseEvents: false
});
}
// initialize both terminals
$(document).ready(function () {
initTerminal('#terminal-left', 'Welcome to LEFT terminal\nCommands: sleep, matrix, scriptmemory, figlet');
initTerminal('#terminal-right', 'Welcome to RIGHT terminal\nCommands: sleep, matrix, scriptmemory, figlet');
// Update usage box
setInterval(function () {
if (performance.memory) {
document.getElementById('usageBox').innerText =
'Used JS Heap Size: ' + (performance.memory.usedJSHeapSize / 1024 / 1024).toFixed(2) + ' MB';
}
}, 1000);
});
</script>
</body>
</html>
Browser and OS
Meta Quest 3S Latest stable
