Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD could i get a TCC dev (Rexx?) to comment on this github thread for windows terminal about which method TCC uses to clear the screen?

Jul
184
5
I marked this as "bug", but it's not necessarily an actual bug, maybe more of an interoperability issue:


They are asking about what method TCC clears the screen, so they can correctly detect it. I do not have the inside knowledge to answer that question.

They think that is the cause of a terminal emulation bug I discovered.

Thank you!!
 
Last edited:
TCC uses different ways to clear the screen, depending on which CLS option you use.

If you use CLS /S, TCC scrolls the screen using the Windows ScrollConsoleScreenBuffer API.

If you use CLS /C, TCC uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the entire console buffer to blanks with the desired attribute.

A plain CLS uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the current screen window to blanks with the desired attribute.
 
TCC uses different ways to clear the screen, depending on which CLS option you use.

If you use CLS /S, TCC scrolls the screen using the Windows ScrollConsoleScreenBuffer API.

If you use CLS /C, TCC uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the entire console buffer to blanks with the desired attribute.

A plain CLS uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the current screen window to blanks with the desired attribute.

Thank you Rexx! I'll provide the Windows Terminal people that info!
 
TCC uses different ways to clear the screen, depending on which CLS option you use.

If you use CLS /S, TCC scrolls the screen using the Windows ScrollConsoleScreenBuffer API.

If you use CLS /C, TCC uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the entire console buffer to blanks with the desired attribute.

A plain CLS uses the Windows FillConsoleOutputCharacterW and FillConsoleOutputAttribute APIs to write the current screen window to blanks with the desired attribute.
There are easier ways these days. Below, EMIT is WriteConsoleW to a CONOUT$ handle. Nothing special about EMIT/CONOUT$. You can do these with ECHO, Printf, ... .

Scroll to empty window: EMIT(L"\x01b[2J\x01b[H");

Clear everything: EMIT(L"\x1b[2J\x1b[3J\x1b[H");

Clear just the window. EMIT(L"\x1b[H\x1b[0J");
 
There are easier ways these days. Below, EMIT is WriteConsoleW to a CONOUT$ handle. Nothing special about EMIT/CONOUT$. You can do these with ECHO, Printf, ... .

Scroll to empty window: EMIT(L"\x01b[2J\x01b[H");

Clear everything: EMIT(L"\x1b[2J\x1b[3J\x1b[H");

Clear just the window. EMIT(L"\x1b[H\x1b[0J");

Interesting! I tested that out and it prevented the double-height line bug I reported over at Windows Terminal from happening

So their theory is correct: They were not correctly detecting TCC's method of screen clearing.
 

Similar threads

Back
Top