C-sharp-console-gui-framework icon indicating copy to clipboard operation
C-sharp-console-gui-framework copied to clipboard

Cleanup console

Open evaanp opened this issue 2 years ago • 1 comments

Is it possible to use the library to prompt an user for input, and then cleanup all the elements and proceed the console application as if nothing happened?

Right now all console output is removed after drawing elements on the screen.

evaanp avatar Jan 27 '22 12:01 evaanp

Indeed, currently the library will clear the entire buffer and reshape it for its own use.

A quick search suggests that it's possible to get the current state of the terminal buffer, so in theory it should be possible to retrieve previously printed values just before initializing the library and restoring that state after the user interaction has ended.

https://stackoverflow.com/questions/12355378/read-from-location-on-console-c-sharp

Though it seems that this solution would be platform (or even terminal) dependent, as it uses dll imports and not part of the public API provided by .NET.

What is your use case here? If it's just to prompt the user for input, it might be easier to just ask for the value and read it from the console without using any framework.

TomaszRewak avatar Jan 29 '22 23:01 TomaszRewak