fix curses update - v2

Submitted by Bernhard Kauer on May 20, 2010, 8:53 p.m.


Message ID
State New
Headers show

Commit Message

Bernhard Kauer May 20, 2010, 8:53 p.m.
On Mon, May 03, 2010 at 01:06:46PM -0500, Anthony Liguori wrote:
> On 04/22/2010 09:08 AM, Bernhard Kauer wrote:
> >Hi,
> >
> >>I believe this issue has come up before with a similar patch but
> >well i've submitted such a patch more than two years ago.  Unfortunatelly
> >it got never applied, so that I have to patch my Qemu on every update...
> >
> >
> >>someone checked their ncurses and they didn't see the same issue.
> >>I just checked and here mvwaddchnstr() does not expect a null-terminated
> >>string either, but it skips the \0 characters.
> >This is not conforming to the Single UNIX Specification, which states
> >that the string is shown "until a null chtype is encountered". See for
> >example:
> >
> >
> >
> >>  So probably we should
> >>replace them with spaces or something else,  I wouldn't like to
> >>replace a single library call with 80 calls, it's better to go through
> >>the string and replace them, maybe in console_write_ch or somewhere
> >>else.
> >That would be a one-liner.  Should I send such a patch?
> Yes.

Replace the \0 character with a space to allow to use mvwaddchnstr for
full-screen updates in curses mode.

Signed-off-by: Bernhard Kauer <>


andrzej zaborowski May 21, 2010, 12:02 p.m.

I pushed a modified patch to preserve attributes such as background
colour.  Please check if this works for you.

Bernhard Kauer May 21, 2010, 12:43 p.m.
On Fri, May 21, 2010 at 02:02:43PM +0200, andrzej zaborowski wrote:
> I pushed a modified patch to preserve attributes such as background
> colour.

Good idea.

>  Please check if this works for you.

Yes, this works.


	Bernhard Kauer

Patch hide | download patch | download mbox

diff --git a/console.h b/console.h
index 6def115..42ff822 100644
--- a/console.h
+++ b/console.h
@@ -306,6 +306,7 @@  static inline int ds_get_bytes_per_pixel(DisplayState *ds)
 typedef unsigned long console_ch_t;
 static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
+    if (!(ch & 0xff))  ch = 0x20;
     cpu_to_le32wu((uint32_t *) dest, ch);