Commit ed8276ac7e7e4d18cbb37ee3069f3fc2f08ca1c7
1 parent
dbcf5e82
Serial console improvements, by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2412 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
12 additions
and
13 deletions
console.c
| @@ -533,21 +533,24 @@ static void console_show_cursor(TextConsole *s, int show) | @@ -533,21 +533,24 @@ static void console_show_cursor(TextConsole *s, int show) | ||
| 533 | int y, y1; | 533 | int y, y1; |
| 534 | 534 | ||
| 535 | if (s == active_console) { | 535 | if (s == active_console) { |
| 536 | + int x = s->x; | ||
| 537 | + if (x >= s->width) { | ||
| 538 | + x = s->width - 1; | ||
| 539 | + } | ||
| 536 | y1 = (s->y_base + s->y) % s->total_height; | 540 | y1 = (s->y_base + s->y) % s->total_height; |
| 537 | y = y1 - s->y_displayed; | 541 | y = y1 - s->y_displayed; |
| 538 | if (y < 0) | 542 | if (y < 0) |
| 539 | y += s->total_height; | 543 | y += s->total_height; |
| 540 | if (y < s->height) { | 544 | if (y < s->height) { |
| 541 | - c = &s->cells[y1 * s->width + s->x]; | 545 | + c = &s->cells[y1 * s->width + x]; |
| 542 | if (show) { | 546 | if (show) { |
| 543 | TextAttributes t_attrib = s->t_attrib_default; | 547 | TextAttributes t_attrib = s->t_attrib_default; |
| 544 | t_attrib.invers = !(t_attrib.invers); /* invert fg and bg */ | 548 | t_attrib.invers = !(t_attrib.invers); /* invert fg and bg */ |
| 545 | - vga_putcharxy(s->ds, s->x, y, c->ch, &t_attrib); | 549 | + vga_putcharxy(s->ds, x, y, c->ch, &t_attrib); |
| 546 | } else { | 550 | } else { |
| 547 | - vga_putcharxy(s->ds, s->x, y, c->ch, | ||
| 548 | - &(c->t_attrib)); | 551 | + vga_putcharxy(s->ds, x, y, c->ch, &(c->t_attrib)); |
| 549 | } | 552 | } |
| 550 | - dpy_update(s->ds, s->x * FONT_WIDTH, y * FONT_HEIGHT, | 553 | + dpy_update(s->ds, x * FONT_WIDTH, y * FONT_HEIGHT, |
| 551 | FONT_WIDTH, FONT_HEIGHT); | 554 | FONT_WIDTH, FONT_HEIGHT); |
| 552 | } | 555 | } |
| 553 | } | 556 | } |
| @@ -796,8 +799,10 @@ static void console_putchar(TextConsole *s, int ch) | @@ -796,8 +799,10 @@ static void console_putchar(TextConsole *s, int ch) | ||
| 796 | s->state = TTY_STATE_ESC; | 799 | s->state = TTY_STATE_ESC; |
| 797 | break; | 800 | break; |
| 798 | default: | 801 | default: |
| 799 | - if (s->x >= s->width - 1) { | ||
| 800 | - break; | 802 | + if (s->x >= s->width) { |
| 803 | + /* line wrap */ | ||
| 804 | + s->x = 0; | ||
| 805 | + console_put_lf(s); | ||
| 801 | } | 806 | } |
| 802 | y1 = (s->y_base + s->y) % s->total_height; | 807 | y1 = (s->y_base + s->y) % s->total_height; |
| 803 | c = &s->cells[y1 * s->width + s->x]; | 808 | c = &s->cells[y1 * s->width + s->x]; |
| @@ -805,12 +810,6 @@ static void console_putchar(TextConsole *s, int ch) | @@ -805,12 +810,6 @@ static void console_putchar(TextConsole *s, int ch) | ||
| 805 | c->t_attrib = s->t_attrib; | 810 | c->t_attrib = s->t_attrib; |
| 806 | update_xy(s, s->x, s->y); | 811 | update_xy(s, s->x, s->y); |
| 807 | s->x++; | 812 | s->x++; |
| 808 | -#if 0 /* line wrap disabled */ | ||
| 809 | - if (s->x >= s->width) { | ||
| 810 | - s->x = 0; | ||
| 811 | - console_put_lf(s); | ||
| 812 | - } | ||
| 813 | -#endif | ||
| 814 | break; | 813 | break; |
| 815 | } | 814 | } |
| 816 | break; | 815 | break; |