Re: [PATCH] Internal editor brokeness with ncurses (fwd)

Hello Leonard,

Here is a simple prog to demonstrate the problem - it shows
two things:

1) If you print more than COLS characters via addch - those
characters appear on the next line.

2) move with negative argument (as used in the old code)
fails with -1 on ncurses.

It takes two arguments - how many columns (charcters to print) and
the char to use to fill the columns i.e.:

./addch 90 a

should print the character 'a' 90 times - going to the next line
on 80 columns display.

gcc -o addch addch.c -lncurses
#include <stdio.h>
#include <unistd.h>
#include <ncurses.h>

int main (int argc, char **argv)
	int i, cols;
	int move_ret;

	if (argc < 3)
		printf ("%s <cols> <fillchar>\n", argv[0]);
		exit (1);

	cols = atoi (argv[1]);
	initscr ();
	move_ret =  move (0, -1);
	move (0,0);
	for (i = 0; i < cols; i++)
		addch (*argv[2]);
	refresh ();
	sleep (10);
	endwin ();

	printf ("move(0, -1) = %d", move_ret);

	exit (0);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]