]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20140629
authorThomas E. Dickey <dickey@invisible-island.net>
Mon, 30 Jun 2014 00:28:28 +0000 (00:28 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Mon, 30 Jun 2014 00:28:28 +0000 (00:28 +0000)
+ correct check in win_driver.c for saving screen contents, e.g., when
  NCURSES_CONSOLE2 is set (cf: 20140503).
+ reorganize b/B menu items in ncurses.c, putting the test-strings into
  subwindows.  This is needed for a planned change to use Unicode
  fullwidth characters in the test-screens.
+ correct update to form status for _NEWTOP, broken by fixes for
  compiler warnings (patch by Leon Winter, cf: 20120616).

12 files changed:
NEWS
dist.mk
form/frm_driver.c
ncurses/win32con/win_driver.c
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
test/dots_curses.c
test/ncurses.c

diff --git a/NEWS b/NEWS
index 25b4a1c54b63ec7acafd3091b940c87fc2165119..2d53cee24aa02b157c0efacffda0ec6484d3d65b 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.2229 2014/06/21 21:51:45 tom Exp $
+-- $Id: NEWS,v 1.2234 2014/06/29 23:43:38 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,15 @@ 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.
 
+20140629
+       + correct check in win_driver.c for saving screen contents, e.g., when
+         NCURSES_CONSOLE2 is set (cf: 20140503).
+       + reorganize b/B menu items in ncurses.c, putting the test-strings into
+         subwindows.  This is needed for a planned change to use Unicode
+         fullwidth characters in the test-screens.
+       + correct update to form status for _NEWTOP, broken by fixes for
+         compiler warnings (patch by Leon Winter, cf: 20120616).
+
 20140621
        + change shared-library suffix for AIX 5 and 6 to ".so", avoiding
          conflict with the static library (report by Ben Lentz).
diff --git a/dist.mk b/dist.mk
index e2ded37d96088887731dcf9eb9873e6777216db7..f0986dead924012e74de4807d10ab3583eea8a6a 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.992 2014/06/21 14:35:14 tom Exp $
+# $Id: dist.mk,v 1.994 2014/06/28 21:47:46 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 = 9
-NCURSES_PATCH = 20140621
+NCURSES_PATCH = 20140629
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 3b7705710f65cf019784fe4ae673a43552c35a1c..85d6a62f3305cb72fde117e5305baa528e5e6268 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.111 2014/03/08 22:08:20 Xin.Li Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.112 2014/06/28 16:28:22 Leon.Winter Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -1998,7 +1998,7 @@ Vertical_Scrolling(int (*const fct) (FORM *), FORM *form)
     {
       res = fct(form);
       if (res == E_OK)
-       SetStatus(form, _NEWTOP);
+       SetStatus(form->current, _NEWTOP);
     }
   return (res);
 }
index 443476460eb1fd23c20193000a248c76b8f4562b..0cb27e81b3f8a0c43466185e6c3bd3d591367efd 100644 (file)
@@ -45,7 +45,7 @@
 
 #define CUR my_term.type.
 
-MODULE_ID("$Id: win_driver.c,v 1.38 2014/05/10 21:50:00 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.39 2014/06/29 22:48:17 tom Exp $")
 
 #ifndef __GNUC__
 #  error We need GCC to compile for MinGW
@@ -1909,7 +1909,7 @@ __attribute__((constructor))
        if (CON.hdl != INVALID_HANDLE_VALUE) {
            CON.buffered = buffered;
            get_SBI();
-           if (buffered) {
+           if (!buffered) {
                save_original_screen();
            }
        }
index bbefb0cd821ad31d86c19ee5700dbe97fcc27ee5..a4ae93bce0185e12bfe1029b63e405334424c9a9 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140621) unstable; urgency=low
+ncurses6 (5.9-20140629) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 21 Jun 2014 10:35:14 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index bbefb0cd821ad31d86c19ee5700dbe97fcc27ee5..a4ae93bce0185e12bfe1029b63e405334424c9a9 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140621) unstable; urgency=low
+ncurses6 (5.9-20140629) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 21 Jun 2014 10:35:14 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 233c827e2994a8d991813c349bf70b3fded2b3d5..473831fb5442e61684a4ee5db2c0a5e92d0c6eae 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140621) unstable; urgency=low
+ncurses6 (5.9-20140629) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 21 Jun 2014 10:35:14 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 982ef4761278b3fdd7d967ba0a313a12db4f77e7..04a60bcb38931d4eb01a5fa3a7f68534b7abcd06 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.47 2014/06/21 14:35:14 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.49 2014/06/28 21:47:47 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "5"\r
 !define VERSION_MINOR "9"\r
 !define VERSION_YYYY  "2014"\r
-!define VERSION_MMDD  "0621"\r
+!define VERSION_MMDD  "0629"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index db673dfc534409c69f81671fdea2b3d87aa4408f..8d272fdafe6e2871f4218973e1ec6c528f674e8c 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 5.9
-Release: 20140621
+Release: 20140629
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index c089851f0aba2ee34395604a7fa6861604f62893..ef3dc2fbae8bf701e06cbdef4eb29e7571e03a7e 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 5.9
-Release: 20140621
+Release: 20140629
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index ef300ee4d3abd333cc46eb4b054eaa33c26ca8a9..dc767116d33055666d859559f55c406ee815c09d 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: dots_curses.c,v 1.1 2014/06/21 16:07:50 tom Exp $
+ * $Id: dots_curses.c,v 1.2 2014/06/28 20:33:24 tom Exp $
  *
  * A simple demo of the curses interface used for comparison with termcap.
  */
@@ -106,7 +106,7 @@ main(int argc GCC_UNUSED,
            for (bg = 0; bg < COLORS; bg++) {
                int pair = mypair(fg, bg);
                if (pair > 0)
-                   init_pair(pair, fg, bg);
+                   init_pair((short) pair, (short) fg, (short) bg);
            }
        }
     }
@@ -142,7 +142,7 @@ main(int argc GCC_UNUSED,
                napms(1);
            }
        }
-       addch(p);
+       addch((chtype) p);
        refresh();
        ++total_chars;
     }
index 28d3de758aa0ad9b6685b731223aa895eed1b52f..bf874677b8ff4a9c1214021db282aca212a31c41 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.401 2014/06/21 18:37:29 tom Exp $
+$Id: ncurses.c,v 1.408 2014/06/28 21:45:40 tom Exp $
 
 ***************************************************************************/
 
@@ -303,7 +303,7 @@ wGetstring(WINDOW *win, char *buffer, int limit)
 
 #if USE_WIDEC_SUPPORT
 static wchar_t
-fullwidth_of(int ch)
+fullwidth_digit(int ch)
 {
     return (ch + 0xff10 - '0');
 }
@@ -313,7 +313,7 @@ make_fullwidth_text(wchar_t *target, const char *source)
 {
     int ch;
     while ((ch = *source++) != 0) {
-       *target++ = fullwidth_of(ch);
+       *target++ = fullwidth_digit(ch);
     }
     *target = 0;
 }
@@ -334,7 +334,7 @@ make_fullwidth_digit(cchar_t *target, int digit)
 {
     wchar_t source[2];
 
-    source[0] = fullwidth_of(digit + '0');
+    source[0] = fullwidth_digit(digit + '0');
     source[1] = 0;
     setcchar(target, source, A_NORMAL, 0, 0);
 }
@@ -1252,8 +1252,13 @@ my_termattrs(void)
 #define termattrs() my_termattrs()
 #endif
 
-#define MAX_ATTRSTRING 31
-#define LEN_ATTRSTRING 26
+#define ATTRSTRING_1ST 32      /* ' ' */
+#define ATTRSTRING_END 126     /* '~' */
+
+#define COL_ATTRSTRING 25
+#define MARGIN_4_ATTRS (COL_ATTRSTRING + 8)
+#define LEN_ATTRSTRING (COLS - MARGIN_4_ATTRS)
+#define MAX_ATTRSTRING (ATTRSTRING_END + 1 - ATTRSTRING_1ST)
 
 static char attr_test_string[MAX_ATTRSTRING + 1];
 
@@ -1352,12 +1357,14 @@ cycle_color_attr(int ch, NCURSES_COLOR_T *fg, NCURSES_COLOR_T *bg, NCURSES_COLOR
 static void
 adjust_attr_string(int adjust)
 {
-    int first = ((int) UChar(attr_test_string[0])) + adjust;
-    int last = first + LEN_ATTRSTRING;
+    char save = attr_test_string[0];
+    int first = ((int) UChar(save)) + adjust;
+    int j, k;
 
-    if (first >= ' ' && last <= '~') { /* 32..126 */
-       int j, k;
-       for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) {
+    if (first >= ATTRSTRING_1ST) {
+       for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
+           if (k > ATTRSTRING_END)
+               break;
            attr_test_string[j] = (char) k;
            if (((k + 1 - first) % 5) == 0) {
                if (++j >= MAX_ATTRSTRING)
@@ -1365,23 +1372,40 @@ adjust_attr_string(int adjust)
                attr_test_string[j] = ' ';
            }
        }
-       while (j < MAX_ATTRSTRING)
-           attr_test_string[j++] = ' ';
-       attr_test_string[j] = '\0';
-    } else {
-       beep();
+       if ((LEN_ATTRSTRING - j) > 5) {
+           attr_test_string[0] = save;
+           adjust_attr_string(adjust - 1);
+       } else {
+           while (j < MAX_ATTRSTRING)
+               attr_test_string[j++] = ' ';
+           attr_test_string[j] = '\0';
+       }
     }
 }
 
+/*
+ * Prefer the right-end of the string for starting, since that maps to the
+ * VT100 line-drawing.
+ */
+static int
+default_attr_string(void)
+{
+    int result = (ATTRSTRING_END - LEN_ATTRSTRING);
+    result += (LEN_ATTRSTRING / 5);
+    if (result < ATTRSTRING_1ST)
+       result = ATTRSTRING_1ST;
+    return result;
+}
+
 static void
 init_attr_string(void)
 {
-    attr_test_string[0] = 'a';
+    attr_test_string[0] = (char) default_attr_string();
     adjust_attr_string(0);
 }
 
 static int
-show_attr(int row, int skip, bool arrow, chtype attr, const char *name)
+show_attr(WINDOW *win, int row, int skip, bool arrow, chtype attr, const char *name)
 {
     int ncv = get_ncv();
     chtype test = attr & (chtype) (~A_ALTCHARSET);
@@ -1389,7 +1413,7 @@ show_attr(int row, int skip, bool arrow, chtype attr, const char *name)
     if (arrow)
        MvPrintw(row, 5, "-->");
     MvPrintw(row, 8, "%s mode:", name);
-    MvPrintw(row, 24, "|");
+    MvPrintw(row, COL_ATTRSTRING - 1, "|");
     if (skip)
        printw("%*s", skip, " ");
     /*
@@ -1397,22 +1421,23 @@ show_attr(int row, int skip, bool arrow, chtype attr, const char *name)
      * character at a time (to pass its rendition directly), and use the
      * string operation for the other attributes.
      */
+    wmove(win, 0, 0);
     if (attr & A_ALTCHARSET) {
        const char *s;
        chtype ch;
 
        for (s = attr_test_string; *s != '\0'; ++s) {
            ch = UChar(*s);
-           addch(ch | attr);
+           (void) waddch(win, ch | attr);
        }
     } else {
-       (void) attrset(attr);
-       addstr(attr_test_string);
-       attroff(attr);
+       (void) wattrset(win, attr);
+       (void) waddstr(win, attr_test_string);
+       (void) wattroff(win, attr);
     }
     if (skip)
        printw("%*s", skip, " ");
-    printw("|");
+    MvPrintw(row, COL_ATTRSTRING + LEN_ATTRSTRING, "|");
     if (test != A_NORMAL) {
        if (!(termattrs() & test)) {
            printw(" (N/A)");
@@ -1570,10 +1595,18 @@ attr_test(void)
     NCURSES_COLOR_T tx = -1;
     int ac = 0;
     unsigned j, k;
+    WINDOW *my_wins[SIZEOF(attrs_to_test)];
     ATTR_TBL my_list[SIZEOF(attrs_to_test)];
     unsigned my_size = init_attr_list(my_list, termattrs());
 
     if (my_size > 1) {
+       for (j = 0; j < my_size; ++j) {
+           my_wins[j] = subwin(stdscr,
+                               1, LEN_ATTRSTRING,
+                               2 + (int) (2 * j), COL_ATTRSTRING);
+           scrollok(my_wins[j], FALSE);
+       }
+
        if (skip < 0)
            skip = 0;
 
@@ -1614,7 +1647,7 @@ attr_test(void)
 
            for (j = 0; j < my_size; ++j) {
                bool arrow = (j == k);
-               row = show_attr(row, n, arrow,
+               row = show_attr(my_wins[j], row, n, arrow,
                                extras |
                                my_list[j].attr |
                                my_list[k].attr,
@@ -1645,12 +1678,14 @@ static wchar_t wide_attr_test_string[MAX_ATTRSTRING + 1];
 static void
 wide_adjust_attr_string(int adjust)
 {
-    int first = ((int) UChar(wide_attr_test_string[0])) + adjust;
-    int last = first + LEN_ATTRSTRING;
+    char save = (char) wide_attr_test_string[0];
+    int first = ((int) UChar(save)) + adjust;
+    int j, k;
 
-    if (first >= ' ' && last <= '~') { /* 32..126 */
-       int j, k;
-       for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) {
+    if (first >= ATTRSTRING_1ST) {
+       for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
+           if (k > ATTRSTRING_END)
+               break;
            wide_attr_test_string[j] = k;
            if (((k + 1 - first) % 5) == 0) {
                if (++j >= MAX_ATTRSTRING)
@@ -1658,18 +1693,21 @@ wide_adjust_attr_string(int adjust)
                wide_attr_test_string[j] = ' ';
            }
        }
-       while (j < MAX_ATTRSTRING)
-           wide_attr_test_string[j++] = ' ';
-       wide_attr_test_string[j] = '\0';
-    } else {
-       beep();
+       if ((LEN_ATTRSTRING - j) > 5) {
+           wide_attr_test_string[0] = save;
+           wide_adjust_attr_string(adjust - 1);
+       } else {
+           while (j < MAX_ATTRSTRING)
+               wide_attr_test_string[j++] = ' ';
+           wide_attr_test_string[j] = '\0';
+       }
     }
 }
 
 static void
 wide_init_attr_string(void)
 {
-    wide_attr_test_string[0] = 'a';
+    wide_attr_test_string[0] = default_attr_string();
     wide_adjust_attr_string(0);
 }
 
@@ -1705,7 +1743,8 @@ get_wide_background(void)
 }
 
 static int
-wide_show_attr(int row,
+wide_show_attr(WINDOW *win,
+              int row,
               int skip,
               bool arrow,
               chtype attr,
@@ -1718,7 +1757,7 @@ wide_show_attr(int row,
     if (arrow)
        MvPrintw(row, 5, "-->");
     MvPrintw(row, 8, "%s mode:", name);
-    MvPrintw(row, 24, "|");
+    MvPrintw(row, COL_ATTRSTRING - 1, "|");
     if (skip)
        printw("%*s", skip, " ");
 
@@ -1727,6 +1766,7 @@ wide_show_attr(int row,
      * character at a time (to pass its rendition directly), and use the
      * string operation for the other attributes.
      */
+    wmove(win, 0, 0);
     if (attr & WA_ALTCHARSET) {
        const wchar_t *s;
        cchar_t ch;
@@ -1736,20 +1776,20 @@ wide_show_attr(int row,
            fill[0] = *s;
            fill[1] = L'\0';
            setcchar(&ch, fill, attr, pair, 0);
-           add_wch(&ch);
+           (void) wadd_wch(win, &ch);
        }
     } else {
        attr_t old_attr = 0;
        NCURSES_PAIRS_T old_pair = 0;
 
-       (void) (attr_get) (&old_attr, &old_pair, 0);
-       (void) attr_set(attr, pair, 0);
-       addwstr(wide_attr_test_string);
-       (void) attr_set(old_attr, old_pair, 0);
+       (void) (wattr_get) (win, &old_attr, &old_pair, 0);
+       (void) wattr_set(win, attr, pair, 0);
+       (void) waddwstr(win, wide_attr_test_string);
+       (void) wattr_set(win, old_attr, old_pair, 0);
     }
     if (skip)
        printw("%*s", skip, " ");
-    printw("|");
+    MvPrintw(row, COL_ATTRSTRING + LEN_ATTRSTRING, "|");
     if (test != A_NORMAL) {
        if (!(term_attrs() & test)) {
            printw(" (N/A)");
@@ -1862,9 +1902,17 @@ wide_attr_test(void)
     int ac = 0;
     unsigned j, k;
     ATTR_TBL my_list[SIZEOF(attrs_to_test)];
+    WINDOW *my_wins[SIZEOF(attrs_to_test)];
     unsigned my_size = init_attr_list(my_list, term_attrs());
 
     if (my_size > 1) {
+       for (j = 0; j < my_size; ++j) {
+           my_wins[j] = subwin(stdscr,
+                               1, LEN_ATTRSTRING,
+                               2 + (int) (2 * j), COL_ATTRSTRING);
+           scrollok(my_wins[j], FALSE);
+       }
+
        if (skip < 0)
            skip = 0;
 
@@ -1900,7 +1948,7 @@ wide_attr_test(void)
            MvAddStr(0, 20, "Character attribute test display");
 
            for (j = 0; j < my_size; ++j) {
-               row = wide_show_attr(row, n, j == k,
+               row = wide_show_attr(my_wins[j], row, n, (j == k),
                                     ((attr_t) ac |
                                      my_list[j].attr |
                                      my_list[k].attr),
@@ -4752,13 +4800,13 @@ pflush(void)
        fill_panel(win)
 --------------------------------------------------------------------------*/
 static void
-init_panel(void)
+init_panel(WINDOW *win)
 {
     register int y, x;
 
     for (y = 0; y < LINES - 1; y++) {
        for (x = 0; x < COLS; x++)
-           wprintw(stdscr, "%d", (y + x) % 10);
+           wprintw(win, "%d", (y + x) % 10);
     }
 }
 
@@ -4784,7 +4832,7 @@ fill_panel(PANEL * pan)
 
 #if USE_WIDEC_SUPPORT
 static void
-init_wide_panel(void)
+init_wide_panel(WINDOW *win)
 {
     int digit;
     cchar_t temp[10];
@@ -4796,7 +4844,7 @@ init_wide_panel(void)
        int y, x;
        getyx(stdscr, y, x);
        digit = (y + x / 2) % 10;
-    } while (add_wch(&temp[digit]) != ERR);
+    } while (wadd_wch(win, &temp[digit]) != ERR);
 }
 
 static void
@@ -4850,7 +4898,7 @@ canned_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd)
 }
 
 static void
-demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *))
+demo_panels(void (*InitPanel) (WINDOW *), void (*FillPanel) (PANEL *))
 {
     int count;
     int itmp;
@@ -4859,7 +4907,7 @@ demo_panels(void (*InitPanel) (void), void (*FillPanel) (PANEL *))
     scrollok(stdscr, FALSE);   /* we don't want stdscr to scroll! */
     refresh();
 
-    InitPanel();
+    InitPanel(stdscr);
     for (count = 0; count < 5; count++) {
        px[1] = mkpanel(COLOR_RED,
                        LINES / 2 - 2,