mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
feat(phoenix): Make clear
clear scrollback unless -x
is given
From what I understand, we shouldn't need both `\x1B[2J` and `\x1B[3J` sequences to clear everything, but xterm.js would not correctly clear the visible region with only `\x1B[3J`. So, we have both.
This commit is contained in:
parent
d76e7130cb
commit
75a989a7b6
@ -21,11 +21,19 @@ export default {
|
|||||||
usage: 'clear',
|
usage: 'clear',
|
||||||
description: 'Clear the terminal output.',
|
description: 'Clear the terminal output.',
|
||||||
args: {
|
args: {
|
||||||
// TODO: add 'none-parser'
|
|
||||||
$: 'simple-parser',
|
$: 'simple-parser',
|
||||||
allowPositionals: false
|
allowPositionals: false,
|
||||||
|
options: {
|
||||||
|
'keep-scrollback': {
|
||||||
|
description: 'Only clear the visible portion of the screen, and keep the scrollback.',
|
||||||
|
type: 'boolean',
|
||||||
|
short: 'x',
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
execute: async ctx => {
|
execute: async ctx => {
|
||||||
await ctx.externs.out.write('\x1B[H\x1B[2J');
|
await ctx.externs.out.write('\x1B[H\x1B[2J');
|
||||||
|
if (!ctx.locals.values['keep-scrollback'])
|
||||||
|
await ctx.externs.out.write('\x1B[H\x1B[3J');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user