FlexProp Clear Screen "C"
Shawna
Posts: 508
I have been playing around with FlexProp the last couple of days and I am getting stuck on a stupid problem. I want to be able to clear the terminal screen.
In SimpleIDE I would use.
I have tried the following with no luck.
How does one clear the terminal screen with the print() function or the printf() function?
This is a stupid problem I am having, but a problem none the less.
Thanks
Shawn A.
In SimpleIDE I would use.
term_cmd(CLS);
I have tried the following with no luck.
clrscr(); system("clear"); printf("%c",16); printf("\x10"); printf("%c", CLS); print("%c", CLS);
How does one clear the terminal screen with the print() function or the printf() function?
This is a stupid problem I am having, but a problem none the less.
Thanks
Shawn A.
Comments
puts("\x1b[0;0H"); // move cursor
puts("\x1b[2J"); // clear to end of display
ESC [ 0;0H
ESC [ 2J
Mike
The terminal is just the standard Windows terminal. This uses standard ANSI escape codes (https://en.wikipedia.org/wiki/ANSI_escape_code). For example, home is ESC-[-H, clear from current cursor position to end of screen is ESC-[-J.
What code do you guys use to clear the terminal?
But, assuming you're in Windows, it should be the same terminal.
One is the regular ANSI one, which I think is the default. This is the one I'm using.
The other is a PST compatible terminal. This one probably has different codes to control the screen.
You might want to check the FlexProp GUI settings to make sure...
This works for me on P2 with FlexProp GUI. Imagine will work on P1 too.
Oh, wait, this is a P2 specific example...
Seems the loader is different... P1 uses proploader...
I think I'd report this to @ersmith
If everything is on one line, you can send a bunch of backspace characters to clear the current line...
If that's the case, I think it'd be the same when invoked outside of flexprop (i.e., if you were to run it manually on the command line). I think the capabilities of the built-in terminal functionality of the loader depend on the capabilities of whatever terminal emulator it's being run in (so, if cmd.exe is the terminal, and it doesn't interpret ANSI control codes, it won't work). I could be wrong, though - definitely no Windows buff...
I tried the following code in SimpleIDE and had the same result as in FlexPropGui. I suppose that's because they both use Proploader for the P1?
Yes that's correct.
This does seem to be the case.
I ended up creating a custom PuTTy session and creating a shortcut on my desktop for it. I also removed the -t from the configuration Run Command in FlexProp. Its seems by removing the -t the default terminal will not open when the Compile And Run button is pressed.
I played around with the run commands to try and get it to launch my PuTTy session automatically but failed. I think I was close, either way I learned a little bit more about the command line options.
Thanks for all the input guys.
Shawn A.
It has pretty clear cut screen controls (click on the "Prefs..." Button to see).
It has an automatic disable function when you go to another window, so can get into it fast.
Thanks Again
Shawn A.
Mike
@msrobots I investigated this via the google and found a workaround. In the Registry Editor under HKEY_CURRENT_USER\Console I added a DWORD named "VirtualTerminalLevel" and gave it a value of 0x1.
The following code will clear the display, but instead of placing the cursor at line 0 column 0, it places it at line 1 column 0. I'm not sure why but I can live with it.
Thanks
Shawn A.
I'll try to dig through the P1 loader code and see if I can figure out how to make ANSI the default, as it is in the P2 loader.