mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: logger upd
This commit is contained in:
1 parent
d4088f429a
commit
4d031eb9ab
9 files changed
+141
-131
No files matched your search
@@ -51,7 +51,11 @@ if (cluster.isMaster) {
|
||||
bus.on('message/log', (message) => {
|
||||
LogBox.appendLog(message);
|
||||
});
|
||||
const history = [''];
|
||||
let current = 0;
|
||||
ShellInput.on('submit', async (input) => {
|
||||
history.push(input);
|
||||
current = history.length;
|
||||
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
|
||||
ShellInput.input.setContent('', false, false);
|
||||
if (input[0] === '@') {
|
||||
@@ -61,6 +65,17 @@ if (cluster.isMaster) {
|
||||
}
|
||||
} else bus.parallel('message/run', input);
|
||||
});
|
||||
ShellInput.on('key', (key) => {
|
||||
if (key === 'UP') {
|
||||
current--;
|
||||
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
|
||||
ShellInput.input.setContent(history[current] || '', false, false);
|
||||
} else if (key === 'DOWN') {
|
||||
current++;
|
||||
ShellInput.input.setContent(' '.repeat(terminal.width), false, false);
|
||||
ShellInput.input.setContent(history[current] || '', false, false);
|
||||
}
|
||||
});
|
||||
terminal.on('key', (key, matches, data) => {
|
||||
if (key === 'CTRL_C') terminate();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user