mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC PATCH] fbconsole: add missing break
@ 2025-03-25 16:00 Jules Maselbas
  2025-03-27  7:56 ` Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jules Maselbas @ 2025-03-25 16:00 UTC (permalink / raw)
  To: barebox; +Cc: Jules Maselbas

The cursor move CSI has nothing to do with the clear-screen CSI.
The existing fallthrough looks like a bug, add the missing break.

Fixes: 27f79c05ab ("video: implement framebuffer console")
Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
---

 I am not 100% sure if this is a bug or not, it feels like it sould not
 fallthrough, an extra look would be nice.


 drivers/video/fbconsole.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 24592d00ed..7462e34778 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -576,6 +576,7 @@ static void fbc_parse_csi(struct fbc_priv *priv)
 		priv->x = clamp(pos - 1, 0, (int) priv->cols - 1);
 
 		show_cursor(priv, priv->x, priv->y);
+		break;
 	case 'K':
 		pos = simple_strtoul(priv->csi, &end, 10);
 		video_invertchar(priv, priv->x, priv->y);
-- 
2.48.1




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

* Re: [RFC PATCH] fbconsole: add missing break
  2025-03-25 16:00 [RFC PATCH] fbconsole: add missing break Jules Maselbas
@ 2025-03-27  7:56 ` Sascha Hauer
  2025-03-27  8:12 ` Sascha Hauer
  2025-03-27  8:17 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-03-27  7:56 UTC (permalink / raw)
  To: barebox, Jules Maselbas


On Tue, 25 Mar 2025 17:00:08 +0100, Jules Maselbas wrote:
> The cursor move CSI has nothing to do with the clear-screen CSI.
> The existing fallthrough looks like a bug, add the missing break.
> 
> 

Applied, thanks!

[1/1] fbconsole: add missing break
      https://git.pengutronix.de/cgit/barebox/commit/?id=5b2e47b1ff4c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

* Re: [RFC PATCH] fbconsole: add missing break
  2025-03-25 16:00 [RFC PATCH] fbconsole: add missing break Jules Maselbas
  2025-03-27  7:56 ` Sascha Hauer
@ 2025-03-27  8:12 ` Sascha Hauer
  2025-03-27  8:17 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-03-27  8:12 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: barebox

On Tue, Mar 25, 2025 at 05:00:08PM +0100, Jules Maselbas wrote:
> The cursor move CSI has nothing to do with the clear-screen CSI.

CSI n K is erase to beginning or end of line.

> The existing fallthrough looks like a bug, add the missing break.
> 
> Fixes: 27f79c05ab ("video: implement framebuffer console")
> Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
> ---
> 
>  I am not 100% sure if this is a bug or not, it feels like it sould not
>  fallthrough, an extra look would be nice.

Yes, really looks like a bug. Moving the cursor shouldn't erase
anything.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [RFC PATCH] fbconsole: add missing break
  2025-03-25 16:00 [RFC PATCH] fbconsole: add missing break Jules Maselbas
  2025-03-27  7:56 ` Sascha Hauer
  2025-03-27  8:12 ` Sascha Hauer
@ 2025-03-27  8:17 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-03-27  8:17 UTC (permalink / raw)
  To: Jules Maselbas, barebox

On 25.03.25 17:00, Jules Maselbas wrote:
> The cursor move CSI has nothing to do with the clear-screen CSI.
> The existing fallthrough looks like a bug, add the missing break.
> 
> Fixes: 27f79c05ab ("video: implement framebuffer console")
> Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
> ---
> 
>  I am not 100% sure if this is a bug or not, it feels like it sould not
>  fallthrough, an extra look would be nice.

I think it makes sense to add the break.

case 'H' (\e[{line};{column}H) is move cursor and
case 'K' (ESC[{0,1,2}K} is erase.

The code currently interprets the same integer once as line
and another time as erase type for K, which is not lines,
but rather 0 = from cursor to end of line,
           1 = from start of line to cursor
           2 = whole line 

So this patch looks correct IMO.

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> 
> 
>  drivers/video/fbconsole.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
> index 24592d00ed..7462e34778 100644
> --- a/drivers/video/fbconsole.c
> +++ b/drivers/video/fbconsole.c
> @@ -576,6 +576,7 @@ static void fbc_parse_csi(struct fbc_priv *priv)
>  		priv->x = clamp(pos - 1, 0, (int) priv->cols - 1);
>  
>  		show_cursor(priv, priv->x, priv->y);
> +		break;
>  	case 'K':
>  		pos = simple_strtoul(priv->csi, &end, 10);
>  		video_invertchar(priv, priv->x, priv->y);


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2025-03-27  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-25 16:00 [RFC PATCH] fbconsole: add missing break Jules Maselbas
2025-03-27  7:56 ` Sascha Hauer
2025-03-27  8:12 ` Sascha Hauer
2025-03-27  8:17 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox