|
I am not able to access tracker.eluaproject.net; the URL does not resolve. So I'm posting here.
Issue:
term.clrscr() is supposed to clear the screen and move the cursor to screen position 1,1. It clears the screen but does not move the terminal's cursor to 1,1.
Background:
Issue presents using the elua-master tree for the STM32F4 Discovery board from 28 Jun 2013. Tests were run on an STM32F4 Discovery board connected via CDC (USB) to Windows XP (SP3) laptop, using TeraTerm Pro as a serial console.
Repro steps:
Run the following eLua script, using an ANSI terminal as the console display (either UART or CDC)--
-- Test of term.clrscr() function
-- Print text to move cursor away from column 1.
-- Clear screen, then print more text.
-- This additional text should start at top-left corner.
term.clrscr()
term.moveto(10, 10)
term.print("Hello!")
term.clrscr()
print("This text should start in top-left corner...")
print()
while (term.getchar(term.NOWAIT) == -1) do
end
Note that the screen contains only one line of text and that text is located near the center of the screen. This is the issue.
Root cause:
This problem occurs because the function term_clrscr() in /src/term.c uses an ESC-2J to home and clear the screen. Per ANSI standard, this only clears the screen; it does not move the cursor. MS-DOS used an ANSI.SYS that added the cursor positioning but was not ANSI-compliant.
Proposed change:
Modify term_clrscr() in /src/term.c as below--
// Clear the screen
void term_clrscr()
{
term_ansi("H"); // force move to 1, 1
term_ansi( "2J" );
term_cx = term_cy = 0;
}
Confirmation:
I made the above change to term.c, rebuilt, and reran above test. I confirmed that the line of text appeared in the upper-left corner of the display as expected.
|