[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xterm: Changes to 'debian-unstable'



 MANIFEST                                  |    2 
 Tekproc.c                                 |   28 -
 XTerm.ad                                  |   25 +
 aclocal.m4                                |   22 -
 button.c                                  |   23 -
 cachedGCs.c                               |   32 -
 charproc.c                                |  235 +++++++----
 configure                                 |  588 ++++++++++++++----------------
 debian/changelog                          |    6 
 debian/patches/900_debian_xterm.diff      |   26 -
 debian/patches/901_xterm_manpage.diff     |    8 
 debian/patches/902_pointermode_never.diff |    8 
 debian/patches/903_windowops.diff         |   16 
 debian/patches/904_fontops.diff           |   16 
 doublechr.c                               |   15 
 fontutils.c                               |  182 ++++++---
 fontutils.h                               |   10 
 main.h                                    |    6 
 menu.c                                    |  167 ++++++++
 menu.h                                    |   26 +
 misc.c                                    |   95 +++-
 ptyx.h                                    |   19 
 screen.c                                  |  175 ++++----
 scrollbar.c                               |   23 -
 util.c                                    |  199 ++++++----
 version.h                                 |    4 
 wcwidth.c                                 |    6 
 xterm.h                                   |   21 -
 xterm.log.html                            |   49 ++
 xterm.man                                 |   97 +++-
 30 files changed, 1329 insertions(+), 800 deletions(-)

New commits:
commit 9985d0e947a258b2a02d74366c49e4a771b55324
Author: Julien Cristau <jcristau@debian.org>
Date:   Wed Mar 18 15:37:33 2009 +0100

    Prepare changelog for upload

diff --git a/debian/changelog b/debian/changelog
index 182eb87..da9a45d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,8 @@
-xterm (242-1) UNRELEASED; urgency=low
+xterm (242-1) unstable; urgency=low
 
   * New upstream release.
 
- -- Julien Cristau <jcristau@debian.org>  Fri, 13 Mar 2009 20:53:02 +0100
+ -- Julien Cristau <jcristau@debian.org>  Wed, 18 Mar 2009 15:37:18 +0100
 
 xterm (241-1) unstable; urgency=low
 

commit 9cd06ed5747792f56dd14d33651ce2f1fc1cd2f2
Author: Julien Cristau <jcristau@debian.org>
Date:   Fri Mar 13 20:54:46 2009 +0100

    refresh patches for new upstream

diff --git a/debian/changelog b/debian/changelog
index e5efa16..182eb87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xterm (242-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 13 Mar 2009 20:53:02 +0100
+
 xterm (241-1) unstable; urgency=low
 
   * New upstream release.
diff --git a/debian/patches/900_debian_xterm.diff b/debian/patches/900_debian_xterm.diff
index 80b69cc..8c8b14a 100644
--- a/debian/patches/900_debian_xterm.diff
+++ b/debian/patches/900_debian_xterm.diff
@@ -23,8 +23,10 @@ Make Debian-specific tweaks to xterm:
 
 This patch by Branden Robinson.
 
---- a/termcap.orig
-+++ b/termcap
+Index: xterm-242/termcap
+===================================================================
+--- xterm-242.orig/termcap
++++ xterm-242/termcap
 @@ -71,6 +71,14 @@
  	:so=\E[7m:sr=\EM:st=\EH:te=\E[?1049l:ti=\E[?1049h:\
  	:ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l:
@@ -48,8 +50,10 @@ This patch by Branden Robinson.
 +	:tc=xterm-debian:
 +#	:tc=xterm-new:
  #	:tc=xterm-r6:
---- a/terminfo.orig
-+++ b/terminfo
+Index: xterm-242/terminfo
+===================================================================
+--- xterm-242.orig/terminfo
++++ xterm-242/terminfo
 @@ -955,6 +955,13 @@
  	u8=\E[?1;2c,
  	u9=\E[c,
@@ -72,9 +76,11 @@ This patch by Branden Robinson.
 +	use=xterm-debian,
 +#	use=xterm-new,
  #	use=xterm-r6,
---- a/XTerm.ad.orig
-+++ b/XTerm.ad
-@@ -116,6 +116,10 @@
+Index: xterm-242/XTerm.ad
+===================================================================
+--- xterm-242.orig/XTerm.ad
++++ xterm-242/XTerm.ad
+@@ -121,6 +121,10 @@
  *tek4014*font3: 6x13
  *tek4014*fontSmall: 6x10
  
@@ -85,8 +91,10 @@ This patch by Branden Robinson.
  ! If xterm is built with a toolbar, the widget hierarchy looks like this,
  ! showing widget name / class names.  The complete menu hierarchy is built
  ! at startup because it is needed to make the layout work for the menubar:
---- a/XTerm-col.ad.orig
-+++ b/XTerm-col.ad
+Index: xterm-242/XTerm-col.ad
+===================================================================
+--- xterm-242.orig/XTerm-col.ad
++++ xterm-242/XTerm-col.ad
 @@ -7,9 +7,9 @@
  *VT100*boldColors: on
  *VT100*dynamicColors: on
diff --git a/debian/patches/901_xterm_manpage.diff b/debian/patches/901_xterm_manpage.diff
index 6fd70a5..add85a5 100644
--- a/debian/patches/901_xterm_manpage.diff
+++ b/debian/patches/901_xterm_manpage.diff
@@ -5,11 +5,11 @@ Make Debian-specific tweaks to xterm manpage:
 
 This patch by Branden Robinson and David Martínez.
 
-Index: xterm/xterm.man
+Index: xterm-242/xterm.man
 ===================================================================
---- xterm.orig/xterm.man
-+++ xterm/xterm.man
-@@ -4844,10 +4844,10 @@
+--- xterm-242.orig/xterm.man
++++ xterm-242/xterm.man
+@@ -4899,10 +4899,10 @@
  .SH FILES
  The actual pathnames given may differ on your system.
  .TP 5
diff --git a/debian/patches/902_pointermode_never.diff b/debian/patches/902_pointermode_never.diff
index 9f59d24..d6440ea 100644
--- a/debian/patches/902_pointermode_never.diff
+++ b/debian/patches/902_pointermode_never.diff
@@ -1,11 +1,11 @@
 Debian-specific tweak: the pointerMode resource is set to 0 (never)
 by default.
 
-Index: xterm/xterm.man
+Index: xterm-242/xterm.man
 ===================================================================
---- xterm.orig/xterm.man
-+++ xterm/xterm.man
-@@ -2626,11 +2626,11 @@
+--- xterm-242.orig/xterm.man
++++ xterm-242/xterm.man
+@@ -2642,11 +2642,11 @@
  .RS
  .TP 3
  0
diff --git a/debian/patches/903_windowops.diff b/debian/patches/903_windowops.diff
index a24bcf3..2cc3abb 100644
--- a/debian/patches/903_windowops.diff
+++ b/debian/patches/903_windowops.diff
@@ -1,8 +1,8 @@
-Index: xterm/xterm.man
+Index: xterm-242/xterm.man
 ===================================================================
---- xterm.orig/xterm.man
-+++ xterm/xterm.man
-@@ -1514,7 +1514,7 @@
+--- xterm-242.orig/xterm.man
++++ xterm-242/xterm.man
+@@ -1516,7 +1516,7 @@
  .B "allowWindowOps (\fPclass\fB AllowWindowOps)"
  Specifies whether extended window control sequences (as used in dtterm)
  should be allowed.
@@ -11,11 +11,11 @@ Index: xterm/xterm.man
  .TP 8
  .B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)"
  If ``true'', treat the Alt-key as if it were the Meta-key.
-Index: xterm/charproc.c
+Index: xterm-242/charproc.c
 ===================================================================
---- xterm.orig/charproc.c
-+++ xterm/charproc.c
-@@ -392,7 +392,7 @@
+--- xterm-242.orig/charproc.c
++++ xterm-242/charproc.c
+@@ -398,7 +398,7 @@
      Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, True),
      Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, False),
      Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
diff --git a/debian/patches/904_fontops.diff b/debian/patches/904_fontops.diff
index a9744c4..b4bf7f2 100644
--- a/debian/patches/904_fontops.diff
+++ b/debian/patches/904_fontops.diff
@@ -1,8 +1,8 @@
-Index: xterm/charproc.c
+Index: xterm-242/charproc.c
 ===================================================================
---- xterm.orig/charproc.c
-+++ xterm/charproc.c
-@@ -389,7 +389,7 @@
+--- xterm-242.orig/charproc.c
++++ xterm-242/charproc.c
+@@ -395,7 +395,7 @@
  static XtResource resources[] =
  {
      Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, False),
@@ -11,11 +11,11 @@ Index: xterm/charproc.c
      Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, False),
      Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, True),
      Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, False),
-Index: xterm/xterm.man
+Index: xterm-242/xterm.man
 ===================================================================
---- xterm.orig/xterm.man
-+++ xterm/xterm.man
-@@ -1472,7 +1472,7 @@
+--- xterm-242.orig/xterm.man
++++ xterm-242/xterm.man
+@@ -1474,7 +1474,7 @@
  .TP
  .B "allowFontOps (\fPclass\fB AllowFontOps)"
  Specifies whether control sequences that set/query the font should be allowed.

commit 510d58ae3f6450ce51e2b814e6fb87177d320739
Author: Julien Cristau <jcristau@debian.org>
Date:   Fri Mar 13 20:50:11 2009 +0100

    Import xterm 242

diff --git a/MANIFEST b/MANIFEST
index 1d76918..3aa34db 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-241, version xterm-241
+MANIFEST for xterm-242, version xterm-242
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/Tekproc.c b/Tekproc.c
index 25eca7c..01ae484 100644
--- a/Tekproc.c
+++ b/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.161 2009/01/26 00:19:39 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.163 2009/02/13 20:01:21 tom Exp $ */
 
 /*
  * Warning, there be crufty dragons here.
@@ -757,7 +757,7 @@ Tekparse(TekWidget tw)
 		IChar c2;
 		unsigned len = 0;
 		while ((c2 = input()) != ANSI_BEL) {
-		    if (!isprint(c2 & 0x7f)
+		    if (!isprint((int) (c2 & 0x7f))
 			|| len + 2 >= (int) sizeof(buf2))
 			break;
 		    buf2[len++] = (Char) c2;
@@ -874,7 +874,7 @@ Tinput(TekWidget tw)
 	    Panic("Tinput: malloc error (%d)\n", errno);
 	tek = tek->next;
 	tek->next = (TekLink *) 0;
-	tek->fontsize = tekscr->cur.fontsize;
+	tek->fontsize = (unsigned short) tekscr->cur.fontsize;
 	tek->count = 0;
 	tek->ptr = tek->data;
     }
@@ -997,7 +997,7 @@ TekPage(TekWidget tw)
     if (tekscr->TekGIN)
 	TekGINoff(tw);
     tek = TekRecord = &Tek0;
-    tek->fontsize = tekscr->cur.fontsize;
+    tek->fontsize = (unsigned short) tekscr->cur.fontsize;
     tek->count = 0;
     tek->ptr = tek->data;
     tek = tek->next;
@@ -1031,7 +1031,7 @@ getpoint(TekWidget tw)
     x = tekscr->cur.x;
     y = tekscr->cur.y;
     for (;;) {
-	if ((c = input()) < ' ') {	/* control character */
+	if ((c = (int) input()) < ' ') {	/* control character */
 	    unput(c);
 	    return (0);
 	}
@@ -1162,12 +1162,12 @@ AddToDraw(TekWidget tw, int x1, int y1, int x2, int y2)
 	TekFlush(tw);
     }
     lp = line_pt++;
-    lp->x1 = x1 = (int) (x1 * TekScale(tekscr) + screen->border);
-    lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(tekscr) +
-			 screen->border);
-    lp->x2 = x2 = (int) (x2 * TekScale(tekscr) + screen->border);
-    lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(tekscr) +
-			 screen->border);
+    lp->x1 = (short) (x1 * TekScale(tekscr) + screen->border);
+    lp->y1 = (short) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(tekscr) +
+		      screen->border);
+    lp->x2 = (short) (x2 * TekScale(tekscr) + screen->border);
+    lp->y2 = (short) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(tekscr) +
+		      screen->border);
     nplot++;
     TRACE(("...AddToDraw %d points\n", nplot));
 }
@@ -1596,10 +1596,10 @@ TekRealize(Widget gw,
 	args[0].value = (XtArgVal) & icon_name;
 	args[1].value = (XtArgVal) & title;
 	XtGetValues(SHELL_OF(tw), args, 2);
-	tek_icon_name = XtMalloc(strlen(icon_name) + 7);
+	tek_icon_name = XtMalloc((Cardinal) strlen(icon_name) + 7);
 	strcpy(tek_icon_name, icon_name);
 	strcat(tek_icon_name, "(Tek)");
-	tek_title = XtMalloc(strlen(title) + 7);
+	tek_title = XtMalloc((Cardinal) strlen(title) + 7);
 	strcpy(tek_title, title);
 	strcat(tek_title, "(Tek)");
 	args[0].value = (XtArgVal) tek_icon_name;
@@ -1611,7 +1611,7 @@ TekRealize(Widget gw,
 
     tek = TekRecord = &Tek0;
     tek->next = (TekLink *) 0;
-    tek->fontsize = tekscr->cur.fontsize;
+    tek->fontsize = (unsigned short) tekscr->cur.fontsize;
     tek->count = 0;
     tek->ptr = tek->data;
     Tpushback = Tpushb;
diff --git a/XTerm.ad b/XTerm.ad
index d914402..b5659fc 100644
--- a/XTerm.ad
+++ b/XTerm.ad
@@ -1,4 +1,4 @@
-! $XTermId: XTerm.ad,v 1.85 2007/11/26 18:42:37 tom Exp $
+! $XTermId: XTerm.ad,v 1.88 2009/02/13 00:14:13 tom Exp $
 
 *saveLines: 1024
 
@@ -92,6 +92,11 @@
 *fontMenu*utf8-mode*Label:	UTF-8
 *fontMenu*utf8-title*Label:	UTF-8 Titles
 
+*fontMenu*allow-tcap-ops*Label:	Allow Termcap Ops
+*fontMenu*allow-font-ops*Label:	Allow Font Ops
+*fontMenu*allow-title-ops*Label:	Allow Title Ops
+*fontMenu*allow-window-ops*Label:	Allow Window Ops
+
 *VT100.utf8Fonts.font2:	-misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1
 *VT100.utf8Fonts.font:	-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
 *VT100.utf8Fonts.font3:	-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1
@@ -187,3 +192,21 @@
 !
 ! Alternatively,
 !*on2Clicks: regex [[:alpha:]]+://([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+
+
+! vt100's and similar terminals recognize escape sequences and control
+! characters to which they reply to the host with other escape sequences,
+! to provide information.  The "resize" program uses this feature.
+!
+! In addition, xterm recognizes several escape sequences which can be used to
+! set fonts, window properties, return settings via escape sequences.  Some
+! find these useful; others are concerned with the possibility of unexpected
+! inputs.
+!
+! All of these features can be enabled or disabled via menus.
+!
+! Depending on your environment, you may wish to disable those by default by
+! uncommenting one or more of the resource settings below:
+!*allowFontOps: false
+!*allowTcapOps: false
+!*allowTitleOps: false
+!*allowWindowOps: false
diff --git a/aclocal.m4 b/aclocal.m4
index 2d45368..4cc1986 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $XTermId: aclocal.m4,v 1.257 2009/01/25 23:32:11 tom Exp $
+dnl $XTermId: aclocal.m4,v 1.258 2009/02/13 21:04:32 tom Exp $
 dnl
 dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.65 2006/06/19 00:36:50 dickey Exp $
 dnl
@@ -636,7 +636,7 @@ if test "$GCC" = yes ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 23 updated: 2008/07/26 17:54:02
+dnl CF_GCC_WARNINGS version: 24 updated: 2009/02/01 15:21:00
 dnl ---------------
 dnl Check if the compiler supports useful warning options.  There's a few that
 dnl we don't use, simply because they're too noisy:
@@ -669,7 +669,6 @@ if test "$INTEL_COMPILER" = yes
 then
 # The "-wdXXX" options suppress warnings:
 # remark #1419: external declaration in primary source file
-# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
 # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
 # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
 # remark #193: zero used for undefined preprocessing identifier
@@ -677,19 +676,18 @@ then
 # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
 # remark #869: parameter "tw" was never referenced
 # remark #981: operands are evaluated in unspecified order
-# warning #269: invalid format string conversion
+# warning #279: controlling expression is constant
 
 	AC_CHECKING([for $CC warning options])
 	cf_save_CFLAGS="$CFLAGS"
 	EXTRA_CFLAGS="-Wall"
 	for cf_opt in \
 		wd1419 \
-		wd1682 \
 		wd1683 \
 		wd1684 \
 		wd193 \
-		wd279 \
 		wd593 \
+		wd279 \
 		wd810 \
 		wd869 \
 		wd981
@@ -2338,23 +2336,21 @@ if test "$with_pcre" != no ; then
 fi
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_XKB_BELL_EXT version: 2 updated: 2003/05/18 17:28:57
+dnl CF_XKB_BELL_EXT version: 3 updated: 2009/02/13 16:00:39
 dnl ---------------
 dnl Check for XKB bell extension
 AC_DEFUN([CF_XKB_BELL_EXT],[
 AC_CACHE_CHECK(for XKB Bell extension, cf_cv_xkb_bell_ext,[
 AC_TRY_LINK([
+#include <X11/Intrinsic.h>
 #include <X11/XKBlib.h>		/* has the prototype */
 #include <X11/extensions/XKBbells.h>	/* has the XkbBI_xxx definitions */
 ],[
-int x = XkbBI_Info
-	|XkbBI_MinorError
-	|XkbBI_MajorError
-	|XkbBI_TerminalBell
-	|XkbBI_MarginBell;
+	int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell);
+	Atom y;
+	XkbBell((Display *)0, (Widget)0, 0, y);
 ],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no])
 ])
-
 test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
 ])
 dnl ---------------------------------------------------------------------------
diff --git a/button.c b/button.c
index 93ef2b0..70e8ffc 100644
--- a/button.c
+++ b/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.300 2009/01/22 23:47:52 tom Exp $ */
+/* $XTermId: button.c,v 1.306 2009/02/13 21:09:08 tom Exp $ */
 
 /*
  * Copyright 1999-2008,2009 by Thomas E. Dickey
@@ -337,7 +337,9 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
     /* update mask to "after" state */
     state ^= 1 << button;
     /* swap Button1 & Button3 */
-    state = (state & ~(4 | 1)) | ((state & 1) ? 4 : 0) | ((state & 4) ? 1 : 0);
+    state = ((state & (unsigned) ~(4 | 1))
+	     | ((state & 1) ? 4 : 0)
+	     | ((state & 4) ? 1 : 0));
 
     reply.a_param[1] = (ParmType) state;
     reply.a_param[2] = (ParmType) row;
@@ -1077,14 +1079,13 @@ static Char *
 UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
 {
     static Char *buffer;
-    static size_t used;
+    static Cardinal used;
 
     Char *q;
 
-    if (used == 0) {
-	buffer = (Char *) XtMalloc(1 + (used = len));
-    } else if (len > used) {
-	buffer = (Char *) XtRealloc((char *) buffer, 1 + (used = len));
+    if (len > used) {
+	used = 1 + (2 * len);
+	allocXtermChars(&buffer, used);
     }
 
     if (buffer != 0) {
@@ -1107,7 +1108,7 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
 		    if (eqv == value)
 			eqv = '#';
 		    *q++ = (Char) eqv;
-		    if (iswide((wchar_t) value))
+		    if (isWide((wchar_t) value))
 			*q++ = ' ';
 		}
 	    }
@@ -2247,7 +2248,7 @@ ResizeSelection(TScreen * screen GCC_UNUSED, int rows, int cols)
 Bool
 iswide(int i)
 {
-    return (i == HIDDEN_CHAR) || (my_wcwidth(i) == 2);
+    return (i == HIDDEN_CHAR) || ((i >= FIRST_WIDECHAR) && my_wcwidth(i) == 2);
 }
 
 #define isWideCell(row, col) iswide((int)XTERM_CELL(row, col))
@@ -3474,7 +3475,7 @@ _OwnSelection(XtermWidget xw,
 	    (unsigned long) (4 * XMaxRequestSize(XtDisplay((Widget) xw)) - 32);
 	    if (screen->selection_length > limit) {
 		fprintf(stderr,
-			"%s: selection too big (%ld bytes), not storing in CUT_BUFFER%d\n",
+			"%s: selection too big (%lu bytes), not storing in CUT_BUFFER%d\n",
 			xterm_name, screen->selection_length, cutbuffer);
 	    } else {
 		/* This used to just use the UTF-8 data, which was totally
@@ -3613,7 +3614,7 @@ SaveText(TScreen * screen,
 	/* We want to strip out every occurrence of HIDDEN_CHAR AFTER a
 	 * wide character.
 	 */
-	if (c == HIDDEN_CHAR && iswide((int) previous)) {
+	if (c == HIDDEN_CHAR && isWide((int) previous)) {
 	    previous = c;
 	    /* Combining characters attached to double-width characters
 	       are in memory attached to the HIDDEN_CHAR */
diff --git a/cachedGCs.c b/cachedGCs.c
index 70dac4a..88819fc 100644
--- a/cachedGCs.c
+++ b/cachedGCs.c
@@ -1,8 +1,8 @@
-/* $XTermId: cachedGCs.c,v 1.49 2008/12/30 17:33:30 tom Exp $ */
+/* $XTermId: cachedGCs.c,v 1.51 2009/02/13 00:37:46 tom Exp $ */
 
 /************************************************************
 
-Copyright 2007,2008 by Thomas E. Dickey
+Copyright 2007-2008,2009 by Thomas E. Dickey
 
                         All Rights Reserved
 
@@ -71,6 +71,8 @@ typedef struct {
 #define THIS(field) me->data->field
 #define NEXT(field) me->next.field
 
+#define HaveFont(font) (Boolean) ((font) != 0 && (font)->fs != 0)
+
 #define GC_CSet GCFunction
 
 typedef struct {
@@ -163,9 +165,9 @@ static String
 traceFont(XTermFonts * font)
 {
     static char result[80];
-    XFontStruct *fs;
 
-    if (font != 0 && (fs = font->fs) != 0) {
+    if (HaveFont(font)) {
+	XFontStruct *fs = font->fs;
 	sprintf(result, "%p(%dx%d %d %#lx)",
 		fs,
 		fs->max_bounds.width,
@@ -394,12 +396,6 @@ newCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, CgsCache * me)
 }
 
 static Boolean
-HaveFont(XTermFonts * a)
-{
-    return (Boolean) (a != 0 && a->fs != 0);
-}
-
-static Boolean
 SameFont(XTermFonts * a, XTermFonts * b)
 {
     return (Boolean) (HaveFont(a)
@@ -412,7 +408,7 @@ SameFont(XTermFonts * a, XTermFonts * b)
 #define SameCSet(a,b)  ((a) == (b))
 
 static GC
-chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me)
+chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me, Bool both)
 {
     XGCValues xgcv;
     XtGCMask mask = (GCForeground | GCBackground | GCFont);
@@ -436,8 +432,10 @@ chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me)
 	TRACE2(("...chgCache new bg=%s\n", tracePixel(xw, NEXT(bg))));
 #endif
 
-    THIS(font) = NEXT(font);
-    THIS(cset) = NEXT(cset);
+    if (both) {
+	THIS(font) = NEXT(font);
+	THIS(cset) = NEXT(cset);
+    }
     THIS(fg) = NEXT(fg);
     THIS(bg) = NEXT(bg);
 
@@ -514,7 +512,7 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font)
 #endif
 		font = &(xw->screen.fnts[fNorm]);
 	}
-	if (okFont(font->fs) && !SameFont(NEXT(font), font)) {
+	if (HaveFont(font) && okFont(font->fs) && !SameFont(NEXT(font), font)) {
 	    TRACE2(("...updated next font for %s to %s\n",
 		    traceCgsEnum(cgsId), traceFont(font)));
 	    TRACE2(("...next font was %s\n", traceFont(NEXT(font))));
@@ -638,7 +636,7 @@ getCgsGC(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId)
 		}
 		LINK(k);
 		TRACE(("...getCgsGC least-used(%d) was %d\n", k, THIS(used)));
-		result = chgCache(xw, cgsId, me);
+		result = chgCache(xw, cgsId, me, True);
 	    }
 	    me->next = *(me->data);
 	} else {
@@ -776,7 +774,7 @@ redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId)
 	CgsCacheData *save_data = me->data;
 
 	for (n = 0; n < DEPTH; ++n) {
-	    if (LIST(n).gc != 0) {
+	    if (LIST(n).gc != 0 && HaveFont(LIST(n).font)) {
 		LINK(n);
 
 		if (LIST(n).fg == fg
@@ -791,7 +789,7 @@ redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId)
 		    continue;
 		}
 
-		(void) chgCache(xw, cgsId, me);
+		(void) chgCache(xw, cgsId, me, False);
 	    }
 	}
 	me->data = save_data;
diff --git a/charproc.c b/charproc.c
index 8eb9ce8..97e1c9d 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.869 2009/01/26 20:50:58 Jeff.Chua Exp $ */
+/* $XTermId: charproc.c,v 1.892 2009/02/13 21:15:35 tom Exp $ */
 
 /*
 
@@ -317,6 +317,12 @@ static XtActionsRec actionsList[] = {
 #ifdef ALLOWLOGGING
     { "set-logging",		HandleLogging },
 #endif
+#if OPT_ALLOW_XXX_OPS
+    { "allow-font-ops",		HandleAllowFontOps },
+    { "allow-tcap-ops",		HandleAllowTcapOps },
+    { "allow-title-ops",	HandleAllowTitleOps },
+    { "allow-window-ops",	HandleAllowWindowOps },
+#endif
 #if OPT_BLINK_CURS
     { "set-cursorblink",	HandleCursorBlink },
 #endif
@@ -448,6 +454,7 @@ static XtResource resources[] =
     Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, False),
 
     Ires(XtNbellSuppressTime, XtCBellSuppressTime, screen.bellSuppressTime, BELLSUPPRESSMSEC),
+    Ires(XtNfontWarnings, XtCFontWarnings, misc.fontWarnings, fwResource),
     Ires(XtNinternalBorder, XtCBorderWidth, screen.border, DEFBORDER),
     Ires(XtNlimitResize, XtCLimitResize, misc.limit_resize, 1),
     Ires(XtNmultiClickTime, XtCMultiClickTime, screen.multiClickTime, MULTICLICKTIME),
@@ -825,6 +832,42 @@ xtermAddInput(Widget w)
 }
 
 #if OPT_ISO_COLORS
+static Bool
+CheckBogusForeground(TScreen * screen, const char *tag)
+{
+    int row = -1, col = -1, pass;
+    Bool isClear = True;
+
+    (void) tag;
+    for (pass = 0; pass < 2; ++pass) {
+	row = screen->cur_row;
+	for (; isClear && (row <= screen->max_row); ++row) {
+	    col = (row == screen->cur_row) ? screen->cur_col : 0;
+	    for (; isClear && (col <= screen->max_col); ++col) {
+		unsigned flags = SCRN_BUF_ATTRS(screen, row)[col];
+		if (pass) {
+		    flags &= ~FG_COLOR;
+		    SCRN_BUF_ATTRS(screen, row)[col] = (Char) flags;
+		} else if ((flags & BG_COLOR)) {
+		    isClear = False;
+		} else if ((flags & FG_COLOR)) {
+		    unsigned ch = getXtermCell(screen, row, col);
+		    isClear = ((ch == ' ') || (ch == 0));
+		} else {
+		    isClear = False;
+		}
+	    }
+	}
+    }
+    TRACE(("%s checked %d,%d to %d,%d %s pass %d\n",
+	   tag, screen->cur_row, screen->cur_col,
+	   row, col,
+	   isClear && pass ? "cleared" : "unchanged",
+	   pass));
+
+    return isClear;
+}
+
 /*
  * The terminal's foreground and background colors are set via two mechanisms:
  *	text (cur_foreground, cur_background values that are passed down to
@@ -850,6 +893,19 @@ SGR_Foreground(XtermWidget xw, int color)
 
     setCgsFore(xw, WhichVWin(screen), gcBold, fg);
     setCgsBack(xw, WhichVWin(screen), gcBoldReverse, fg);
+
+    /*
+     * If we've just turned off the foreground color, check for blank cells
+     * which have no background color, but do have foreground color.  This
+     * could happen due to setting the foreground color just before scrolling.
+     *
+     * Those cells look uncolored, but will confuse ShowCursor(), which looks
+     * for the colors in the current cell, and will see the foreground color. 
+     * In that case, remove the foreground color from the blank cells.
+     */
+    if (color < 0) {
+	CheckBogusForeground(screen, "SGR_Foreground");
+    }
 }
 
 void
@@ -1224,6 +1280,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 
     do {
 #if OPT_WIDE_CHARS
+	int this_is_wide = 0;
 
 	/*
 	 * Handle zero-width combining characters.  Make it faster by noting
@@ -1421,7 +1478,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 	 * If this character is a different width than the last one, put the
 	 * previous text into the buffer and draw it now.
 	 */
-	if (iswide((int) c) != sp->last_was_wide) {
+	this_is_wide = isWide((int) c);
+	if (this_is_wide != sp->last_was_wide) {
 	    WriteNow();
 	}
 #endif
@@ -1452,7 +1510,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 	    print_area[print_used++] = c;
 	    sp->lastchar = thischar = (int) c;
 #if OPT_WIDE_CHARS
-	    sp->last_was_wide = iswide((int) c);
+	    sp->last_was_wide = this_is_wide;
 #endif
 	    if (morePtyData(screen, VTbuffer)) {
 		continue;
@@ -2852,7 +2910,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
 
 	case CASE_XTERM_WINOPS:
 	    TRACE(("CASE_XTERM_WINOPS\n"));
-	    if (screen->allowWindowOps)
+	    if (AllowWindowOps(xw))
 		window_ops(xw);
 	    sp->parsestate = sp->groundtable;
 	    break;
@@ -2964,7 +3022,7 @@ v_write(int f, Char * data, unsigned len)
     unsigned c = len;
 
     if (v_bufstr == NULL && len > 0) {
-	v_buffer = (Char *) XtMalloc(len);
+	v_buffer = (Char *) XtMalloc((Cardinal) len);
 	v_bufstr = v_buffer;
 	v_bufptr = v_buffer;
 	v_bufend = v_buffer + len;
@@ -3506,41 +3564,7 @@ dotext(XtermWidget xw,
 	 * buffers (perhaps this is simpler).
 	 */
 	if (chars_chomped != 0 && next_col <= screen->max_col) {
-	    static unsigned limit;
-	    static Char *hibyte, *lobyte;
-	    Bool both = False;
-	    unsigned j, k;
-
-	    if (chars_chomped >= limit) {
-		limit = (chars_chomped + 1) * 2;
-		lobyte = (Char *) XtRealloc((char *) lobyte, limit);
-		hibyte = (Char *) XtRealloc((char *) hibyte, limit);
-	    }
-	    for (j = offset, k = 0; j < offset + chars_chomped; j++) {
-		if (buf[j] == HIDDEN_CHAR)
-		    continue;
-		lobyte[k] = LO_BYTE(buf[j]);
-		if (buf[j] > 255) {
-		    hibyte[k] = HI_BYTE(buf[j]);
-		    both = True;
-		} else {
-		    hibyte[k] = 0;
-		}
-		++k;
-	    }
-
-	    WriteText(xw, PAIRED_CHARS(lobyte,
-				       (both ? hibyte : 0)),
-		      k);
-#ifdef NO_LEAKS
-	    if (limit != 0) {
-		limit = 0;
-		XtFree((char *) lobyte);
-		XtFree((char *) hibyte);
-		lobyte = 0;
-		hibyte = 0;
-	    }
-#endif
+	    WriteText(xw, buf + offset, chars_chomped);
 	}
 	next_col += width_here;
 	screen->do_wrap = need_wrap;
@@ -3564,9 +3588,7 @@ dotext(XtermWidget xw,
 	}
 	next_col = screen->cur_col + this_col;
 
-	WriteText(xw, PAIRED_CHARS(buf + offset,
-				   buf2 ? buf2 + offset : 0),
-		  (unsigned) this_col);
+	WriteText(xw, buf + offset, (unsigned) this_col);
 
 	/*
 	 * The call to WriteText updates screen->cur_col.
@@ -3581,20 +3603,14 @@ dotext(XtermWidget xw,
 
 #if OPT_WIDE_CHARS
 unsigned
-visual_width(PAIRED_CHARS(Char * str, Char * str2), Cardinal len)
+visual_width(IChar * str, Cardinal len)
 {
     /* returns the visual width of a string (doublewide characters count
        as 2, normalwide characters count as 1) */
     unsigned my_len = 0;
     while (len) {
-	int ch = *str;
-	if (str2)
-	    ch |= *str2 << 8;
-	if (str)
-	    str++;
-	if (str2)
-	    str2++;
-	if (iswide(ch))
+	int ch = (int) *str++;
+	if (isWide(ch))
 	    my_len += 2;
 	else
 	    my_len++;
@@ -3636,7 +3652,7 @@ HandleStructNotify(Widget w GCC_UNUSED,
 		    return;
 		}
 		strcpy(buf, icon_name + 4);
-		ChangeIconName(buf);
+		ChangeIconName(xw, buf);
 		free(buf);
 	    }
 	}
@@ -5607,7 +5623,14 @@ VTInitialize(Widget wrequest,
     for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) {
 	init_Sres2(screen.MenuFontName, i);
     }
-    wnew->screen.MenuFontName(fontMenu_default) = wnew->misc.default_font.f_n;
+    init_Ires(misc.fontWarnings);
+#define DefaultFontNames wnew->screen.menu_font_names[fontMenu_default]
+    DefaultFontNames[fNorm] = wnew->misc.default_font.f_n;
+    DefaultFontNames[fBold] = wnew->misc.default_font.f_b;
+#if OPT_WIDE_CHARS
+    DefaultFontNames[fWide] = wnew->misc.default_font.f_w;
+    DefaultFontNames[fWBold] = wnew->misc.default_font.f_wb;
+#endif
     wnew->screen.MenuFontName(fontMenu_fontescape) = NULL;
     wnew->screen.MenuFontName(fontMenu_fontsel) = NULL;
 
@@ -6801,6 +6824,7 @@ ShowCursor(void)
     XtermWidget xw = term;
     TScreen *screen = &xw->screen;
     int x, y;
+    int base;
     Char clo;
     unsigned flags;
     unsigned fg_bg = 0;
@@ -6822,7 +6846,6 @@ ShowCursor(void)
 #endif
 #if OPT_WIDE_CHARS
     Char chi = 0;
-    int base;
     int off;
     int my_col = 0;
 #endif
@@ -6848,10 +6871,9 @@ ShowCursor(void)
     }
 #endif /* NO_ACTIVE_ICON */
 
-#if OPT_WIDE_CHARS
     base =
-#endif
 	clo = SCRN_BUF_CHARS(screen, screen->cursorp.row)[cursor_col];
+    flags = SCRN_BUF_ATTRS(screen, screen->cursorp.row)[cursor_col];
 
     if_OPT_WIDE_CHARS(screen, {
 	chi = SCRN_BUF_WIDEC(screen, screen->cursorp.row)[cursor_col];
@@ -6865,31 +6887,31 @@ ShowCursor(void)
 	}
 	my_col = cursor_col;
 	base = (chi << 8) | clo;
-	if (iswide(base))
+	if (base == 0)
+	    base = clo = ' ';
+	if (isWide(base))
 	    my_col += 1;
     });
 
-    flags = SCRN_BUF_ATTRS(screen, screen->cursorp.row)[cursor_col];
-
-    if (clo == 0
-#if OPT_WIDE_CHARS
-	&& chi == 0
-#endif
-	) {
-	clo = ' ';
+    if (base == 0) {
+	base = clo = ' ';
     }
 
     /*
-     * If the cursor happens to be on blanks, and the foreground color is set
-     * but not the background, do not treat it as a colored cell.
+     * If the cursor happens to be on blanks, and we have not set both
+     * foreground and background color, do not treat it as a colored cell.
      */
 #if OPT_ISO_COLORS
-    if ((flags & TERM_COLOR_FLAGS(xw)) == BG_COLOR
-#if OPT_WIDE_CHARS
-	&& chi == 0
-#endif
-	&& clo == ' ') {
-	flags &= ~TERM_COLOR_FLAGS(xw);
+    if (base == ' ') {
+	if ((flags & (FG_COLOR | BG_COLOR)) == BG_COLOR) {
+	    TRACE(("ShowCursor - do not treat as a colored cell\n"));
+	    flags &= ~(FG_COLOR | BG_COLOR);
+	} else if ((flags & (FG_COLOR | BG_COLOR)) == FG_COLOR) {
+	    TRACE(("ShowCursor - should we treat as a colored cell?\n"));
+	    if (!(xw->flags & FG_COLOR))
+		if (CheckBogusForeground(screen, "ShowCursor"))
+		    flags &= ~(FG_COLOR | BG_COLOR);
+	}
     }
 #endif
 
@@ -7007,9 +7029,9 @@ ShowCursor(void)
 	&& (screen->cursor_state != ON || screen->cursor_GC != set_at)) {
 
 	screen->cursor_GC = set_at;
-	TRACE(("ShowCursor calling drawXtermText cur(%d,%d) %s\n",
+	TRACE(("ShowCursor calling drawXtermText cur(%d,%d) %s, set_at %d\n",
 	       screen->cur_row, screen->cur_col,
-	       (filled ? "filled" : "outline")));
+	       (filled ? "filled" : "outline"), set_at));
 
 	currentGC = getCgsGC(xw, currentWin, currentCgs);
 	drawXtermText(xw, flags & DRAWX_MASK, currentGC,
@@ -7028,7 +7050,7 @@ ShowCursor(void)
 		drawXtermText(xw, (flags & DRAWX_MASK) | NOBACKGROUND,
 			      currentGC, x, y,
 			      curXtermChrSet(xw, screen->cur_row),
-			      PAIRED_CHARS(&clo, &chi), 1, iswide(base));
+			      PAIRED_CHARS(&clo, &chi), 1, isWide(base));
 	    }
 	});
 #endif
@@ -7059,14 +7081,14 @@ HideCursor(void)
     XtermWidget xw = term;
     TScreen *screen = &xw->screen;
     GC currentGC;
-    unsigned flags;
-    unsigned fg_bg = 0;
     int x, y;
+    int base;
     Char clo;
+    unsigned flags;
+    unsigned fg_bg = 0;
     Bool in_selection;


Reply to: