All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position
@ 2018-11-10 18:55 Heinrich Schuchardt
  2018-11-13 19:54 ` Simon Glass
  2018-11-17 10:52 ` Anatolij Gustschin
  0 siblings, 2 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2018-11-10 18:55 UTC (permalink / raw)
  To: u-boot

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.glpk@gmx.de>
---
v3:
	update unit test
v2
	remove trailing whitespace
---
 drivers/video/vidconsole-uclass.c | 8 ++++++++
 test/dm/video.c                   | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 1874887f2f3..db40a1396b2 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -272,6 +272,14 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 		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);
 
 		break;
diff --git a/test/dm/video.c b/test/dm/video.c
index 7def338058e..5d1faac19c9 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -178,12 +178,12 @@ static int dm_test_video_ansi(struct unit_test_state *uts)
 
 	/* test set-cursor: [%d;%df */
 	vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd");
-	ut_asserteq(142, compress_frame_buffer(dev));
+	ut_asserteq(143, compress_frame_buffer(dev));
 
 	/* test colors (30-37 fg color, 40-47 bg color) */
 	vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */
 	vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */
-	ut_asserteq(265, compress_frame_buffer(dev));
+	ut_asserteq(272, compress_frame_buffer(dev));
 
 	return 0;
 }
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position
  2018-11-10 18:55 [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position Heinrich Schuchardt
@ 2018-11-13 19:54 ` Simon Glass
  2018-11-17 10:52 ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2018-11-13 19:54 UTC (permalink / raw)
  To: u-boot

On 10 November 2018 at 10:55, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> 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.glpk@gmx.de>
> ---
> v3:
>         update unit test
> v2
>         remove trailing whitespace
> ---
>  drivers/video/vidconsole-uclass.c | 8 ++++++++
>  test/dm/video.c                   | 4 ++--
>  2 files changed, 10 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position
  2018-11-10 18:55 [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position Heinrich Schuchardt
  2018-11-13 19:54 ` Simon Glass
@ 2018-11-17 10:52 ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2018-11-17 10:52 UTC (permalink / raw)
  To: u-boot

On Sat, 10 Nov 2018 19:55:48 +0100
Heinrich Schuchardt xypron.glpk at gmx.de wrote:

> 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.glpk@gmx.de>
> ---
> v3:
> 	update unit test
> v2
> 	remove trailing whitespace
> ---
>  drivers/video/vidconsole-uclass.c | 8 ++++++++
>  test/dm/video.c                   | 4 ++--
>  2 files changed, 10 insertions(+), 2 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-17 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10 18:55 [U-Boot] [PATCH v3 1/1] dm: video: correctly set the cursor position Heinrich Schuchardt
2018-11-13 19:54 ` Simon Glass
2018-11-17 10:52 ` Anatolij Gustschin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.