save last cmd

This commit is contained in:
b1ek 2023-03-16 14:10:22 +10:00
parent 254385faee
commit 755daf7c8d
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 2 additions and 1 deletions

View File

@ -18,7 +18,7 @@ let dom;
const prompt = '\033[1;32muser@blek.codes \033[36m~ $ \033[0m';
let cmd = '';
let lastcmd = '';
let lastcmd = window.sessionStorage.getItem('last_cmd') || '';
function text_prompt() {
return prompt.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
@ -52,6 +52,7 @@ function exec_cmd() {
const command = c.split(' ')[0];
reset_cmd(c);
lastcmd = c;
window.sessionStorage.setItem('last_cmd', c);
if (command == '') {
print_prompt();