The Accidental Rubyist

invalid byte sequence in UTF-8

Stumped by some strange behavior in ncurses

leave a comment »

I have a fully functional widget textarea. This writes directly onto the window. For reasons I won’t get into here, I’ve created a new version that writes to a pad which is then copied onto the window. I call this the buffered version.
I then go to a test program that has a lot of widgets in it (test2.rb) and replace the old textarea withe new one. There is a list box on the right of the textarea. Whenever the list box is painted, it *now* wipes out part of the buffered textarea. It does not overwrite the old textarea.

So when the form loads, i see the textarea flash for second, and then listbox wipes it out. When i tab into the textarea it paints itself. When i tab out of textarea into the listbox, the listbox wipes it out again.

Since the listbox does not wipe out the old textarea, I have to assume that the listbox is fine. Its been functioning fine until now. The list box seems to wipe out the textarea rows that are on the same rows. If i remove the listbox from the program, the textarea displays fine. So is the listbox doing some hanky-panky, or is there some bug or unexpected behaviour (gotcha) hidden deep in the bowels of ncurses relating to pads, the internals of copy_win and the states ncurses maintains.

The sequence seems to be like this:

1. listbox on the right of a textarea (or widget that writes to a pad first)
2. listbox’s repaint method is invoked
3. Only part of the textarea is wiped out (the same rows as those listbox writes to).

Maybe I should put some other widget there and see. That might exonerate listbox.

Okay, listbox is innocent. Even a simple textbox has the same effect of wiping the line off.
Man, I am stumped !

Edit: See next post. Issue solved.

XML is like violence – if it doesn’t solve your problems, you are not using enough of it.
— sig of Aaron Peterson (nokogiri)


Written by totalrecall

January 3, 2010 at 2:56 pm

Posted in ncurses

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: