rbcurse Textarea overwrite issue in some samples
I think it’s like this.. (reference test2.rb sample program)
rbcurse’s Textarea uses a pad, which does a
prefresh onto screen.
All the other widgets (unbuffered) write to a window which does a
wrefresh. This refresh overwrites the write that
Acco to the manpage, certain optimizations are done with what is
already there on the screen. My guess is that a window wrefresh does not
disturb what is on the right, but it does overwrite what’s on the left.
Now, scrollpane and splitpane use a
buffer_to_screen passing their own
graphic object, so the main window is written onto. I need to confirm
this by placing something on the right. Here, since textarea was not a
child or embedded object, a
pad.refresh was done.
I think i need to ensure that a
copy_pad_to_win is done in these cases,
by passing a graphic object. At least the source of this bug is now
clear to me now.
SOLVED YEAH !!!
The so-called “buffered” objects write onto their own pad which is blit onto the screen. The “unbuffered” objects write to a window which is then blit using wrefresh. So after the buffered object has written, if the window is refreshed it overwrites what the pad had written. Now here’s the interesting part — if the unbuffered widgets are on the left of the buffered one, the window wrefresh does an optimization and does not write onto the space on the right. So the textarea is untouched. However, if _anything_ lies to the right, the window.wrefresh optimizes and clears out the space on the left, of course not touching any other widgets that it has painted. It does not know that something else had been written.
So now, I simply do a copywin() for the buffered objects onto the forms.window. So now the textarea is part of the normal form. I’ve checked the other cases when the textarea is embedded in a scrollpane, those work fine as before since it goes through the route of a “parent_buffer”.
If you are one of those sorry b***ards who has to work with
python you’ll know what I mean.