]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20140705
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 6 Jul 2014 01:43:07 +0000 (01:43 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 6 Jul 2014 01:43:07 +0000 (01:43 +0000)
+ add w/W toggle to ncurses.c 'B' test, to demonstrate permutation of
  video-attributes and colors with double-width character strings.

NEWS
dist.mk
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 2d53cee24aa02b157c0efacffda0ec6484d3d65b..2f3c4787ba84119bf413bcd1bb20adb1034b1402 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.2234 2014/06/29 23:43:38 tom Exp $
+-- $Id: NEWS,v 1.2236 2014/07/05 20:39:04 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,10 @@ 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.
 
+20140705
+       + add w/W toggle to ncurses.c 'B' test, to demonstrate permutation of
+         video-attributes and colors with double-width character strings.
+
 20140629
        + correct check in win_driver.c for saving screen contents, e.g., when
          NCURSES_CONSOLE2 is set (cf: 20140503).
diff --git a/dist.mk b/dist.mk
index f0986dead924012e74de4807d10ab3583eea8a6a..7f28f32e3a80caa96970bb1a26b0154faed2ae3a 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.994 2014/06/28 21:47:46 tom Exp $
+# $Id: dist.mk,v 1.995 2014/07/05 18:50:25 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 = 20140629
+NCURSES_PATCH = 20140705
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index a4ae93bce0185e12bfe1029b63e405334424c9a9..405839903447cf71db1babbf394942fe0c169b1e 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140629) unstable; urgency=low
+ncurses6 (5.9-20140705) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 05 Jul 2014 14:50:25 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index a4ae93bce0185e12bfe1029b63e405334424c9a9..405839903447cf71db1babbf394942fe0c169b1e 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140629) unstable; urgency=low
+ncurses6 (5.9-20140705) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 05 Jul 2014 14:50:25 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 473831fb5442e61684a4ee5db2c0a5e92d0c6eae..7263cf572ff6913bb9f91efdf8b5538ba80d3ae2 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140629) unstable; urgency=low
+ncurses6 (5.9-20140705) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 28 Jun 2014 17:47:47 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 05 Jul 2014 14:50:25 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 04a60bcb38931d4eb01a5fa3a7f68534b7abcd06..a74dba28b0cd2cd2f094bfdba21716efe8415d70 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.49 2014/06/28 21:47:47 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.50 2014/07/05 18:50:25 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  "0629"\r
+!define VERSION_MMDD  "0705"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 8d272fdafe6e2871f4218973e1ec6c528f674e8c..f66424104f5d78f8f3dbcecd7efda8c44c5542ab 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 5.9
-Release: 20140629
+Release: 20140705
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index ef3dc2fbae8bf701e06cbdef4eb29e7571e03a7e..f782acaf2575d2942b47450769848b7e4385b7f6 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 5.9
-Release: 20140629
+Release: 20140705
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index bf874677b8ff4a9c1214021db282aca212a31c41..fce36630ab0ff2fccd586bebb3ada7024e6f9cc4 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.408 2014/06/28 21:45:40 tom Exp $
+$Id: ncurses.c,v 1.410 2014/07/05 22:23:34 tom Exp $
 
 ***************************************************************************/
 
@@ -1292,6 +1292,10 @@ attr_legend(WINDOW *helpwin)
              "  a/A     toggle ACS (alternate character set) mapping");
     MvWPrintw(helpwin, row, col,
              "  v/V     toggle video attribute to combine with each line");
+#if USE_WIDEC_SUPPORT
+    MvWPrintw(helpwin, row, col,
+             "  w/W     toggle normal/wide (double-width) test-characters");
+#endif
 }
 
 static void
@@ -1422,6 +1426,7 @@ show_attr(WINDOW *win, int row, int skip, bool arrow, chtype attr, const char *n
      * string operation for the other attributes.
      */
     wmove(win, 0, 0);
+    werase(win);
     if (attr & A_ALTCHARSET) {
        const char *s;
        chtype ch;
@@ -1673,20 +1678,59 @@ attr_test(void)
 }
 
 #if USE_WIDEC_SUPPORT
+static bool use_fullwidth;
 static wchar_t wide_attr_test_string[MAX_ATTRSTRING + 1];
 
+#define FULL_LO 0xff00
+#define FULL_HI 0xff5e
+#define HALF_LO 0x20
+
+#define isFullWidth(ch)   ((ch) >= FULL_LO && (ch) <= FULL_HI)
+#define ToNormalWidth(ch) (((ch) - FULL_LO) + HALF_LO)
+#define ToFullWidth(ch)   (((ch) - HALF_LO) + FULL_LO)
+
+/*
+ * Returns an ASCII code in [32..126]
+ */
+static wchar_t
+normal_wchar(int ch)
+{
+    wchar_t result = ch;
+    if (isFullWidth(ch))
+       result = ToNormalWidth(ch);
+    return result;
+}
+
+/*
+ * Returns either an ASCII code in in [32..126] or full-width in
+ * [0xff00..0xff5e], according to use_fullwidth setting.
+ */
+static wchar_t
+target_wchar(int ch)
+{
+    wchar_t result = ch;
+    if (use_fullwidth) {
+       if (!isFullWidth(ch))
+           result = ToFullWidth(ch);
+    } else {
+       if (isFullWidth(ch))
+           result = ToNormalWidth(ch);
+    }
+    return result;
+}
+
 static void
 wide_adjust_attr_string(int adjust)
 {
-    char save = (char) wide_attr_test_string[0];
-    int first = ((int) UChar(save)) + adjust;
+    wchar_t save = wide_attr_test_string[0];
+    int first = ((int) normal_wchar(save)) + adjust;
     int 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;
+           wide_attr_test_string[j] = target_wchar(k);
            if (((k + 1 - first) % 5) == 0) {
                if (++j >= MAX_ATTRSTRING)
                    break;
@@ -1707,6 +1751,7 @@ wide_adjust_attr_string(int adjust)
 static void
 wide_init_attr_string(void)
 {
+    use_fullwidth = FALSE;
     wide_attr_test_string[0] = default_attr_string();
     wide_adjust_attr_string(0);
 }
@@ -1767,6 +1812,7 @@ wide_show_attr(WINDOW *win,
      * string operation for the other attributes.
      */
     wmove(win, 0, 0);
+    werase(win);
     if (attr & WA_ALTCHARSET) {
        const wchar_t *s;
        cchar_t ch;
@@ -1872,6 +1918,14 @@ wide_attr_getc(int *skip,
                if (*kc >= limit)
                    *kc = 0;
                break;
+           case 'w':
+               use_fullwidth = FALSE;
+               wide_adjust_attr_string(0);
+               break;
+           case 'W':
+               use_fullwidth = TRUE;
+               wide_adjust_attr_string(0);
+               break;
            case '<':
                wide_adjust_attr_string(-1);
                break;