ui: terminal emulation fix.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJdHaT/AAoJEEy22O7T6HE4sBUP/2Fv8dSMNg0B0l+HRcdsFsup
 Fp1xuaNh/NTK7Qb90ZN2OF9UsBvoEFYNI2FGijTZ2Mfvt2bCto6B+Ph2IMvWZYMH
 K1pSJlSLOOgrkPzKpWrE8BfCbFleiorTGxQN5MNZ8sRz+v3g6fHtU7hymTSMaV1G
 oQtxsKY/PDoavJetmi1V3V7ivrxzkNeldnimxWboDN6oNshO2M1m1BUNSi+pk3Hq
 k+1v6/Sus3CIbdCOzKulRHVCCJjDEFIdvRTbCaSAhzR+RlyrfDCRAUNFG4njK5ct
 mGChz5PD8rgzmwd3Q2giqY086tuaFBD0ljbXPR74QTfqeSyrovRiJ6bttXox5+7P
 6cCpJi6iQF0rkYLxzc+MPQjKV1x/MUa2s7Q4AMAE9mYlkzhqxpkxTj6C1Unh7Vgu
 8koMySslHT/UZdMurbI937JF6UWFWs+nwE9cwtsaun4MR6BBGaHyWpVtoqyh/mmq
 EePVInd9NHlMW1DpAJ/a3G+vBO5SxpwguIU4PdD8I1oJqXlM/60mSeUV1LnkS8oC
 /c02rUZ/6HTNyA6Lott7SMMU2jeKASL3HG41JAYtw31Ybnaf8iHWxyZchx1xL/GH
 J3h5BstsXKn8pfQbBNHuhgiEmJOXpcBVuGvSqM6M26QLwDUa2XqV/FpP9VjLHIGD
 MGkoCmGOnJjAkk216m4z
 =FDyd
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190704-pull-request' into staging

ui: terminal emulation fix.

# gpg: Signature made Thu 04 Jul 2019 08:04:31 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20190704-pull-request:
  console: fix cell overflow

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-07-04 16:43:13 +01:00
commit c3e1d838cf
1 changed files with 8 additions and 2 deletions

View File

@ -484,7 +484,7 @@ static void text_console_resize(QemuConsole *s)
if (s->width < w1)
w1 = s->width;
cells = g_new(TextCell, s->width * s->total_height);
cells = g_new(TextCell, s->width * s->total_height + 1);
for(y = 0; y < s->total_height; y++) {
c = &cells[y * s->width];
if (w1 > 0) {
@ -541,6 +541,9 @@ static void update_xy(QemuConsole *s, int x, int y)
y2 += s->total_height;
}
if (y2 < s->height) {
if (x >= s->width) {
x = s->width - 1;
}
c = &s->cells[y1 * s->width + x];
vga_putcharxy(s, x, y2, c->ch,
&(c->t_attrib));
@ -787,6 +790,9 @@ static void console_handle_escape(QemuConsole *s)
static void console_clear_xy(QemuConsole *s, int x, int y)
{
int y1 = (s->y_base + y) % s->total_height;
if (x >= s->width) {
x = s->width - 1;
}
TextCell *c = &s->cells[y1 * s->width + x];
c->ch = ' ';
c->t_attrib = s->t_attrib_default;
@ -992,7 +998,7 @@ static void console_putchar(QemuConsole *s, int ch)
break;
case 1:
/* clear from beginning of line */
for (x = 0; x <= s->x; x++) {
for (x = 0; x <= s->x && x < s->width; x++) {
console_clear_xy(s, x, s->y);
}
break;