react-console
react-console copied to clipboard
Clear Console
Is there a way to clear the console?
This is how I solved the screen clearing. More of a hack but it works. https://github.com/csprance/MisRCON/blob/master/app/components/ConsoleView/ConsoleView.js#L34
I have thought about implementing this in several ways. I want the behavior to mirror bash's CTRL+L functionality as much as possible. Specifically, the scrollback should not be altered and a new prompt should be drawn containing the current promptline contents. @csprance Correct me if I am wrong, but does your solution destroy the scrollback?
Unfortunately, I have not been able to figure out how to scroll inside an HTML container such that the contents are placed at the top of the console, while seamlessly growing downward with output.
@csprance A simpler solution:
this.refs.console.setState({
acceptInput: true,
log: []
});
@STRML this doesn't replicate readline behavior, which clears the screen but doesn't destroy the log.
+1 for this, would be a great feature