arsd terminal with ConsoleOutputType.cellular

Adam D. Ruppe destructionator at gmail.com
Sat Jul 13 13:39:38 UTC 2019


On Saturday, 13 July 2019 at 13:30:47 UTC, Jani Hur wrote:
> void main() {
>   auto term = Terminal(ConsoleOutputType.cellular);
>   term.clear;
>   term.writefln("(%s, %s)", term.cursorX, term.cursorY);
> }

In cellular mode, it switches the terminal to an alternate screen 
(like vim - notice that when you exit vim, it goes back to the 
same screen view you had when you went into it, instead of being 
leftover stuff from the full screen application), and terminal's 
destructor switches back.

So what happened here is:

1) it switched to the alternate screen.
2) cleared and printed text to that
3) switched back to the normal screen at program exit


Meaning you don't see the output!

Simply add some kind of wait to the end of main() so the program 
doesn't exit.

Like

term.getline();

right at teh end so it waits for you to press enter before 
exiting and you should see it.


More information about the Digitalmars-d-learn mailing list