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

xterm: Changes to 'upstream-unstable'



 MANIFEST       |    2 
 Tekproc.c      |   28 +-
 XTerm.ad       |   25 ++
 aclocal.m4     |   22 --
 button.c       |   23 +-
 cachedGCs.c    |   32 +--
 charproc.c     |  235 +++++++++++++---------
 configure      |  588 ++++++++++++++++++++++++++++-----------------------------
 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 +++++++--
 24 files changed, 1282 insertions(+), 767 deletions(-)

New commits:
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;
 #if OPT_WIDE_CHARS
     Char chi = 0;
-    int base;
     int off;
     int my_col = 0;
 #endif
@@ -7086,15 +7108,13 @@ HideCursor(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];
-	if (clo == HIDDEN_LO && chi == HIDDEN_HI) {
+	if (clo == HIDDEN_LO && chi == HIDDEN_HI && cursor_col > 0) {
 	    /* if cursor points to non-initial part of wide character,
 	     * back it up
 	     */
@@ -7104,10 +7124,38 @@ HideCursor(void)
 	}
 	my_col = cursor_col;
 	base = (chi << 8) | clo;
-	if (iswide(base))
+	if (base == 0)
+	    base = clo = ' ';
+	if (isWide(base))
 	    my_col += 1;
     });
 
+    if (base == 0) {
+	base = clo = ' ';
+    }
+
+    /*
+     * 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 (base == ' ') {
+	if ((flags & (FG_COLOR | BG_COLOR)) == BG_COLOR) {
+	    TRACE(("HideCursor - do not treat as a colored cell\n"));
+	    flags &= ~(FG_COLOR | BG_COLOR);
+	} else if ((flags & (FG_COLOR | BG_COLOR)) == FG_COLOR) {
+	    TRACE(("HideCursor - should we treat as a colored cell?\n"));
+	    if (!(xw->flags & FG_COLOR))
+		if (CheckBogusForeground(screen, "HideCursor"))
+		    flags &= ~(FG_COLOR | BG_COLOR);
+	}
+    }
+#endif
+
+    /*
+     * Compare the current cell to the last set of colors used for the
+     * cursor and update the GC's if needed.
+     */
     if_OPT_EXT_COLORS(screen, {
 	fg_bg = PACK_FGBG(screen, screen->cursorp.row, cursor_col);
     });
@@ -7122,14 +7170,6 @@ HideCursor(void)
 
     currentGC = updatedXtermGC(xw, flags, fg_bg, in_selection);
 
-    if (clo == 0
-#if OPT_WIDE_CHARS
-	&& chi == 0
-#endif
-	) {
-	clo = ' ';
-    }
-
     TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n",
 	   screen->cursorp.row, screen->cursorp.col));
     drawXtermText(xw, flags & DRAWX_MASK, currentGC,
@@ -7148,7 +7188,7 @@ HideCursor(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
@@ -7687,6 +7727,7 @@ DoSetSelectedFont(Widget w,
 void
 FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
 {
+    TScreen *screen = &(xw->screen);
     static AtomPtr *atoms;
     unsigned int atomCount = 0;
     AtomPtr *pAtom;
@@ -7694,8 +7735,8 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
     Atom target;
 
     if (!atom_name)
-	atom_name = (xw->screen.mappedSelect
-		     ? xw->screen.mappedSelect[0]
+	atom_name = (screen->mappedSelect
+		     ? screen->mappedSelect[0]
 		     : "PRIMARY");
     TRACE(("FindFontSelection(%s)\n", atom_name));
 
@@ -7711,8 +7752,10 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
 
     target = XmuInternAtom(XtDisplay(xw), *pAtom);
     if (justprobe) {
-	xw->screen.MenuFontName(fontMenu_fontsel) =
+	screen->MenuFontName(fontMenu_fontsel) =
 	    XGetSelectionOwner(XtDisplay(xw), target) ? _Font_Selected_ : 0;
+	TRACE(("...selected fontname '%s'\n",
+	       NonNull(screen->MenuFontName(fontMenu_fontsel))));
     } else {
 	XtGetSelectionValue((Widget) xw, target, XA_STRING,
 			    DoSetSelectedFont, NULL,
diff --git a/configure b/configure
index fd75bd3..d174939 100755
--- a/configure
+++ b/configure
@@ -9203,6 +9203,7 @@ cat >conftest.$ac_ext <<_ACEOF
 #line 9203 "configure"
 #include "confdefs.h"
 
+#include <X11/Intrinsic.h>
 #include <X11/XKBlib.h>		/* has the prototype */
 #include <X11/extensions/XKBbells.h>	/* has the XkbBI_xxx definitions */
 
@@ -9210,27 +9211,25 @@ int
 main ()
 {
 
-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);
 
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9224: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9223: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9227: \$? = $ac_status" >&5
+  echo "$as_me:9226: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9230: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9229: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9233: \$? = $ac_status" >&5
+  echo "$as_me:9232: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   cf_cv_xkb_bell_ext=yes
 else
@@ -9241,9 +9240,8 @@ fi
 rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 fi
-echo "$as_me:9244: result: $cf_cv_xkb_bell_ext" >&5
+echo "$as_me:9243: result: $cf_cv_xkb_bell_ext" >&5
 echo "${ECHO_T}$cf_cv_xkb_bell_ext" >&6
-
 test "$cf_cv_xkb_bell_ext" = yes && cat >>confdefs.h <<\EOF
 #define HAVE_XKB_BELL_EXT 1
 EOF
@@ -9251,13 +9249,13 @@ EOF
 for ac_func in Xutf8LookupString
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:9254: checking for $ac_func" >&5
+echo "$as_me:9252: checking for $ac_func" >&5
 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
 if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line 9260 "configure"
+#line 9258 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.  */
@@ -9288,16 +9286,16 @@ f = $ac_func;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:9291: \"$ac_link\"") >&5
+if { (eval echo "$as_me:9289: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:9294: \$? = $ac_status" >&5
+  echo "$as_me:9292: \$? = $ac_status" >&5
   (exit $ac_status); } &&
          { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:9297: \"$ac_try\"") >&5
+  { (eval echo "$as_me:9295: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:9300: \$? = $ac_status" >&5
+  echo "$as_me:9298: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   eval "$as_ac_var=yes"
 else


Reply to: