The terminal escape sequence ESC [ <x> ; <y> H is used to set the cursor
position. According to the ECMA 48 standard the upper left corner in the
escape sequences is [1, 1]. The video uclass uses [0, 0] as upper left
corner.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
v2
        remove trailing whitespace
---
 drivers/video/vidconsole-uclass.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/video/vidconsole-uclass.c 
b/drivers/video/vidconsole-uclass.c
index 1874887f2f3..5564cfe9930 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -271,6 +271,14 @@ static void vidconsole_escape_char(struct udevice *dev, 
char ch)
                s = parsenum(s, &row);
                s++;    /* ; */
                s = parsenum(s, &col);
+
+               /*
+                * Video origin is [0, 0], terminal origin is [1, 1].
+                */
+               if (row)
+                       --row;
+               if (col)
+                       --col;
 
                set_cursor_position(priv, row, col);
 
-- 
2.19.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to