Setting background to non-ASCII characters can affect addwstr

View: New views
4 Messages — Rating Filter:   Alert me  

Setting background to non-ASCII characters can affect addwstr

by Mike Gran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi-

It seems that if I set the background character using bkgrnd to a
non-ASCII character, it can cause calls to addwstr to not print all of
the characters in the string.

In the sample code below, I display "This is a string", then I set the
background to a dot (U+02D9), then I try to display "This is another
string".  Of the second line, it only prints "This".

If I set the background to a period instead of a dot, it works as
expected.

Thanks,

Mike Gran






[r036_bkgrnd.c]

/* -*- coding: utf-8 -*- */
#define _XOPEN_SOURCE_EXTENDED
#include <curses.h>
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
#include <wchar.h>

int main (int argc, char ** argv)
{
  cchar_t cch_out, cch1;

  setlocale (LC_ALL, "");
  initscr ();
  clear ();
  mvaddwstr (0, 0, L"This is a string");
  setcchar(&cch_out, L"˙", 0, 0, 0); /* string contains U+02D9 */
  //setcchar(&cch_out, L".", 0, 0, 0); /* string contains U+002E */
  bkgrnd (&cch_out);
  mvaddwstr (1, 0, L"This is another string");
  refresh ();
  sleep (2);
  endwin ();

#if 0
  {
    wchar_t wstr[6];
    attr_t attr;
    short color;

    /* Get the letter between "This" and "is" in the above sentence.  */
    mvin_wch (0, 4, &cch1);
    getcchar(&cch_out, wstr, &attr, &color, NULL);
    printf ("wchar printed U+%04x\n", wstr[0]);
    getcchar(&cch1, wstr, &attr, &color, NULL);
    printf ("wchar read U+%04x\n", wstr[0]);
  }
#endif

  return 0;
}


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Setting background to non-ASCII characters can affect addwstr

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 07, 2009 at 11:14:09PM -0700, Mike Gran wrote:
> Hi-
>
> It seems that if I set the background character using bkgrnd to a
> non-ASCII character, it can cause calls to addwstr to not print all of
> the characters in the string.
>
> In the sample code below, I display "This is a string", then I set the
> background to a dot (U+02D9), then I try to display "This is another
> string".  Of the second line, it only prints "This".

That seems to be working, for me (5.7.20091003), since I see the whole
string.  Attaching a trace

--
Thomas E. Dickey <dickey@...>
http://invisible-island.net
ftp://invisible-island.net



_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

trace.gz (5K) Download Attachment
signature.asc (204 bytes) Download Attachment

Re: Setting background to non-ASCII characters can affect addwstr

by Mike Gran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-10-08 at 05:02 -0400, Thomas Dickey wrote:
> On Wed, Oct 07, 2009 at 11:14:09PM -0700, Mike Gran wrote:
> > It seems that if I set the background character using bkgrnd to a
> > non-ASCII character, it can cause calls to addwstr to not print all of
> > the characters in the string.

> That seems to be working, for me (5.7.20091003), since I see the whole
> string.  Attaching a trace
>

Indeed.  It appears that on this Fedora box, there was a 5.6.20080927
version of libncursesw hiding in the /lib directory, and it was linking
to that instead of the intended recent /usr/lib version.  A modern
version of curses solves my problem.

Sorry for the noise.

-Mike




_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Setting background to non-ASCII characters can affect addwstr

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 8 Oct 2009, Mike Gran wrote:

> On Thu, 2009-10-08 at 05:02 -0400, Thomas Dickey wrote:
>> On Wed, Oct 07, 2009 at 11:14:09PM -0700, Mike Gran wrote:
>>> It seems that if I set the background character using bkgrnd to a
>>> non-ASCII character, it can cause calls to addwstr to not print all of
>>> the characters in the string.
>
>> That seems to be working, for me (5.7.20091003), since I see the whole
>> string.  Attaching a trace
>>
>
> Indeed.  It appears that on this Fedora box, there was a 5.6.20080927
> version of libncursesw hiding in the /lib directory, and it was linking
> to that instead of the intended recent /usr/lib version.  A modern
> version of curses solves my problem.

no problem (report bugs - I didn't overlook the other...)

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses