[Lazarus] How to clear screen in console app

Michael Van Canneyt michael at freepascal.org
Sat Apr 23 09:00:45 CEST 2016



On Sat, 23 Apr 2016, Bo Berglund wrote:

> On Sat, 23 Apr 2016 07:32:55 +0200, Bo Berglund
> <bo.berglund at gmail.com> wrote:
>
>> I need to make a console app that can run on Linux.
>> It would be a simple thing I believed, but no...
>>
>> I cannot get the ClrScr command working, it just puts strange
>> characters on the screen instead of clearing it.
> ...
>> But the console debug window just shows a bunch of control characters
>> (square with 001B inside) plus [6n [H [m [H [2JEnter command:
>> And every command I enter results in a new line being displayed rather
>> than staying on the same line and erasing the previous output.
>
> UPDATE:
> It seems to be caused by the Lazarus debug console window!
> If I go to the dir where the program resides in my terminal (both
> local and via SSH) and execute ~/tmp/project1 then it looks OK.
>
> So my question now changes to:
> Why does the debug window show different output than the actual
> terminal console?
>
> I am using Lazarus 1.6 release and fpc 3.0.0 both built from svn
> sources on a Raspberry Pi3 with Raspbian Jessie if that matters.

The console respects the special terminal control characters.
The debug window does not respect these characters, and just prints them out
to screen. I am not sure this can be properly handled. Maybe there is an
option that can be given to xterm to respect the characters.

If you are debugging using SSH, then you probably need to add the -t option.

Michael.




More information about the Lazarus mailing list