@samitouri / QOSamiQemu / commits / f93cc8f331

ui/console-vc: move vc_put_lf() to VT100 layer as vt100_put_lf()

Decouple the line-feed handling from VCChardev by operating on QemuVT100 directly. The function no longer needs the chardev or console pointers — callers pass &s->vt instead. This continues the effort to make the VT100 terminal emulation self-contained. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Marc-André Lureau committed Feb 19, 2026 at 13:50 UTC f93cc8f3314e094ff6f64db397494c881b0c0478
1 file changed +4 -6
ui/console-vc.c
+4 -6
@@ -432,10 +432,8 @@ static void vt100_set_image(QemuVT100 *vt, pixman_image_t *image)
432 vt->cells = cells;
433 }
434
435 -static void vc_put_lf(VCChardev *vc)
435 +static void vt100_put_lf(QemuVT100 *vt)
436 {
437 - QemuTextConsole *s = vc->console;
438 - QemuVT100 *vt = &s->vt;
437 TextCell *c;
438 int x, y1;
439
@@ -626,7 +624,7 @@ static void vc_put_one(VCChardev *vc, int ch)
624 if (vt->x >= vt->width) {
625 /* line wrap */
626 vt->x = 0;
629 - vc_put_lf(vc);
627 + vt100_put_lf(vt);
628 }
629 y1 = (vt->y_base + vt->y) % vt->total_height;
630 c = &vt->cells[y1 * vt->width + vt->x];
@@ -792,7 +790,7 @@ static void vc_putchar(VCChardev *vc, int ch)
790 vt->x = 0;
791 break;
792 case '\n': /* newline */
795 - vc_put_lf(vc);
793 + vt100_put_lf(&s->vt);
794 break;
795 case '\b': /* backspace */
796 if (vt->x > 0)
@@ -801,7 +799,7 @@ static void vc_putchar(VCChardev *vc, int ch)
799 case '\t': /* tabspace */
800 if (vt->x + (8 - (vt->x % 8)) > vt->width) {
801 vt->x = 0;
804 - vc_put_lf(vc);
802 + vt100_put_lf(vt);
803 } else {
804 vt->x = vt->x + (8 - (vt->x % 8));
805 }