[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Test prog for winsstr()
From: |
Philippe Blain |
Subject: |
Test prog for winsstr() |
Date: |
Mon, 11 Nov 2002 07:36:57 +0100 |
----- Original Message -----
From: "Thomas Dickey" <address@hidden>
To: "Philippe Blain" <address@hidden>
Cc: "bug-ncurses" <address@hidden>
Sent: Sunday, November 10, 2002 3:06 AM
Subject: Re: Minor corrections for 20021102
> On Tue, Nov 05, 2002 at 07:55:03AM +0100, Philippe Blain wrote:
> > >From Philippe Blain, Bordeaux, FRANCE.
>
> --------------------------------------------------------------------------
--
> > File : ncurses/base/lib_insch.c
> > Function : _nc_insert_ch()
> >
> > When an inserted string goes beyond the right edge of window, last
inserted
> > chars overwrites each other at win->_maxx, resulting in the last char of
> > the string visible at that position.
> > Minor modif possible, question of choice, as :
>
> I didn't get far on this (spent most of my time on a terminfo change).
> But I'm puzzled that my test program doesn't show the behavior that you
> describe. (It's still on my list though, since I don't believe I checked
> the boundary properly).
>
> --
> Thomas E. Dickey <address@hidden>
That very simple program demonstrates the visual bug :
------------------------------------------------------------------
/* Simple prog for testing the winsstr() function. */
#include <curses.h>
int main (int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
int ch;
int rows, cols;
WINDOW *win;
putenv ("TABSIZE=8");
initscr ();
cbreak (); /* take input chars one at a time, no wait for \n */
noecho (); /* don't echo input */
keypad (stdscr, TRUE);
if (has_colors ()) {
start_color ();
init_pair (1, COLOR_WHITE, COLOR_BLUE);
init_pair (2, COLOR_RED, COLOR_WHITE);
}
rows = 10;
cols = 25;
win = newwin (rows, cols, (LINES - rows) / 2, (COLS - cols) / 2);
keypad (win, TRUE);
wbkgdset (win, COLOR_PAIR (1) | ' ');
werase (win);
mvwprintw (win, 1, 1, "Test strings insertion");
box (win, 0, 0);
wattrset (win, COLOR_PAIR (2));
wmove (win, 5, 1);
ch = wgetch (win);
winsstr (win, "This is a very long inserted string");
wnoutrefresh (win);
doupdate ();
ch = wgetch (win);
winsstr (win, "with newline\n");
wnoutrefresh (win);
doupdate ();
ch = wgetch (win);
winsstr (win, "testing back\bspace");
wnoutrefresh (win);
doupdate ();
ch = wgetch (win);
winsstr (win, "carriage \rreturn");
wnoutrefresh (win);
doupdate ();
ch = wgetch (win);
winsstr (win, "with tab<\t>ulation");
wnoutrefresh (win);
doupdate ();
endwin ();
}