]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.0 - patch 20160423
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 24 Apr 2016 01:26:19 +0000 (01:26 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 24 Apr 2016 01:26:19 +0000 (01:26 +0000)
+ modify test/ncurses.c 'd' edit-color menu to optionally read xterm
  color palette directly from terminal, as well as handling KEY_RESIZE
  and screen-repainting with control/L and control/R.
+ add 'oc' capability to xterm+256color, allowing palette reset for
  xterm -TD

NEWS
VERSION
dist.mk
misc/terminfo.src
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
test/ncurses.c

diff --git a/NEWS b/NEWS
index 648a717a4cc6fcb2879f0bba9dd1d96d6e5d2683..e344c7041aecd55b2f5ca78136b7e88c306d298a 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.2594 2016/04/16 20:28:00 tom Exp $
+-- $Id: NEWS,v 1.2597 2016/04/24 01:01:58 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,13 @@ 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.
 
+20160423
+       + modify test/ncurses.c 'd' edit-color menu to optionally read xterm
+         color palette directly from terminal, as well as handling KEY_RESIZE
+         and screen-repainting with control/L and control/R.
+       + add 'oc' capability to xterm+256color, allowing palette reset for
+         xterm -TD
+
 20160416
        + add workaround in configure script for inept transition to PIE vs
          PIC builds documented in
diff --git a/VERSION b/VERSION
index 4450d430460afc34cb111d866d96fc6dcf0adc38..c5086459bd83bd9e0bc0ed2de925f9ff604fbecf 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:9  6.0     20160416
+5:0:9  6.0     20160423
diff --git a/dist.mk b/dist.mk
index 22f147cd97290e1b9a08531a962e8a505d500ec1..ed620dd64cc69470aa2fb3c7c8a99fb2a852bd1d 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.1102 2016/04/16 18:08:32 tom Exp $
+# $Id: dist.mk,v 1.1103 2016/04/23 10:14:21 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 = 6
 NCURSES_MINOR = 0
-NCURSES_PATCH = 20160416
+NCURSES_PATCH = 20160423
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 13cc1f912def4d661e41a968a81ac053bbaa6ab3..1e28783e1e683a6cf472d1c8594df8a5badd26d7 100644 (file)
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #      bug-ncurses@gnu.org
 #
-#      $Revision: 1.561 $
-#      $Date: 2016/01/17 00:25:26 $
+#      $Revision: 1.562 $
+#      $Date: 2016/04/23 10:59:12 $
 #
 # The original header is preserved below for reference.  It is noted that there
 # is a "newer" version which differs in some cosmetic details (but actually
@@ -4234,6 +4234,7 @@ xterm+256color|xterm 256-color feature,
        ccc,
        colors#256, pairs#32767,
        initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
+       oc=\E]104\007,
        setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
        setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
        setb@, setf@,
@@ -23823,4 +23824,8 @@ v3220|LANPAR Vision II model 3220/3221/3222,
 #        for better consistency with xterm (report by Leonardo Brondani
 #        Schenkel) -TD
 #
+# 2016-04-23
+#      + add 'oc' capability to xterm+256color, allowing palette reset for
+#        xterm -TD
+#
 ######## SHANTIH!  SHANTIH!  SHANTIH!
index 688236257f6f72a80548736b7c5bf961c99b73ae..16b3e4d7e6aba10e6e7ee4c30b22a44899e41499 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20160416) unstable; urgency=low
+ncurses6 (6.0+20160423) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 16 Apr 2016 14:08:32 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 23 Apr 2016 06:14:21 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 688236257f6f72a80548736b7c5bf961c99b73ae..16b3e4d7e6aba10e6e7ee4c30b22a44899e41499 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20160416) unstable; urgency=low
+ncurses6 (6.0+20160423) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 16 Apr 2016 14:08:32 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 23 Apr 2016 06:14:21 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 4301ec3f8662750f1bba3ab4c843ed6646943085..22ec7221a19c98012f10e5f85aec4f2a117cfa69 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20160416) unstable; urgency=low
+ncurses6 (6.0+20160423) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 16 Apr 2016 14:08:32 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 23 Apr 2016 06:14:21 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 6fc90691d37da52f247536c07d14545292c09b00..1ff1089f2fb1fa38f2ebb639621f334c6235c136 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.154 2016/04/16 18:08:32 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.155 2016/04/23 10:14:21 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "0"\r
 !define VERSION_YYYY  "2016"\r
-!define VERSION_MMDD  "0416"\r
+!define VERSION_MMDD  "0423"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 25d269e4aec54ada082b1b184c6e894ef38fe835..813e32adf21e9db9de56059a663488dbf6dc5e8d 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.0
-Release: 20160416
+Release: 20160423
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 3ff49ea5e029de0c11828ffd9835c735704c015a..252375b2aed88ebee05681e4c98699260089878a 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.0
-Release: 20160416
+Release: 20160423
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 9a90d4018dc9fbdb740e2d9988d48cd15508fce3..d04effb40b63a44ec63fee897345dcf251ed737d 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.429 2016/01/03 01:50:10 tom Exp $
+$Id: ncurses.c,v 1.433 2016/04/24 01:00:06 tom Exp $
 
 ***************************************************************************/
 
@@ -2652,7 +2652,7 @@ change_color(NCURSES_PAIRS_T current, int field, int value, int usebase)
 }
 
 static void
-init_all_colors(void)
+reset_all_colors(void)
 {
     NCURSES_PAIRS_T c;
 
@@ -2663,6 +2663,85 @@ init_all_colors(void)
                   all_colors[c].blue);
 }
 
+#define okCOLOR(n) ((n) >= 0 && (n) < max_colors)
+#define okRGB(n)   ((n) >= 0 && (n) <= 1000)
+#define DecodeRGB(n) ((n * 1000) / 0xffff)
+
+static void
+init_all_colors(bool xterm_colors, char *palette_file)
+{
+    NCURSES_PAIRS_T cp;
+    all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors);
+    if (!all_colors)
+       failed("all_colors");
+    for (cp = 0; cp < max_colors; ++cp) {
+       color_content(cp,
+                     &all_colors[cp].red,
+                     &all_colors[cp].green,
+                     &all_colors[cp].blue);
+    }
+    /* xterm and compatible terminals can read results of an OSC string
+     * asking for the current color palette.
+     */
+    if (xterm_colors) {
+       int n;
+       int got;
+       char result[BUFSIZ];
+       int check_n, check_r, check_g, check_b;
+
+       raw();
+       noecho();
+       for (n = 0; n < max_colors; ++n) {
+           fprintf(stderr, "\033]4;%d;?\007", n);
+           got = read(0, result, sizeof(result) - 1);
+           if (got < 0)
+               break;
+           result[got] = '\0';
+           if (sscanf(result, "\033]4;%d;rgb:%x/%x/%x\007",
+                      &check_n,
+                      &check_r,
+                      &check_g,
+                      &check_b) == 4 &&
+               check_n == n) {
+               all_colors[n].red = DecodeRGB(check_r);
+               all_colors[n].green = DecodeRGB(check_g);
+               all_colors[n].blue = DecodeRGB(check_b);
+           } else {
+               break;
+           }
+       }
+       reset_prog_mode();
+    }
+    if (palette_file != 0) {
+       FILE *fp = fopen(palette_file, "r");
+       if (fp != 0) {
+           char buffer[BUFSIZ];
+           int red, green, blue;
+           int scale = 1000;
+           int c;
+           while (fgets(buffer, sizeof(buffer), fp) != 0) {
+               if (sscanf(buffer, "scale:%d", &c) == 1) {
+                   scale = c;
+               } else if (sscanf(buffer, "%d:%d %d %d",
+                                 &c,
+                                 &red,
+                                 &green,
+                                 &blue) == 4
+                          && okCOLOR(c)
+                          && okRGB(red)
+                          && okRGB(green)
+                          && okRGB(blue)) {
+#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale)
+                   all_colors[c].red = Scaled(red);
+                   all_colors[c].green = Scaled(green);
+                   all_colors[c].blue = Scaled(blue);
+               }
+           }
+           fclose(fp);
+       }
+    }
+}
+
 #define scaled_rgb(n) ((255 * (n)) / 1000)
 
 static void
@@ -2670,14 +2749,23 @@ color_edit(void)
 /* display the color test pattern, without trying to edit colors */
 {
     int i;
-    int current = 0;
-    int this_c = 0, value = 0, field = 0;
+    int current;
+    int this_c, value, field;
     int last_c;
-    int top_color = 0;
-    int page_size = (LINES - 6);
-
-    init_all_colors();
-    refresh();
+    int top_color;
+    int page_size;
+
+    reset_all_colors();
+#ifdef KEY_RESIZE
+  retry:
+#endif
+    current = 0;
+    this_c = 0;
+    value = 0;
+    field = 0;
+    top_color = 0;
+    page_size = (LINES - 6);
+    erase();
 
     for (i = 0; i < max_colors; i++)
        init_pair((NCURSES_PAIRS_T) i,
@@ -2746,6 +2834,21 @@ color_edit(void)
            value = 0;
 
        switch (this_c) {
+#ifdef KEY_RESIZE
+       case KEY_RESIZE:
+           move(0, 0);
+           goto retry;
+#endif
+       case '!':
+           ShellOut(FALSE);
+           /* FALLTHRU */
+       case CTRL('r'):
+           endwin();
+           refresh();
+           break;
+       case CTRL('l'):
+           refresh();
+           break;
        case CTRL('b'):
        case KEY_PPAGE:
            if (current > 0)
@@ -2772,10 +2875,12 @@ color_edit(void)
            current = (current == (max_colors - 1) ? 0 : current + 1);
            break;
 
+       case '\t':
        case KEY_RIGHT:
            field = (field == 2 ? 0 : field + 1);
            break;
 
+       case KEY_BTAB:
        case KEY_LEFT:
            field = (field == 0 ? 2 : field - 1);
            break;
@@ -2818,6 +2923,8 @@ color_edit(void)
            P("To increment or decrement a value, use the same procedure, but finish");
            P("with a `+' or `-'.");
            P("");
+           P("Use `!' to shell-out, ^R or ^L to repaint the screen.");
+           P("");
            P("Press 'm' to invoke the top-level menu with the current color settings.");
            P("To quit, do ESC");
 
@@ -2862,7 +2969,7 @@ color_edit(void)
     /*
      * ncurses does not reset each color individually when calling endwin().
      */
-    init_all_colors();
+    reset_all_colors();
 
     endwin();
 }
@@ -6923,6 +7030,7 @@ usage(void)
 #ifdef TRACE
        ,"  -t mask  specify default trace-level (may toggle with ^T)"
 #endif
+       ,"  -x       use xterm-compatible control for reading color palette"
     };
     size_t n;
     for (n = 0; n < SIZEOF(tbl); n++)
@@ -7088,9 +7196,6 @@ main_menu(bool top)
        main(argc,argv)
 --------------------------------------------------------------------------*/
 
-#define okCOLOR(n) ((n) >= 0 && (n) < max_colors)
-#define okRGB(n)   ((n) >= 0 && (n) <= 1000)
-
 int
 main(int argc, char *argv[])
 {
@@ -7104,10 +7209,11 @@ main(int argc, char *argv[])
 #endif
     char *palette_file = 0;
     bool monochrome = FALSE;
+    bool xterm_colors = FALSE;
 
     setlocale(LC_ALL, "");
 
-    while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:")) != -1) {
+    while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:x")) != -1) {
        switch (c) {
 #ifdef NCURSES_VERSION
        case 'a':
@@ -7169,6 +7275,9 @@ main(int argc, char *argv[])
            save_trace = (unsigned) strtol(optarg, 0, 0);
            break;
 #endif
+       case 'x':
+           xterm_colors = TRUE;
+           break;
        default:
            usage();
        }
@@ -7203,6 +7312,9 @@ main(int argc, char *argv[])
     initscr();
     bkgdset(BLANK);
 
+    set_terminal_modes();
+    def_prog_mode();
+
     /* tests, in general, will want these modes */
     use_colors = (bool) (monochrome ? FALSE : has_colors());
 
@@ -7226,47 +7338,9 @@ main(int argc, char *argv[])
        max_pairs = COLOR_PAIRS;        /* was > 256 ? 256 : COLOR_PAIRS */
 
        if (can_change_color()) {
-           NCURSES_PAIRS_T cp;
-           all_colors = typeMalloc(RGB_DATA, (unsigned) max_colors);
-           if (!all_colors)
-               failed("all_colors");
-           for (cp = 0; cp < max_colors; ++cp) {
-               color_content(cp,
-                             &all_colors[cp].red,
-                             &all_colors[cp].green,
-                             &all_colors[cp].blue);
-           }
-           if (palette_file != 0) {
-               FILE *fp = fopen(palette_file, "r");
-               if (fp != 0) {
-                   char buffer[BUFSIZ];
-                   int red, green, blue;
-                   int scale = 1000;
-                   while (fgets(buffer, sizeof(buffer), fp) != 0) {
-                       if (sscanf(buffer, "scale:%d", &c) == 1) {
-                           scale = c;
-                       } else if (sscanf(buffer, "%d:%d %d %d",
-                                         &c,
-                                         &red,
-                                         &green,
-                                         &blue) == 4
-                                  && okCOLOR(c)
-                                  && okRGB(red)
-                                  && okRGB(green)
-                                  && okRGB(blue)) {
-#define Scaled(n) (NCURSES_COLOR_T) (((n) * 1000) / scale)
-                           all_colors[c].red = Scaled(red);
-                           all_colors[c].green = Scaled(green);
-                           all_colors[c].blue = Scaled(blue);
-                       }
-                   }
-                   fclose(fp);
-               }
-           }
+           init_all_colors(xterm_colors, palette_file);
        }
     }
-    set_terminal_modes();
-    def_prog_mode();
 
     /*
      * Return to terminal mode, so we're guaranteed of being able to