I'm using gnome-terminal 2.7.3, and libncurses 5.4. These came with
CentOS 4.4
I looked for related bugs in both projects without success. Any help
would be appreciated.
Thanks!
Harold
------------- snip ------------------
#include <ncurses.h>
#include <stdlib.h>
int main (void) {
initscr (); // initialize curses
for (;;) {
int top, left;
top = rand() % 24;
left = rand() % 70; // pick a random location on the
screen
mvprintw (top, left, "%d", (top + left) % 10); // display
LS digit of (top+left)
refresh (); // update display
}
}
just running it, I don't see any problems (with gnome-terminal 2.24.3
and ncurses 5.7). On the other hand, I don't recall any relevant bug
in ncurses, and gnome-terminal has at least one visible bug in every
release. (If you cannot reproduce the problem with xterm, it's just
another gnome-terminal bug).
If the dimensions of the window are 24 x 70 then eventually all
positions will be filled but not with a fixed digit since the
expression (top + left) % 10 is not fixed but changes
(pseudo)randomly.
> > mvprintw (top, left, "%d", (top + left) % 10); // display
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> If the dimensions of the window are 24 x 70 then eventually all
> positions will be filled but not with a fixed digit since the
> expression (top + left) % 10 is not fixed but changes
> (pseudo)randomly.
no - the digit printed at a given location is constant, because it is
always
a (nonrandom) function of the location's coordinates.
If the screensize were smaller than 24x70, the result would be
(reasonably) unpredictable. OP did not mention this; we're assuming
it is at least 24x70.
I took the phrase "a single fixed digit at each location of stdscr"
in the opening post to mean the same digit in every position but
perhaps your interpretation is what the opening poster meant.
> If the screensize were smaller than 24x70, the result would be
> (reasonably) unpredictable. OP did not mention this; we're assuming
> it is at least 24x70.
I wasn't assuming anything. If the dimensions of the screen are
smaller than 24x70 that might explain why he's not getting what he
expects. Are the curses cursor positioning functions meant to do
anything predictable when they receive position arguments beyond the
screen boundaries or does the final outcome depend on how the
terminal (emulator) reacts when receiving illegal coordinates ?
--
Who's your mama ?