]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.6 - patch 20070630
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 1 Jul 2007 00:42:27 +0000 (00:42 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 1 Jul 2007 00:42:27 +0000 (00:42 +0000)
+ add "widec" row to _tracedump() output to help diagnose remaining
  problems with multi-column characters.
+ partial fix for refresh of window on top of multi-column characters
  which are partly overwritten (report by Sadrul H Chowdhury).
+ ignore A_CHARTEXT bits in vidattr() and vid_attr(), in case
  multi-column extension bits are passed there.
+ add setlocale() call to demo_panels.c, needed for wide-characters.
+ add some output flags to _nc_trace_ttymode to help diagnose a bug
  report by Larry Virden, i.e., ONLCR, OCRNL, ONOCR and ONLRET,

21 files changed:
MANIFEST
NEWS
dist.mk
ncurses/base/lib_refresh.c
ncurses/base/lib_window.c
ncurses/trace/lib_tracebits.c
ncurses/trace/lib_tracedmp.c
ncurses/tty/hardscroll.c
ncurses/tty/lib_vidattr.c
ncurses/tty/tty_update.c
ncurses/widechar/lib_vid_attr.c
test/chgat.c
test/demo_panels.c
test/echochar.c
test/inch_wide.c
test/inchs.c
test/redraw.c
test/test.priv.h
test/test_getstr.c [new file with mode: 0644]
test/test_instr.c [new file with mode: 0644]
test/view.c

index 3e3ec427a20833cfcb294dfa648020702d381fed..917600ff04175cbe9a64f434fb6a6018cbda4d36 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
 ./test/savescreen.c
 ./test/tclock.c
 ./test/test.priv.h
+./test/test_getstr.c
+./test/test_instr.c
 ./test/testaddch.c
 ./test/testcurs.c
 ./test/testscanw.c
diff --git a/NEWS b/NEWS
index 6f5977409a14b188b818c5cb6c960854a55b3271..4c925c764881234e1680b1bd96182682093f1342 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1138 2007/06/23 21:28:00 tom Exp $
+-- $Id: NEWS,v 1.1140 2007/06/30 23:37:37 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,17 @@ See the AUTHORS file for the corresponding full names.
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20070630
+       + add "widec" row to _tracedump() output to help diagnose remaining
+         problems with multi-column characters.
+       + partial fix for refresh of window on top of multi-column characters
+         which are partly overwritten (report by Sadrul H Chowdhury).
+       + ignore A_CHARTEXT bits in vidattr() and vid_attr(), in case
+         multi-column extension bits are passed there.
+       + add setlocale() call to demo_panels.c, needed for wide-characters.
+       + add some output flags to _nc_trace_ttymode to help diagnose a bug
+         report by Larry Virden, i.e., ONLCR, OCRNL, ONOCR and ONLRET,
+
 20070623
        + add test/demo_panels.c
        + implement opaque version of setsyx() and getsyx().
diff --git a/dist.mk b/dist.mk
index 7723701923ba55e7fcf20f362252683a07280c7f..39d65ea27d21f2eddbf14a1d76a98b07dbad8d9a 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.598 2007/06/23 15:16:37 tom Exp $
+# $Id: dist.mk,v 1.599 2007/06/30 16:01:18 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 6
-NCURSES_PATCH = 20070623
+NCURSES_PATCH = 20070630
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 27649df0669a5e4b41f3d5951a0d88393a8745fd..a16dc8e64eb611d385ac3616410ade729ee70a7e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -41,7 +41,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_refresh.c,v 1.34 2006/05/27 19:21:19 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.37 2007/06/30 23:35:43 tom Exp $")
 
 NCURSES_EXPORT(int)
 wrefresh(WINDOW *win)
@@ -74,10 +74,10 @@ NCURSES_EXPORT(int)
 wnoutrefresh(WINDOW *win)
 {
     NCURSES_SIZE_T limit_x;
-    NCURSES_SIZE_T i, j;
+    NCURSES_SIZE_T src_row, src_col;
     NCURSES_SIZE_T begx;
     NCURSES_SIZE_T begy;
-    NCURSES_SIZE_T m, n;
+    NCURSES_SIZE_T dst_row, dst_col;
 #if USE_SCROLL_HINTS
     bool wide;
 #endif
@@ -132,17 +132,17 @@ wnoutrefresh(WINDOW *win)
      * so we'll force the issue.
      */
 
-    /* limit(n) */
+    /* limit(dst_col) */
     limit_x = win->_maxx;
-    /* limit(j) */
+    /* limit(src_col) */
     if (limit_x > newscr->_maxx - begx)
        limit_x = newscr->_maxx - begx;
 
-    for (i = 0, m = begy + win->_yoffset;
-        i <= win->_maxy && m <= newscr->_maxy;
-        i++, m++) {
-       register struct ldat *nline = &newscr->_line[m];
-       register struct ldat *oline = &win->_line[i];
+    for (src_row = 0, dst_row = begy + win->_yoffset;
+        src_row <= win->_maxy && dst_row <= newscr->_maxy;
+        src_row++, dst_row++) {
+       register struct ldat *nline = &newscr->_line[dst_row];
+       register struct ldat *oline = &win->_line[src_row];
 
        if (oline->firstchar != _NOCHANGE) {
            int last = oline->lastchar;
@@ -150,10 +150,70 @@ wnoutrefresh(WINDOW *win)
            if (last > limit_x)
                last = limit_x;
 
-           for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) {
-               if (!CharEq(oline->text[j], nline->text[n])) {
-                   nline->text[n] = oline->text[j];
-                   CHANGED_CELL(nline, n);
+           src_col = oline->firstchar;
+           dst_col = src_col + begx;
+
+           if_WIDEC({
+               static cchar_t blank = BLANK;
+               int last_col = begx + ((last < win->_maxx)
+                                      ? last
+                                      : win->_maxx);
+               int fix_left = dst_col;
+               int fix_right = last_col;
+               register int j;
+
+               /*
+                * Check for boundary cases where we may overwrite part of a
+                * multi-column character.  For those, wipe the remainder of
+                * the character to blanks.
+                */
+               j = dst_col;
+               if (isWidecExt(nline->text[j])) {
+                   /*
+                    * On the left, we only care about multi-column characters
+                    * that extend into the changed region.
+                    */
+                   fix_left = 1 + j - WidecExt(nline->text[j]);
+                   if (fix_left < 0)
+                       fix_left = 0;   /* only if cell is corrupt */
+               }
+
+               j = last_col;
+               if (WidecExt(nline->text[j]) != 0) {
+                   /*
+                    * On the right, any multi-column character is a problem,
+                    * unless it happens to be contained in the change, and
+                    * ending at the right boundary of the change.  The
+                    * computation for 'fix_left' accounts for the left-side of
+                    * this character.  Find the end of the character.
+                    */
+                   fix_right = ++j;
+                   while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+                       fix_right = j++;
+                   }
+               }
+
+               /*
+                * The analysis is simpler if we do the clearing afterwards.
+                * Do that now.
+                */
+               for (j = fix_left; j < dst_col; ++j) {
+                   nline->text[j] = blank;
+                   CHANGED_CELL(nline, j);
+               }
+               for (j = last_col + 1; j <= fix_right; ++j) {
+                   nline->text[j] = blank;
+                   CHANGED_CELL(nline, j);
+               }
+           });
+
+           /*
+            * Copy the changed text.
+            */
+           for (; src_col <= last; src_col++, dst_col++) {
+               if (!CharEq(oline->text[src_col], nline->text[dst_col])) {
+                   nline->text[dst_col] = oline->text[src_col];
+                   CHANGED_CELL(nline, dst_col);
                }
            }
 
@@ -162,13 +222,14 @@ wnoutrefresh(WINDOW *win)
        if (wide) {
            int oind = oline->oldindex;
 
-           nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind
-               + win->_yoffset;
+           nline->oldindex = ((oind == _NEWINDEX)
+                              ? _NEWINDEX
+                              : (begy + oind + win->_yoffset));
        }
 #endif /* USE_SCROLL_HINTS */
 
        oline->firstchar = oline->lastchar = _NOCHANGE;
-       if_USE_SCROLL_HINTS(oline->oldindex = i);
+       if_USE_SCROLL_HINTS(oline->oldindex = src_row);
     }
 
     if (win->_clear) {
index bb20f4faf2a2eb2bad27b7f68409f1520bb8b8f9..530b08e5ed1f67408374672291002a065f9fa011 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_window.c,v 1.22 2006/05/27 19:21:19 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.23 2007/06/30 23:36:11 tom Exp $")
 
 NCURSES_EXPORT(void)
 _nc_synchook(WINDOW *win)
@@ -149,7 +149,7 @@ wsyncdown(WINDOW *win)
                /* left and right character in child coordinates */
                int left = pp->_line[win->_pary + y].firstchar - win->_parx;
                int right = pp->_line[win->_pary + y].lastchar - win->_parx;
-               /* The change maybe outside the childs range */
+               /* The change may be outside the child's range */
                if (left < 0)
                    left = 0;
                if (right > win->_maxx)
index d9defd0cc9d66d3502cd0b4b0a310af97776562e..de2394c39225353c2f43fb91c7fb43a65922eb2e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -35,7 +35,7 @@
 #include <curses.priv.h>
 #include <term.h>              /* cur_term */
 
-MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.15 2007/06/30 16:14:20 tom Exp $")
 
 #if SVR4_TERMIO && !defined(_POSIX_SOURCE)
 #define _POSIX_SOURCE
@@ -53,10 +53,27 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $")
 #ifndef TOSTOP
 #define TOSTOP 0
 #endif
+
 #ifndef IEXTEN
 #define IEXTEN 0
 #endif
 
+#ifndef ONLCR
+#define ONLCR 0
+#endif
+
+#ifndef OCRNL
+#define OCRNL 0
+#endif
+
+#ifndef ONOCR
+#define ONOCR 0
+#endif
+
+#ifndef ONLRET
+#define ONLRET 0
+#endif
+
 #ifdef TRACE
 
 typedef struct {
@@ -108,8 +125,12 @@ _nc_trace_ttymode(TTY * tty)
     {
        {OPOST, "OPOST"},
        {OFLAGS_TABS, "XTABS"},
+       {ONLCR, "ONLCR"},
+       {OCRNL, "OCRNL"},
+       {ONOCR, "ONOCR"},
+       {ONLRET, "ONLRET"},
        {0, NULL}
-#define ALLOUT (OPOST)
+#define ALLOUT (OPOST|OFLAGS_TABS|ONLCR|OCRNL|ONOCR|ONLRET)
     }, cflags[] =
     {
        {CLOCAL, "CLOCAL"},
index 536231364085c96b601da173df2432bf0198123b..d56d1a5d48b09ec621a3d27442a049bc1bc4e6f8 100644 (file)
@@ -39,7 +39,7 @@
 #include <curses.priv.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_tracedmp.c,v 1.28 2007/04/21 21:10:54 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.29 2007/06/30 23:01:19 tom Exp $")
 
 #ifdef TRACE
 
@@ -100,6 +100,30 @@ _tracedump(const char *name, WINDOW *win)
                (long) win->_line[n].lastchar,
                ep);
 
+       /* if there are multi-column characters on the line, print them now */
+       if_WIDEC({
+           bool multicolumn = FALSE;
+           for (j = 0; j < width; ++j)
+               if (WidecExt(win->_line[n].text[j]) != 0) {
+                   multicolumn = TRUE;
+                   break;
+               }
+           if (multicolumn) {
+               ep = my_buffer;
+               for (j = 0; j < width; ++j) {
+                   int test = WidecExt(win->_line[n].text[j]);
+                   if (test) {
+                       ep[j] = test + '0';
+                   } else {
+                       ep[j] = ' ';
+                   }
+               }
+               ep[j] = '\0';
+               _tracef("%*s[%2d]%*s='%s'", (int) strlen(name),
+                       "widec", n, 8, " ", my_buffer);
+           }
+       });
+
        /* dump A_COLOR part, will screw up if there are more than 96 */
        havecolors = FALSE;
        for (j = 0; j < width; ++j)
index e2147217bdb32236775289fa5e80de138bd97cbd..0b227a109dcfba7b9a9c0ecef472b8bc53c4c5b1 100644 (file)
@@ -145,7 +145,7 @@ AUTHOR
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: hardscroll.c,v 1.39 2007/04/28 20:14:08 tom Exp $")
+MODULE_ID("$Id: hardscroll.c,v 1.40 2007/06/30 21:11:01 tom Exp $")
 
 #if defined(SCROLLDEBUG) || defined(HASHDEBUG)
 
@@ -186,7 +186,7 @@ _nc_scroll_optimize(void)
     int i;
     int start, end, shift;
 
-    TR(TRACE_ICALLS, ("_nc_scroll_optimize() begins"));
+    TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize")));
 
 #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG)
 #if USE_HASHMAP
@@ -256,6 +256,7 @@ _nc_scroll_optimize(void)
        }
 #endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */
     }
+    TR(TRACE_ICALLS, (T_RETURN("")));
 }
 
 #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG)
index 4bee100abe191e1d1645ab45bf6dd26686e72877..ac2a74f08e015924d7010775770972df27947935 100644 (file)
@@ -65,7 +65,7 @@
 #include <curses.priv.h>
 #include <term.h>
 
-MODULE_ID("$Id: lib_vidattr.c,v 1.48 2007/04/21 23:25:38 tom Exp $")
+MODULE_ID("$Id: lib_vidattr.c,v 1.49 2007/06/30 21:58:04 tom Exp $")
 
 #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
 
@@ -102,6 +102,7 @@ vidputs(chtype newmode, int (*outc) (int))
 #define fix_pair0 FALSE
 #endif
 
+    newmode &= A_ATTRIBUTES;
     T((T_CALLED("vidputs(%s)"), _traceattr(newmode)));
 
     /* this allows us to go on whether or not newterm() has been called */
index 57222f15f5ff31bbe98af66e3968aed6b560a18a..15510ce406a7d4e738eb7107b50f664ab7afb0e4 100644 (file)
@@ -74,7 +74,7 @@
 #include <ctype.h>
 #include <term.h>
 
-MODULE_ID("$Id: tty_update.c,v 1.239 2007/04/19 20:57:49 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.240 2007/06/30 21:07:51 tom Exp $")
 
 /*
  * This define controls the line-breakout optimization.  Every once in a
@@ -836,7 +836,6 @@ doupdate(void)
 
     nonempty = 0;
     if (curscr->_clear || newscr->_clear) {    /* force refresh ? */
-       TR(TRACE_UPDATE, ("clearing and updating from scratch"));
        ClrUpdate();
        curscr->_clear = FALSE; /* reset flag */
        newscr->_clear = FALSE; /* reset flag */
@@ -967,7 +966,7 @@ ClrUpdate(void)
     NCURSES_CH_T blank = ClrBlank(stdscr);
     int nonempty = min(screen_lines, newscr->_maxy + 1);
 
-    TR(TRACE_UPDATE, ("ClrUpdate() called"));
+    TR(TRACE_UPDATE, (T_CALLED("ClrUpdate")));
 
     ClearScreen(blank);
 
@@ -977,6 +976,8 @@ ClrUpdate(void)
 
     for (i = 0; i < nonempty; i++)
        TransformLine(i);
+
+    TR(TRACE_UPDATE, (T_RETURN("")));
 }
 
 /*
index 2ba16b5cf9240a57f87147215e756df8534dd2ec..1dc679e6d9078fd191b998f8eec47a4815276f1e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 2002-2006,2007 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -33,7 +33,7 @@
 #include <curses.priv.h>
 #include <term.h>
 
-MODULE_ID("$Id: lib_vid_attr.c,v 1.4 2006/11/26 00:26:00 tom Exp $")
+MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $")
 
 #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc)
 
@@ -72,6 +72,7 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int))
 #define fix_pair0 FALSE
 #endif
 
+    newmode &= A_ATTRIBUTES;
     T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair));
 
     /* this allows us to go on whether or not newterm() has been called */
index 06a27d738c85adf952a392bd90ca4e07d8696f3b..ef9ab6762362dd6e602014565e1bddd277d1772b 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: chgat.c,v 1.6 2007/01/06 23:28:46 tom Exp $
+ * $Id: chgat.c,v 1.7 2007/06/30 17:52:17 tom Exp $
  *
  * test-driver for chgat/wchgat/mvchgat/mvwchgat
  */
@@ -47,7 +47,8 @@
 typedef struct {
     unsigned c;
     unsigned v;
-    int pair, attr;
+    int pair;
+    unsigned attr;
     int count;
     int ch;
     const char *c_msg;
@@ -94,11 +95,11 @@ color_params(unsigned state, int *pair)
 }
 
 static const char *
-video_params(unsigned state, int *attr)
+video_params(unsigned state, unsigned *attr)
 {
     /* *INDENT-OFF* */
     static struct {
-       int attr;
+       unsigned attr;
        const char *msg;
     } table[] = {
        { A_NORMAL,     "normal" },
index 0ac704073f2171f638f90c48c1161e9cdb8484b3..8d5bac2bb6f1797bf19a1240a6a60609f2ef37e5 100755 (executable)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_panels.c,v 1.16 2007/06/23 21:24:23 tom Exp $
+ * $Id: demo_panels.c,v 1.22 2007/06/30 21:38:08 tom Exp $
  *
  * Demonstrate a variety of functions from the panel library.
  */
@@ -40,7 +40,8 @@
 typedef void (*InitPanel) (void);
 typedef void (*FillPanel) (PANEL *);
 
-static bool use_colors;
+static bool use_colors = FALSE;
+static bool unboxed = FALSE;
 static FILE *log_in;
 static FILE *log_out;
 
@@ -197,7 +198,7 @@ mkpanel(short color, int rows, int cols, int tly, int tlx)
 
            init_pair(color, fg, bg);
            wbkgdset(win, (chtype) (COLOR_PAIR(color) | ' '));
-       } else {
+       } else if (!unboxed) {
            wbkgdset(win, A_BOLD | ' ');
        }
     }
@@ -207,7 +208,7 @@ mkpanel(short color, int rows, int cols, int tly, int tlx)
 }
 
 static void
-remove_panel(PANEL ** pans, int which)
+my_remove_panel(PANEL ** pans, int which)
 {
     if (pans[which] != 0) {
        PANEL *pan = pans[which];
@@ -226,7 +227,7 @@ remove_panel(PANEL ** pans, int which)
 #define ABS(a)   ((a) < 0 ? -(a) : (a))
 
 static void
-create_panel(PANEL ** pans, int which, FillPanel myFill)
+my_create_panel(PANEL ** pans, int which, FillPanel myFill)
 {
     PANEL *pan = 0;
     int code;
@@ -238,7 +239,7 @@ create_panel(PANEL ** pans, int which, FillPanel myFill)
     init_pair(pair, fg, bg);
 
     /* remove the old panel, if any */
-    remove_panel(pans, which);
+    my_remove_panel(pans, which);
 
     /* get the position of one corner */
     wmove(stdscr, getmaxy(stdscr) / 2, getmaxx(stdscr) / 2);
@@ -272,53 +273,58 @@ create_panel(PANEL ** pans, int which, FillPanel myFill)
 static void
 my_move_panel(PANEL ** pans, int which)
 {
-    int code;
-    int y0, x0;
-    int y1, x1;
-    WINDOW *win = panel_window(pans[which]);
-    char also[80];
+    if (pans[which] != 0) {
+       int code;
+       int y0, x0;
+       int y1, x1;
+       WINDOW *win = panel_window(pans[which]);
+       char also[80];
 
-    getbegyx(win, y0, x0);
-    sprintf(also, " (start %d,%d)", y0, x0);
-    wmove(stdscr, y0, x0);
-    while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) {
-       ;
-    }
-    if (code > 0) {
-       move_panel(pans[which], y1, x1);
+       getbegyx(win, y0, x0);
+       sprintf(also, " (start %d,%d)", y0, x0);
+       wmove(stdscr, y0, x0);
+       while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) {
+           ;
+       }
+       if (code > 0) {
+           move_panel(pans[which], y1, x1);
+       }
     }
 }
 
 static void
-resize_panel(PANEL ** pans, int which, FillPanel myFill)
+my_resize_panel(PANEL ** pans, int which, FillPanel myFill)
 {
-    int code;
-    int y0, x0;
-    int y1, x1;
-    WINDOW *win = panel_window(pans[which]);
-    char also[80];
+    if (pans[which] != 0) {
+       int code;
+       int y0, x0;
+       int y1, x1;
+       WINDOW *win = panel_window(pans[which]);
+       char also[80];
 
-    getbegyx(win, y0, x0);
-    sprintf(also, " (start %d,%d)", y0, x0);
-    wmove(stdscr, y0, x0);
-    while ((code = get_position("Resize panel", also, which, &x1, &y1)) == 0) {
-       ;
-    }
-    if (code > 0) {
-       WINDOW *next = newwin(ABS(y1 - y0) + 1,
-                             ABS(x1 - x0) + 1,
-                             MIN(y0, y1),
-                             MIN(x0, x1));
-       if (next != 0) {
-           keypad(next, TRUE);
-           if (use_colors) {
-               wbkgdset(next, (chtype) (COLOR_PAIR(which) | ' '));
-           } else {
-               wbkgdset(next, A_BOLD | ' ');
+       getbegyx(win, y0, x0);
+       sprintf(also, " (start %d,%d)", y0, x0);
+       wmove(stdscr, y0, x0);
+       while ((code = get_position("Resize panel",
+                                   also, which, &x1, &y1)) == 0) {
+           ;
+       }
+       if (code > 0) {
+           WINDOW *next = newwin(ABS(y1 - y0) + 1,
+                                 ABS(x1 - x0) + 1,
+                                 MIN(y0, y1),
+                                 MIN(x0, x1));
+           if (next != 0) {
+               keypad(next, TRUE);
+               if (use_colors) {
+                   wbkgdset(next, (chtype) (COLOR_PAIR(which) | ' '));
+               } else if (!unboxed) {
+                   wbkgdset(next, A_BOLD | ' ');
+               }
+               replace_panel(pans[which], next);
+               myFill(pans[which]);
+               delwin(win);
            }
-           replace_panel(pans[which], next);
-           myFill(pans[which]);
-           delwin(win);
        }
     }
 }
@@ -353,6 +359,21 @@ fill_panel(PANEL * pan)
     }
 }
 
+static void
+fill_unboxed(PANEL * pan)
+{
+    WINDOW *win = panel_window(pan);
+    int num = ((const char *) panel_userptr(pan))[1];
+    int y, x;
+
+    for (y = 0; y < getmaxy(win); y++) {
+       for (x = 0; x < getmaxx(win); x++) {
+           wmove(win, y, x);
+           waddch(win, UChar(num));
+       }
+    }
+}
+
 #if USE_WIDEC_SUPPORT
 static void
 make_fullwidth_digit(cchar_t *target, int digit)
@@ -491,6 +512,22 @@ show_panels(PANEL * px[MAX_PANELS + 1])
     }
 }
 
+#define wrapper(func) \
+static int my_##func(PANEL *pan) \
+{ \
+    int code = ERR; \
+    if (pan != 0) { \
+       code = func(pan); \
+    } \
+    return code; \
+}
+/* *INDENT-OFF* */
+wrapper(bottom_panel)
+wrapper(hide_panel)
+wrapper(show_panel)
+wrapper(top_panel)
+/* *INDENT-ON* */
+
 static void
 do_panel(PANEL * px[MAX_PANELS + 1],
         NCURSES_CONST char *cmd,
@@ -506,28 +543,28 @@ do_panel(PANEL * px[MAX_PANELS + 1],
     saywhat(cmd);
     switch (*cmd) {
     case 'b':
-       bottom_panel(px[which]);
+       my_bottom_panel(px[which]);
        break;
     case 'c':
-       create_panel(px, which, myFill);
+       my_create_panel(px, which, myFill);
        break;
     case 'd':
-       remove_panel(px, which);
+       my_remove_panel(px, which);
        break;
     case 'h':
-       hide_panel(px[which]);
+       my_hide_panel(px[which]);
        break;
     case 'm':
        my_move_panel(px, which);
        break;
     case 'r':
-       resize_panel(px, which, myFill);
+       my_resize_panel(px, which, myFill);
        break;
     case 's':
-       show_panel(px[which]);
+       my_show_panel(px[which]);
        break;
     case 't':
-       top_panel(px[which]);
+       my_top_panel(px[which]);
        break;
     }
 }
@@ -579,6 +616,8 @@ get_command(PANEL * px[MAX_PANELS + 1], char *buffer, int limit)
            if (ch == ERR || ch == QUIT || ch == ESCAPE) {
                buffer[0] = '\0';
                break;
+           } else if (ch == CTRL('L')) {
+               wrefresh(curscr);
            } else if (ch == '\n' || ch == KEY_ENTER) {
                break;
            } else if (ch == '?') {
@@ -651,7 +690,7 @@ demo_panels(InitPanel myInit, FillPanel myFill)
     }
 #if NO_LEAKS
     for (itmp = 1; itmp <= MAX_PANELS; ++itmp) {
-       remove_panel(px, itmp);
+       my_remove_panel(px, itmp);
     }
 #endif
 }
@@ -670,6 +709,7 @@ usage(void)
 #if USE_WIDEC_SUPPORT
        ,"  -w       use wide-characters in panels and background"
 #endif
+       ,"  -x       do not enclose panels in boxes"
     };
     size_t n;
     for (n = 0; n < SIZEOF(tbl); n++)
@@ -685,7 +725,9 @@ main(int argc, char *argv[])
     InitPanel myInit = init_panel;
     FillPanel myFill = fill_panel;
 
-    while ((c = getopt(argc, argv, "i:o:mw")) != EOF) {
+    setlocale(LC_ALL, "");
+
+    while ((c = getopt(argc, argv, "i:o:mwx")) != EOF) {
        switch (c) {
        case 'i':
            log_in = fopen(optarg, "r");
@@ -702,10 +744,15 @@ main(int argc, char *argv[])
            myFill = fill_wide_panel;
            break;
 #endif
+       case 'x':
+           unboxed = TRUE;
+           break;
        default:
            usage();
        }
     }
+    if (unboxed)
+       myFill = fill_unboxed;
 
     initscr();
     cbreak();
index 9f2d11c5bb9476796ac87a67c2f43ba0e0cbd535..e3011388cb68b32d19244e26b74fe701a9c8eb95 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2006,2007 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: echochar.c,v 1.3 2006/12/03 00:14:29 tom Exp $
+ * $Id: echochar.c,v 1.4 2007/06/30 17:54:56 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -107,7 +107,7 @@ main(
     if (use_colors) {
        start_color();
        if (COLOR_PAIRS > 0) {
-           my_pairs = calloc(COLOR_PAIRS, sizeof(*my_pairs));
+           my_pairs = calloc((unsigned) COLOR_PAIRS, sizeof(*my_pairs));
        }
        use_colors = (my_pairs != 0);
     }
@@ -146,10 +146,10 @@ main(
            }
        }
        if (opt_r) {
-           addch(p);
+           addch(UChar(p));
            refresh();
        } else {
-           echochar(p);
+           echochar(UChar(p));
        }
        ++total_chars;
     }
index 069e8738eeca4703c73330be935173f07ea67fe5..01826c455048514259b5574d2a74254f8c232ea0 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: inch_wide.c,v 1.4 2007/06/09 21:25:54 tom Exp $
+ * $Id: inch_wide.c,v 1.5 2007/06/30 17:50:44 tom Exp $
  */
 /*
        int in_wch(cchar_t *wcval);
@@ -99,7 +99,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
 
     if ((fp = fopen(argv[level], "r")) != 0) {
        while ((j = fgetc(fp)) != EOF) {
-           if (waddch(txtwin, j) != OK) {
+           if (waddch(txtwin, UChar(j)) != OK) {
                break;
            }
        }
index 38747a2f39bd2c70162b0b16831a420b99374f3a..93cd4c225ae386917f007bb65dbf16bacd51e39e 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: inchs.c,v 1.6 2007/06/09 21:25:06 tom Exp $
+ * $Id: inchs.c,v 1.7 2007/06/30 17:50:44 tom Exp $
  */
 /*
        chtype inch(void);
@@ -96,7 +96,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
 
     if ((fp = fopen(argv[level], "r")) != 0) {
        while ((j = fgetc(fp)) != EOF) {
-           if (waddch(txtwin, j) != OK) {
+           if (waddch(txtwin, UChar(j)) != OK) {
                break;
            }
        }
index ce98259c321734baee31572131146f84f3571a5c..82e63783363846a40719541d6c6100bbeeac4080 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2006,2007 Free Software Foundation, Inc.                   *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: redraw.c,v 1.3 2006/11/04 23:20:27 tom Exp $
+ * $Id: redraw.c,v 1.4 2007/06/30 17:55:06 tom Exp $
  *
  * Demonstrate the redrawwin() and wredrawln() functions.
  * Thomas Dickey - 2006/11/4
@@ -148,7 +148,7 @@ test_redraw(WINDOW *win)
            if (ch > KEY_MIN) {
                waddstr(win, keyname(ch));
            } else {
-               waddstr(win, unctrl(ch));
+               waddstr(win, unctrl(UChar(ch)));
            }
            break;
        }
index 0ab41507989b8c5ca2a0119bdc71d1800f2861ef..4f472d33a4b90773843597b40f65bea053b74024 100644 (file)
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.67 2007/06/23 15:46:17 tom Exp $ */
+/* $Id: test.priv.h,v 1.68 2007/06/30 17:53:09 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
@@ -309,7 +309,7 @@ extern int optind;
 
 #ifndef HAVE_TYPE_ATTR_T
 #if !USE_WIDEC_SUPPORT
-#define attr_t long
+#define attr_t chtype
 #endif
 #endif
 
diff --git a/test/test_getstr.c b/test/test_getstr.c
new file mode 100644 (file)
index 0000000..0435897
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * $Id: test_getstr.c,v 1.1 2007/06/30 16:51:28 tom Exp $
+ *
+ * Demonstrate the getstr functions from the curses library.
+
+       int getstr(char *str);
+       int getnstr(char *str, int n);
+       int wgetstr(WINDOW *win, char *str);
+       int wgetnstr(WINDOW *win, char *str, int n);
+       int mvgetstr(int y, int x, char *str);
+       int mvwgetstr(WINDOW *win, int y, int x, char *str);
+       int mvgetnstr(int y, int x, char *str, int n);
+       int mvwgetnstr(WINDOW *, int y, int x, char *str, int n);
+ */
+
+#include <test.priv.h>
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    printf("Not implemented - test-driver for curses getstr() functions\n");
+    return EXIT_SUCCESS;
+}
diff --git a/test/test_instr.c b/test/test_instr.c
new file mode 100644 (file)
index 0000000..e006693
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * $Id: test_instr.c,v 1.1 2007/06/30 16:51:44 tom Exp $
+ *
+ * Demonstrate the instr functions from the curses library.
+
+       int instr(char *str);
+       int innstr(char *str, int n);
+       int winstr(WINDOW *win, char *str);
+       int winnstr(WINDOW *win, char *str, int n);
+       int mvinstr(int y, int x, char *str);
+       int mvinnstr(int y, int x, char *str, int n);
+       int mvwinstr(WINDOW *win, int y, int x, char *str);
+       int mvwinnstr(WINDOW *win, int y, int x, char *str, int n);
+ */
+
+#include <test.priv.h>
+
+int
+main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
+{
+    printf("Not implemented - test-driver for curses instr() functions\n");
+    return EXIT_SUCCESS;
+}
index 05e7d4812d5d33a2edfecda3903e9e8344aadadf..c76aded9583ea4297c3fd7e9b2caddab7689c5f7 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -50,7 +50,7 @@
  * scroll operation worked, and the refresh() code only had to do a
  * partial repaint.
  *
- * $Id: view.c,v 1.64 2006/05/20 15:37:03 tom Exp $
+ * $Id: view.c,v 1.65 2007/06/30 16:40:04 tom Exp $
  */
 
 #include <test.priv.h>
@@ -374,7 +374,7 @@ main(int argc, char *argv[])
                    lptr++;
                else
                    break;
-           wscrl(stdscr, lptr - olptr);
+           scrl(lptr - olptr);
            break;
 
        case KEY_UP:
@@ -385,7 +385,7 @@ main(int argc, char *argv[])
                    lptr--;
                else
                    break;
-           wscrl(stdscr, lptr - olptr);
+           scrl(lptr - olptr);
            break;
 
        case 'h':