I am working on a small editor that runs inside a terminal window. I am currently capturing user input using the following construct:
use IO::Handle;
my $stdin = new IO::Handle;
$stdin->fdopen( fileno( STDIN ), "r" ) || die "Cannot open STDIN";
while ( my $char = $stdin->getc() ) {
# ... etc etc
The capturing is to deal with such things as arrow keys so the user (me) can navigate and more easily edit text before submitting.
I am wondering if there is a way, AFTER the user has done their editing, and submits, can the text that is displayed in the terminal be read in its updated form from the terminal?
This would save me having to track every input event to construct the final string.
Thanks!