termy-the-terminal icon indicating copy to clipboard operation
termy-the-terminal copied to clipboard

Clear command

Open drakeaxelrod opened this issue 3 years ago • 4 comments

Is there a way to implement a clear command? Would it be doable as a custom command? Sorry I’m still learning react and JavaScript/typescript.

drakeaxelrod avatar Mar 24 '21 22:03 drakeaxelrod

I've have to look into this a bit. I think it might tough to do as a custom command since a clear usually involves "clearing" everything on the screen and moving the prompt to the top of the terminal. I believe you would effectively clear the terminal history display but keep the command history. I'll definitely take it as a feature suggestion, though. Thanks!

ctaylo21 avatar Mar 29 '21 02:03 ctaylo21

Actually, after looking at this a bit more, I think this might be solvable with some CSS/JS. The clear command is really just about clearing what's rendered on the screen and moving the prompt to the top of the window.

However, you can still scroll up and see all of the previous inputs/results. I'll do some thinking, but maybe this could be solved with something like scrollIntoView

ctaylo21 avatar Mar 29 '21 18:03 ctaylo21

@ctaylo21 That clear method would mimick what happens on most Linux bash terminals and that would be nice at the very least. On Windows command prompt the clear will prevent you from viewing the previous commands/output when you scroll up.

nicpenning avatar Mar 29 '21 22:03 nicpenning

My friend implemented it but I’m not sure if it’s a super elegant solution https://github.com/nk-io/termy-the-terminal

drakeaxelrod avatar Mar 30 '21 21:03 drakeaxelrod