From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Fix video console newline and carriage return handling
Date: Fri, 11 Jan 2008 02:39:47 +0100 [thread overview]
Message-ID: <4786C8E3.7080001@denx.de> (raw)
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: Anatolij Gustschin <agust@denx.de>
---
drivers/video/cfb_console.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 82cc0c7..6262d02 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -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 */
- console_newline ();
+ 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}
--
1.5.3.3
reply other threads:[~2008-01-11 1:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4786C8E3.7080001@denx.de \
--to=agust@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox