Skip to content
Snippets Groups Projects
Commit 20c450ef authored by Anatolij Gustschin's avatar Anatolij Gustschin Committed by Rodolfo Giometti
Browse files

Fix video console newline and carriage return handling


Lines of the lenght CONSOLE_COLS or greater than CONSOLE_COLS
are not displayed correctly. This is an attempt to fix
this issue. Also add carriage return handling.

Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
Signed-off-by: default avatarRodolfo Giometti <giometti@linux.it>
parent 422b1a01
Branches
Tags
No related merge requests found
......@@ -647,7 +647,14 @@ static void console_back (void)
static void console_newline (void)
{
CURSOR_OFF console_row++;
/* Check if last character in the line was just drawn. If so, cursor was
overwriten and need not to be cleared. Cursor clearing without this
check causes overwriting the 1st character of the line if line lenght
is >= CONSOLE_COLS
*/
if (console_col < CONSOLE_COLS)
CURSOR_OFF
console_row++;
console_col = 0;
/* Check if we need to scroll the terminal */
......@@ -660,16 +667,26 @@ static void console_newline (void)
}
}
static void console_cr (void)
{
CURSOR_OFF console_col = 0;
}
/*****************************************************************************/
void video_putc (const char c)
{
static int nl = 1;
switch (c) {
case 13: /* ignore */
case 13: /* back to first column */
console_cr ();
break;
case '\n': /* next line */
if (console_col || (!console_col && nl))
console_newline ();
nl = 1;
break;
case 9: /* tab 8 */
......@@ -691,8 +708,10 @@ void video_putc (const char c)
console_col++;
/* check for newline */
if (console_col >= CONSOLE_COLS)
if (console_col >= CONSOLE_COLS) {
console_newline ();
nl = 0;
}
}
CURSOR_SET}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment