react-console icon indicating copy to clipboard operation
react-console copied to clipboard

Clear Console

Open loogie opened this issue 8 years ago • 5 comments

Is there a way to clear the console?

loogie avatar Feb 10 '17 04:02 loogie

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

csprance avatar Feb 12 '17 03:02 csprance

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.

astralarya avatar Feb 14 '17 21:02 astralarya

@csprance A simpler solution:

this.refs.console.setState({
  acceptInput: true,
  log: []
});

STRML avatar Feb 22 '17 20:02 STRML

@STRML this doesn't replicate readline behavior, which clears the screen but doesn't destroy the log.

astralarya avatar Feb 22 '17 20:02 astralarya

+1 for this, would be a great feature

matthax avatar Jul 14 '18 05:07 matthax