qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Matthew Kilgore <mattkilgore12@gmail.com>
Cc: philmd@redhat.com, qemu-devel@nongnu.org,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH v2 2/2] curses: correctly pass the color pair to setcchar()
Date: Sun, 13 Oct 2019 17:34:45 +0200	[thread overview]
Message-ID: <20191013153445.2n62uokrvhdd7jo4@function> (raw)
In-Reply-To: <20191004035338.25601-3-mattkilgore12@gmail.com>

Matthew Kilgore, le jeu. 03 oct. 2019 23:53:38 -0400, a ecrit:
> The current code does not correctly pass the color pair information to
> setcchar(), it instead always passes zero. This results in the curses
> output always being in white on black.
> 
> This patch fixes this by using PAIR_NUMBER() to retrieve the color pair
> number from the chtype value, and then passes that value as an argument
> to setcchar().
> 
> Signed-off-by: Matthew Kilgore <mattkilgore12@gmail.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
>  ui/curses.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/curses.c b/ui/curses.c
> index 84003f56a323..3a1b71451c93 100644
> --- a/ui/curses.c
> +++ b/ui/curses.c
> @@ -77,12 +77,14 @@ static void curses_update(DisplayChangeListener *dcl,
>          for (x = 0; x < width; x++) {
>              chtype ch = line[x] & A_CHARTEXT;
>              chtype at = line[x] & A_ATTRIBUTES;
> +            short color_pair = PAIR_NUMBER(line[x]);
> +
>              ret = getcchar(&vga_to_curses[ch], wch, &attrs, &colors, NULL);
>              if (ret == ERR || wch[0] == 0) {
>                  wch[0] = ch;
>                  wch[1] = 0;
>              }
> -            setcchar(&curses_line[x], wch, at, 0, NULL);
> +            setcchar(&curses_line[x], wch, at, color_pair, NULL);
>          }
>          mvwadd_wchnstr(screenpad, y, 0, curses_line, width);
>      }
> -- 
> 2.23.0
> 

-- 
Samuel
<macavity> bash: ls: Computer bought the farm
<macavity> THAT frightens ppl! :P
<macavity> id rather see: "bash: ls: Initialization of googol(AWAX)
        disengaged in HYPER32/64 mode due to faulty page request at
        AX:12A34F84B"
<macavity> at least that would give me the feeling that the
        *programmers* knows what is going on :P
(lovely Hurd...)


      reply	other threads:[~2019-10-13 15:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04  3:53 [PATCH v2 0/2] curses: fix attribute passing Matthew Kilgore
2019-10-04  3:53 ` [PATCH v2 1/2] curses: use the bit mask constants provided by curses Matthew Kilgore
2019-10-04  8:57   ` Philippe Mathieu-Daudé
2019-10-13 15:34   ` Samuel Thibault
2019-10-04  3:53 ` [PATCH v2 2/2] curses: correctly pass the color pair to setcchar() Matthew Kilgore
2019-10-13 15:34   ` Samuel Thibault [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191013153445.2n62uokrvhdd7jo4@function \
    --to=samuel.thibault@gnu.org \
    --cc=kraxel@redhat.com \
    --cc=mattkilgore12@gmail.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).