Skip to content

Commit

Permalink
fix: Fix the issue where login creds get erased on backspace as well
Browse files Browse the repository at this point in the history
  • Loading branch information
meesam4687 committed May 15, 2024
1 parent 041e42b commit af6dd55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ let input = '';
document.addEventListener('keydown', function (event) {
terminalBody.innerHTML = terminalBody.innerHTML.replace(/<span class="caret"><\/span>/g, '');
if (event.key === 'Backspace') {
if(input.length === 0) {
terminalBody.innerHTML += '<span class="caret"></span>';
return;
}
input = input.slice(0, -1);
terminalBody.innerHTML = terminalBody.innerHTML.slice(0, -1);
terminalBody.innerHTML += '<span class="caret"></span>';
Expand Down
1 change: 1 addition & 0 deletions scripts/terminalFunctions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function clearTerminal() {
terminalBody.innerHTML = '';
}

function neofetch() {
terminalBody.innerHTML += `
<pre>
Expand Down

0 comments on commit af6dd55

Please sign in to comment.