diff options
author | Andre Przywara <andre.przywara@arm.com> | 2019-03-23 01:29:58 +0000 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2019-04-14 14:18:47 +0200 |
commit | 4422294cbe37e3b2bcbbb066e0d53411880cf07e (patch) | |
tree | 9b6900d1b70587a43fc6655e23b8b9169f34b83e /drivers/video/vidconsole-uclass.c | |
parent | 29c158b90d9fe1b8e007ee6b43f85c7f4b5f848b (diff) |
video/console: Implement ANSI clear line command
There is a standard ANSI terminal escape sequence to clear a whole line
of text. So far the DM_VIDEO console was missing this code.
Detect the sequence and use vidconsole_set_row with the background
colour to fix this omission.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video/vidconsole-uclass.c')
-rw-r--r-- | drivers/video/vidconsole-uclass.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 6cf9124c42..cf2f0dff44 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -346,6 +346,25 @@ static void vidconsole_escape_char(struct udevice *dev, char ch) } break; } + case 'K': { + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + int mode; + + /* + * Clear (parts of) current line + * [0K - clear line to end + * [2K - clear entire line + */ + parsenum(priv->escape_buf + 1, &mode); + + if (mode == 2) { + int row, col; + + get_cursor_position(priv, &row, &col); + vidconsole_set_row(dev, row, vid_priv->colour_bg); + } + break; + } case 'm': { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); char *s = priv->escape_buf; |