Hi,

The patch below updates xterm to version 378. As always testing
(especially for specific use cases) is welcome.

Apply in /usr/xenocara/app/xterm and rebuild xterm

doas make obj
doas make build

     Patch #378 - 2023/01/09

     * improve descriptions of XTQMODKEYS and XTQALLOWED features in
       ctlseqs.ms (reports by Bram Moolenaar, Thomas Wolff).
     * add bracketed+paste and report+version building blocks to terminfo,
       from ncurses 6.4
     * improve check for unsupported formatting characters, e.g.,
       zero-width space, to properly ignore them (report by Thomas Wolff).
     * improve/document error-checking for some of the controls which
       return responses: DECRQSS, XTGETXRES, XTSETTCAP, XTGETTCAP
       (prompted by discussion with David Leadbeater).
     * improve limit-checks for fallback font cache (report by Dimitrije
       Erdeljan).
     * improve check for too-wide glyph in fallback font by allowing
       xterm to continue searching for a suitable font rather than just
       failing on the first. Also add limitFontWidth to allow changing
       the amount by which a glyph must extend outside the font's bounding
       box to disallow it.

     Patch #377 - 2022/11/25

     * add control sequences for reporting the current state of the
       modified keys options (XTQMODKEYS) and allowed/disallowed
       operations (XTQALLOWED), (prompted by discussion with Bram Moolenaar).
     * amend modifyOtherKeys case 2 to distinguish the escape character
       with modifiers, e.g., shift-escape, from a plain escape character
       (suggested by Bram Moolenaar).
     * improve parsing and error-recovery in the case where a list of X11
       bitmap fonts is given in the -fn and related options.
     * change default for xftTrackMemUsage to false, because libXft does
       not handle certain fonts.

     Patch #376 - 2022/11/16

     * modify configure script to always check for gcc attributes,
     * update install-sh.
     * fix parsing of result -u in vttests/halves.pl.
     * add a note in ctlseqs.ms about compatibility of TBC.
     * fix a copy/paste error in manual (patch by Grady Martin).
     * add null-pointer checks in x_strcasecmp and x_strncasecmp, to help
       with error-recovery for a missing font (Debian #1022942).

Index: COPYING
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/COPYING,v
retrieving revision 1.4
diff -u -p -u -r1.4 COPYING
--- COPYING     25 Apr 2022 19:20:37 -0000      1.4
+++ COPYING     28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
---- $XTermId: COPYING,v 1.5 2022/01/30 19:30:32 tom Exp $
+--- $XTermId: COPYING,v 1.6 2023/01/02 15:46:55 tom Exp $
 -------------------------------------------------------------------------------
 
-Copyright 1996-2021,2022 by Thomas E. Dickey
+Copyright 1996-2022,2023 by Thomas E. Dickey
 
                         All Rights Reserved
 
Index: MANIFEST
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/MANIFEST,v
retrieving revision 1.52
diff -u -p -u -r1.52 MANIFEST
--- MANIFEST    9 Nov 2022 21:55:14 -0000       1.52
+++ MANIFEST    28 Jan 2023 17:16:53 -0000
@@ -1,4 +1,4 @@
-MANIFEST for xterm, version xterm-375
+MANIFEST for xterm, version xterm-378
 
--------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
Index: NEWS
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/NEWS,v
retrieving revision 1.12
diff -u -p -u -r1.12 NEWS
--- NEWS        9 Nov 2022 21:55:15 -0000       1.12
+++ NEWS        28 Jan 2023 17:16:53 -0000
@@ -1,13 +1,22 @@
 The NEWS file was generated from xterm.log.html, which serves as the changelog
 for xterm.
 
--------------------------------------------------------------------------------
-                            Patch #375 - 2022/10/23
+                            Patch #378 - 2023/01/09
 
-     * improve  error-recovery  when  setting  a bitmap font for the VT100
-       window,  e.g.,  in  case  OSC 50  failed, restoring the most recent
-       valid  font  so  that  a  subsequent  OSC 50 reports this correctly
-       (report by David Leadbeater).
-     * exclude  MC_XDG_OPEN  from environment variables trimmed on startup
-       (report by Gabor Hauzer).
-     * check for null pointer in isSelect() (report by Column Paget).
+     * improve  descriptions  of  XTQMODKEYS  and  XTQALLOWED  features in
+       ctlseqs.ms (reports by Bram Moolenaar, Thomas Wolff).
+     * add bracketed+paste and report+version building blocks to terminfo,
+       from ncurses 6.4
+     * improve   check   for   unsupported  formatting  characters,  e.g.,
+       zero-width space, to properly ignore them (report by Thomas Wolff).
+     * improve/document  error-checking  for  some  of  the controls which
+       return   responses:   DECRQSS,   XTGETXRES,   XTSETTCAP,  XTGETTCAP
+       (prompted by discussion with David Leadbeater).
+     * improve  limit-checks  for fallback font cache (report by Dimitrije
+       Erdeljan).
+     * improve check for too-wide glyph in fallback font by allowing xterm
+       to  continue searching for a suitable font rather than just failing
+       on  the first. Also add limitFontWidth to allow changing the amount
+       by  which  a  glyph  must extend outside the font's bounding box to
+       disallow it.
 
Index: THANKS
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/THANKS,v
retrieving revision 1.19
diff -u -p -u -r1.19 THANKS
--- THANKS      7 Nov 2022 11:15:27 -0000       1.19
+++ THANKS      28 Jan 2023 17:16:53 -0000
@@ -1,4 +1,4 @@
--- $XTermId: THANKS,v 1.35 2022/09/12 21:10:13 tom Exp $
+-- $XTermId: THANKS,v 1.36 2022/11/17 00:49:53 tom Exp $
 -- vile:txtmode fk=utf-8
 There's no AUTHORS file in this distribution; it would be redundant since
 I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996.
@@ -95,6 +95,7 @@ George Kouryachy
 George Nachman
 George Peter Staplin
 Gertjan Halkes
+Grady Martin
 Greg Badros
 Greg Klanderman
 Greg Smith
Index: VTPrsTbl.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/VTPrsTbl.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 VTPrsTbl.c
--- VTPrsTbl.c  25 Apr 2022 19:20:37 -0000      1.18
+++ VTPrsTbl.c  28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: VTPrsTbl.c,v 1.104 2021/12/26 17:50:25 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.106 2022/11/25 01:19:18 tom Exp $ */
 
 /*
- * Copyright 1999-2020,2021 by Thomas E. Dickey
+ * Copyright 1999-2021,2022 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -3478,7 +3478,7 @@ CASE_GROUND_STATE,
 CASE_GROUND_STATE,
 /*     l               m               n               o       */
 CASE_DECRST,
-CASE_GROUND_STATE,
+CASE_XTERM_REPORT_MOD_FKEYS,
 CASE_DSR,
 CASE_GROUND_STATE,
 /*     p               q               r               s       */
@@ -3638,7 +3638,7 @@ CASE_GROUND_STATE,
 CASE_GROUND_STATE,
 /*      igrave          iacute          icircumflex     idiaeresis      */
 CASE_DECRST,
-CASE_GROUND_STATE,
+CASE_XTERM_REPORT_MOD_FKEYS,
 CASE_DSR,
 CASE_GROUND_STATE,
 /*      eth             ntilde          ograve          oacute          */
Index: VTparse.def
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/VTparse.def,v
retrieving revision 1.14
diff -u -p -u -r1.14 VTparse.def
--- VTparse.def 25 Apr 2022 19:20:37 -0000      1.14
+++ VTparse.def 28 Jan 2023 17:16:53 -0000
@@ -1,10 +1,10 @@
-# $XTermId: VTparse.def,v 1.65 2021/12/26 17:49:45 tom Exp $
+# $XTermId: VTparse.def,v 1.66 2022/11/24 13:58:46 tom Exp $
 #
 # vile:confmode rs=lf
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1996-2020,2021 by Thomas E. Dickey
+# Copyright 1996-2021,2022 by Thomas E. Dickey
 # 
 #                         All Rights Reserved
 # 
@@ -220,3 +220,4 @@ CASE_XTERM_POP_COLORS               # XTPOPCOLORS
 CASE_XTERM_SHIFT_ESCAPE                # XTSHIFTESCAPE
 CASE_DECSSDT
 CASE_DECSASD
+CASE_XTERM_REPORT_MOD_FKEYS    # XTQMODKEYS
Index: button.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/button.c,v
retrieving revision 1.46
diff -u -p -u -r1.46 button.c
--- button.c    9 Nov 2022 21:55:15 -0000       1.46
+++ button.c    28 Jan 2023 17:16:53 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.645 2022/10/23 22:59:52 tom Exp $ */
+/* $XTermId: button.c,v 1.646 2022/11/25 00:26:32 tom Exp $ */
 
 /*
  * Copyright 1999-2021,2022 by Thomas E. Dickey
@@ -2555,7 +2555,7 @@ removeControls(XtermWidget xw, char *val
            int ch = CharOf(value[src++]);
 
 #define ReplacePaste(n) \
-           if (screen->disallow_paste_controls[n]) \
+           if (screen->disallow_paste_ops[n]) \
                value[dst] = ' '
 
            if (ch < 32) {
Index: charclass.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/charclass.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 charclass.c
--- charclass.c 7 Nov 2022 11:15:27 -0000       1.9
+++ charclass.c 28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: charclass.c,v 1.45 2022/09/23 23:28:44 tom Exp $ */
+/* $XTermId: charclass.c,v 1.46 2023/01/04 09:26:46 tom Exp $ */
 
 /*
- * Copyright 2002-2021,2022 by Thomas E. Dickey
+ * Copyright 2002-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -77,20 +77,6 @@ static struct classentry {
     int first;
     int last;
 } *classtab;
-
-typedef enum {
-    IDENT = -1,
-    OTHER = 0,
-    CNTRL = 1,
-    ALNUM = 48,
-    BLANK = 32,
-    U_CJK = 0x4e00,
-    U_SUP = 0x2070,
-    U_SUB = 0x2080,
-    U_HIR = 0x3040,
-    U_KAT = 0x30a0,
-    U_HAN = 0xac00
-} Classes;
 
 #ifdef TEST_DRIVER
 static int opt_all;
Index: charclass.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/charclass.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 charclass.h
--- charclass.h 10 Jan 2021 09:23:57 -0000      1.3
+++ charclass.h 28 Jan 2023 17:16:53 -0000
@@ -1,9 +1,53 @@
-/* $XTermId: charclass.h,v 1.8 2020/01/18 18:29:41 tom Exp $ */
+/* $XTermId: charclass.h,v 1.9 2023/01/04 09:28:05 tom Exp $ */
 
 /* $XFree86: xc/programs/xterm/charclass.h,v 1.3 2006/02/13 01:14:58 dickey 
Exp $ */
 
+/*
+ * Copyright 2006-2020,2023 by Thomas E. Dickey
+ *
+ *                         All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization.
+ */
+
 #ifndef CHARCLASS_H
 #define CHARCLASS_H
+
+typedef enum {
+    IDENT = -1,
+    OTHER = 0,
+    CNTRL = 1,
+    ALNUM = 48,
+    BLANK = 32,
+    U_CJK = 0x4e00,
+    U_SUP = 0x2070,
+    U_SUB = 0x2080,
+    U_HIR = 0x3040,
+    U_KAT = 0x30a0,
+    U_HAN = 0xac00
+} Classes;
 
 extern void init_classtab(void);
 /* initialise the table. needs calling before either of the 
Index: charproc.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/charproc.c,v
retrieving revision 1.55
diff -u -p -u -r1.55 charproc.c
--- charproc.c  10 Nov 2022 18:19:23 -0000      1.55
+++ charproc.c  28 Jan 2023 17:17:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: charproc.c,v 1.1908 2022/10/23 20:34:18 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1924 2023/01/09 00:26:45 tom Exp $ */
 
 /*
- * Copyright 1999-2021,2022 by Thomas E. Dickey
+ * Copyright 1999-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -538,7 +538,7 @@ static XtResource xterm_resources[] =
     Sres(XtNdisallowedMouseOps, XtCDisallowedMouseOps,
         screen.disallowedMouseOps, DEF_DISALLOWED_MOUSE),
     Sres(XtNdisallowedPasteControls, XtCDisallowedPasteControls,
-        screen.disallowedPasteControls, DEF_DISALLOWED_PASTE_CONTROLS),
+        screen.disallowedPasteOps, DEF_DISALLOWED_PASTE_CONTROLS),
     Sres(XtNdisallowedTcapOps, XtCDisallowedTcapOps,
         screen.disallowedTcapOps, DEF_DISALLOWED_TCAP),
     Sres(XtNdisallowedWindowOps, XtCDisallowedWindowOps,
@@ -838,6 +838,7 @@ static XtResource xterm_resources[] =
     Sres(XtNfaceName, XtCFaceName, misc.default_xft.f_n, DEFFACENAME),
     Sres(XtNrenderFont, XtCRenderFont, misc.render_font_s, "default"),
     Ires(XtNlimitFontsets, XtCLimitFontsets, misc.limit_fontsets, 
DEF_XFT_CACHE),
+    Ires(XtNlimitFontWidth, XtCLimitFontWidth, misc.limit_fontwidth, 10),
 #if OPT_RENDERWIDE
     Sres(XtNfaceNameDoublesize, XtCFaceNameDoublesize, misc.default_xft.f_w, 
DEFFACENAME),
 #endif
@@ -1381,40 +1382,6 @@ set_max_row(TScreen *screen, int rows)
     screen->max_row = rows;
 }
 
-#if OPT_MOD_FKEYS
-static void
-set_mod_fkeys(XtermWidget xw, int which, int what, Bool enabled)
-{
-#define SET_MOD_FKEYS(field) \
-    xw->keyboard.modify_now.field = ((what == DEFAULT) && enabled) \
-                                    ? xw->keyboard.modify_1st.field \
-                                    : what; \
-    TRACE(("set modify_now.%s to %d\n", #field, \
-          xw->keyboard.modify_now.field));
-
-    switch (which) {
-    case 0:
-       SET_MOD_FKEYS(allow_keys);
-       break;
-    case 1:
-       SET_MOD_FKEYS(cursor_keys);
-       break;
-    case 2:
-       SET_MOD_FKEYS(function_keys);
-       break;
-    case 3:
-       SET_MOD_FKEYS(keypad_keys);
-       break;
-    case 4:
-       SET_MOD_FKEYS(other_keys);
-       break;
-    case 5:
-       SET_MOD_FKEYS(string_keys);
-       break;
-    }
-}
-#endif /* OPT_MOD_FKEYS */
-
 #if OPT_TRACE
 #define DATA(name) { name, #name }
 static const struct {
@@ -2276,6 +2243,75 @@ deferparsing(unsigned c, struct ParseSta
     sp->defer_area[(sp->defer_used)++] = CharOf(c);
 }
 
+#if OPT_MOD_FKEYS
+static void
+set_mod_fkeys(XtermWidget xw, int which, int what, Bool enabled)
+{
+#define SET_MOD_FKEYS(field) \
+    xw->keyboard.modify_now.field = ((what == DEFAULT) && enabled) \
+                                    ? xw->keyboard.modify_1st.field \
+                                    : what; \
+    TRACE(("set modify_now.%s to %d\n", #field, \
+          xw->keyboard.modify_now.field));
+
+    switch (which) {
+    case 0:
+       SET_MOD_FKEYS(allow_keys);
+       break;
+    case 1:
+       SET_MOD_FKEYS(cursor_keys);
+       break;
+    case 2:
+       SET_MOD_FKEYS(function_keys);
+       break;
+    case 3:
+       SET_MOD_FKEYS(keypad_keys);
+       break;
+    case 4:
+       SET_MOD_FKEYS(other_keys);
+       break;
+    case 5:
+       SET_MOD_FKEYS(string_keys);
+       break;
+    }
+}
+
+static void
+report_mod_fkeys(XtermWidget xw, int which)    /* XTQMODKEYS */
+{
+#define GET_MOD_FKEYS(field) \
+    reply.a_param[1] = (ParmType) xw->keyboard.modify_now.field
+
+    init_reply(ANSI_CSI);
+    reply.a_pintro = '>';      /* replies look like a set-mode */
+    reply.a_nparam = 2;
+    reply.a_final = 'm';
+
+    reply.a_param[1] = DEFAULT;
+    switch (reply.a_param[0] = (ParmType) which) {
+    case 0:
+       GET_MOD_FKEYS(allow_keys);
+       break;
+    case 1:
+       GET_MOD_FKEYS(cursor_keys);
+       break;
+    case 2:
+       GET_MOD_FKEYS(function_keys);
+       break;
+    case 3:
+       GET_MOD_FKEYS(keypad_keys);
+       break;
+    case 4:
+       GET_MOD_FKEYS(other_keys);
+       break;
+    case 5:
+       GET_MOD_FKEYS(string_keys);
+       break;
+    }
+    unparseseq(xw, &reply);
+}
+#endif /* OPT_MOD_FKEYS */
+
 #if OPT_STATUS_LINE
 typedef enum {
     SLnone = 0,                        /* no status-line timer needed */
@@ -2792,6 +2828,7 @@ doparsing(XtermWidget xw, unsigned c, st
     do {
 #if OPT_WIDE_CHARS
        int this_is_wide = 0;
+       int is_formatter = 0;
 
        /*
         * Handle zero-width combining characters.  Make it faster by noting
@@ -2802,7 +2839,7 @@ doparsing(XtermWidget xw, unsigned c, st
        if (c >= 0x300
            && screen->wide_chars
            && CharWidth(screen, c) == 0
-           && !isWideControl(c)) {
+           && !(is_formatter = (CharacterClass((int) c) == CNTRL))) {
            int prev, test;
            Boolean used = True;
            int use_row;
@@ -2907,7 +2944,7 @@ doparsing(XtermWidget xw, unsigned c, st
             * printing characters.
             */
            if (sp->parsestate == sp->groundtable) {
-               sp->nextstate = CASE_PRINT;
+               sp->nextstate = is_formatter ? CASE_IGNORE : CASE_PRINT;
            } else if (sp->parsestate == sos_table) {
                c &= WIDEST_ICHAR;
                if (c > 255) {
@@ -3637,7 +3674,6 @@ doparsing(XtermWidget xw, unsigned c, st
 #endif
                }
                reply.a_nparam = (ParmType) count;
-               reply.a_inters = 0;
                reply.a_final = 'c';
                unparseseq(xw, &reply);
            }
@@ -3695,7 +3731,6 @@ doparsing(XtermWidget xw, unsigned c, st
                reply.a_param[count++] = XTERM_PATCH;   /* Version */
                reply.a_param[count++] = 0;     /* options (none) */
                reply.a_nparam = (ParmType) count;
-               reply.a_inters = 0;
                reply.a_final = 'c';
                unparseseq(xw, &reply);
            }
@@ -4029,7 +4064,6 @@ doparsing(XtermWidget xw, unsigned c, st
            count = 0;
            init_reply(ANSI_CSI);
            reply.a_pintro = CharOf(sp->private_function ? '?' : 0);
-           reply.a_inters = 0;
            reply.a_final = 'n';
 
            switch (GetParam(0)) {
@@ -4224,7 +4258,6 @@ doparsing(XtermWidget xw, unsigned c, st
                value = zero_if_default(0);
                if (value == 0 || value == 1) {
                    init_reply(ANSI_CSI);
-                   reply.a_pintro = 0;
                    reply.a_nparam = 7;
                    reply.a_param[0] = (ParmType) (value + 2);
                    reply.a_param[1] = 1;       /* no parity */
@@ -4233,7 +4266,6 @@ doparsing(XtermWidget xw, unsigned c, st
                    reply.a_param[4] = 128;     /* receive 38.4k baud */
                    reply.a_param[5] = 1;       /* clock multiplier ? */
                    reply.a_param[6] = 0;       /* STP flags ? */
-                   reply.a_inters = 0;
                    reply.a_final = 'x';
                    unparseseq(xw, &reply);
                }
@@ -4702,7 +4734,6 @@ doparsing(XtermWidget xw, unsigned c, st
                            reply.a_param[count++] = (ParmType) result2;
                    }
                    reply.a_nparam = (ParmType) count;
-                   reply.a_inters = 0;
                    reply.a_final = 'S';
                    unparseseq(xw, &reply);
                }
@@ -5577,6 +5608,14 @@ doparsing(XtermWidget xw, unsigned c, st
            }
            ResetState(sp);
            break;
+
+       case CASE_XTERM_REPORT_MOD_FKEYS:
+           TRACE(("CASE_XTERM_REPORT_MOD_FKEYS\n"));
+           for (value = 0; value < nparam; ++value) {
+               report_mod_fkeys(xw, GetParam(value));
+           }
+           ResetState(sp);
+           break;
 #endif
        case CASE_HIDE_POINTER:
            TRACE(("CASE_HIDE_POINTER\n"));
@@ -8156,10 +8195,8 @@ window_ops(XtermWidget xw)
        if (AllowWindowOps(xw, ewGetWinState)) {
            TRACE(("...get window attributes\n"));
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 1;
            reply.a_param[0] = (ParmType) (xtermIsIconified(xw) ? 2 : 1);
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8173,7 +8210,6 @@ window_ops(XtermWidget xw)
 
            TRACE(("...get window position\n"));
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 3;
            switch (zero_if_default(1)) {
@@ -8215,7 +8251,6 @@ window_ops(XtermWidget xw)
            }
            reply.a_param[1] = (ParmType) result_x;
            reply.a_param[2] = (ParmType) result_y;
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8228,7 +8263,6 @@ window_ops(XtermWidget xw)
 
            TRACE(("...get window size in pixels\n"));
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 4;
            switch (zero_if_default(1)) {
@@ -8244,7 +8278,6 @@ window_ops(XtermWidget xw)
                reply.a_param[2] = wide;
                break;
            }
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8256,12 +8289,10 @@ window_ops(XtermWidget xw)
            TRACE(("...get screen size in pixels\n"));
            (void) QueryMaximize(xw, &root_width, &root_height);
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 5;
            reply.a_param[1] = (ParmType) root_height;
            reply.a_param[2] = (ParmType) root_width;
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8273,12 +8304,10 @@ window_ops(XtermWidget xw)
                   FontHeight(screen),
                   FontWidth(screen)));
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 6;
            reply.a_param[1] = (ParmType) FontHeight(screen);
            reply.a_param[2] = (ParmType) FontWidth(screen);
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8289,12 +8318,10 @@ window_ops(XtermWidget xw)
        if (AllowWindowOps(xw, ewGetWinSizeChars)) {
            TRACE(("...get window size in characters\n"));
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 8;
            reply.a_param[1] = (ParmType) MaxRows(screen);
            reply.a_param[2] = (ParmType) MaxCols(screen);
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -8309,14 +8336,12 @@ window_ops(XtermWidget xw)
                   FontWidth(screen)));
            (void) QueryMaximize(xw, &root_width, &root_height);
            init_reply(ANSI_CSI);
-           reply.a_pintro = 0;
            reply.a_nparam = 3;
            reply.a_param[0] = 9;
            reply.a_param[1] = (ParmType) (root_height
                                           / (unsigned) FontHeight(screen));
            reply.a_param[2] = (ParmType) (root_width
                                           / (unsigned) FontWidth(screen));
-           reply.a_inters = 0;
            reply.a_final = 't';
            unparseseq(xw, &reply);
        }
@@ -9555,160 +9580,211 @@ limitedTerminalID(int terminal_id)
     return terminal_id;
 }
 
-/* ARGSUSED */
-static void
-VTInitialize(Widget wrequest,
-            Widget new_arg,
-            ArgList args GCC_UNUSED,
-            Cardinal *num_args GCC_UNUSED)
-{
-#define Kolor(name) TScreenOf(wnew)->name.resource
-#define TxtFg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_FG]), Kolor(name))
-#define TxtBg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_BG]), Kolor(name))
-#define DftFg(name) isDefaultForeground(Kolor(name))
-#define DftBg(name) isDefaultBackground(Kolor(name))
-
 #define DATA_END   { NULL,  -1       }
 
-#if OPT_BLINK_CURS
-#define DATA(name) { #name, cb##name }
-    static const FlagList tblBlinkOps[] =
-    {
-       DATA(Always)
-       ,DATA(Never)
-       ,DATA_END
-    };
-#undef DATA
-#endif
-
 #define DATA(name) { #name, ec##name }
-    static const FlagList tblColorOps[] =
-    {
-       DATA(SetColor)
-       ,DATA(GetColor)
-       ,DATA(GetAnsiColor)
-       ,DATA_END
-    };
+static const FlagList tblColorOps[] =
+{
+    DATA(SetColor)
+    ,DATA(GetColor)
+    ,DATA(GetAnsiColor)
+    ,DATA_END
+};
 #undef DATA
 
 #define DATA(name) { #name, ef##name }
-    static const FlagList tblFontOps[] =
-    {
-       DATA(SetFont)
-       ,DATA(GetFont)
-       ,DATA_END
-    };
+static const FlagList tblFontOps[] =
+{
+    DATA(SetFont)
+    ,DATA(GetFont)
+    ,DATA_END
+};
 #undef DATA
 
 #define DATA(name) { #name, em##name }
-    static const FlagList tblMouseOps[] =
-    {
-       DATA(X10)
-       ,DATA(Locator)
-       ,DATA(VT200Click)
-       ,DATA(VT200Hilite)
-       ,DATA(AnyButton)
-       ,DATA(AnyEvent)
-       ,DATA(FocusEvent)
-       ,DATA(Extended)
-       ,DATA(SGR)
-       ,DATA(URXVT)
-       ,DATA(AlternateScroll)
-       ,DATA_END
-    };
+static const FlagList tblMouseOps[] =
+{
+    DATA(X10)
+    ,DATA(Locator)
+    ,DATA(VT200Click)
+    ,DATA(VT200Hilite)
+    ,DATA(AnyButton)
+    ,DATA(AnyEvent)
+    ,DATA(FocusEvent)
+    ,DATA(Extended)
+    ,DATA(SGR)
+    ,DATA(URXVT)
+    ,DATA(AlternateScroll)
+    ,DATA_END
+};
 #undef DATA
 
 #define DATA(name) { #name, ep##name }
 #define DATA2(alias,name) { #alias, ep##name }
-    static const FlagList tblPasteControls[] =
-    {
-       DATA(NUL)
-       ,DATA(SOH)
-       ,DATA(STX)
-       ,DATA(ETX)
-       ,DATA(EOT)
-       ,DATA(ENQ)
-       ,DATA(ACK)
-       ,DATA(BEL)
-       ,DATA(BS)
-       ,DATA(HT)
-       ,DATA(LF)
-       ,DATA(VT)
-       ,DATA(FF)
-       ,DATA(CR)
-       ,DATA(SO)
-       ,DATA(SI)
-       ,DATA(DLE)
-       ,DATA(DC1)
-       ,DATA(DC2)
-       ,DATA(DC3)
-       ,DATA(DC4)
-       ,DATA(NAK)
-       ,DATA(SYN)
-       ,DATA(ETB)
-       ,DATA(CAN)
-       ,DATA(EM)
-       ,DATA(SUB)
-       ,DATA(ESC)
-       ,DATA(FS)
-       ,DATA(GS)
-       ,DATA(RS)
-       ,DATA(US)
-    /* aliases */
-       ,DATA2(NL, LF)
-       ,DATA(C0)
-       ,DATA(DEL)
-       ,DATA_END
-    };
+static const FlagList tblPasteOps[] =
+{
+    DATA(NUL)
+    ,DATA(SOH)
+    ,DATA(STX)
+    ,DATA(ETX)
+    ,DATA(EOT)
+    ,DATA(ENQ)
+    ,DATA(ACK)
+    ,DATA(BEL)
+    ,DATA(BS)
+    ,DATA(HT)
+    ,DATA(LF)
+    ,DATA(VT)
+    ,DATA(FF)
+    ,DATA(CR)
+    ,DATA(SO)
+    ,DATA(SI)
+    ,DATA(DLE)
+    ,DATA(DC1)
+    ,DATA(DC2)
+    ,DATA(DC3)
+    ,DATA(DC4)
+    ,DATA(NAK)
+    ,DATA(SYN)
+    ,DATA(ETB)
+    ,DATA(CAN)
+    ,DATA(EM)
+    ,DATA(SUB)
+    ,DATA(ESC)
+    ,DATA(FS)
+    ,DATA(GS)
+    ,DATA(RS)
+    ,DATA(US)
+/* aliases */
+    ,DATA2(NL, LF)
+    ,DATA(C0)
+    ,DATA(DEL)
+    ,DATA_END
+};
 #undef DATA
 #undef DATA2
 
 #define DATA(name) { #name, et##name }
-    static const FlagList tblTcapOps[] =
-    {
-       DATA(SetTcap)
-       ,DATA(GetTcap)
-       ,DATA_END
-    };
+static const FlagList tblTcapOps[] =
+{
+    DATA(SetTcap)
+    ,DATA(GetTcap)
+    ,DATA_END
+};
 #undef DATA
 
 #define DATA(name) { #name, ew##name }
-    static const FlagList tblWindowOps[] =
-    {
-       DATA(RestoreWin)
-       ,DATA(MinimizeWin)
-       ,DATA(SetWinPosition)
-       ,DATA(SetWinSizePixels)
-       ,DATA(RaiseWin)
-       ,DATA(LowerWin)
-       ,DATA(RefreshWin)
-       ,DATA(SetWinSizeChars)
+static const FlagList tblWindowOps[] =
+{
+    DATA(RestoreWin)
+    ,DATA(MinimizeWin)
+    ,DATA(SetWinPosition)
+    ,DATA(SetWinSizePixels)
+    ,DATA(RaiseWin)
+    ,DATA(LowerWin)
+    ,DATA(RefreshWin)
+    ,DATA(SetWinSizeChars)
 #if OPT_MAXIMIZE
-       ,DATA(MaximizeWin)
-       ,DATA(FullscreenWin)
+    ,DATA(MaximizeWin)
+    ,DATA(FullscreenWin)
 #endif
-       ,DATA(GetWinState)
-       ,DATA(GetWinPosition)
-       ,DATA(GetWinSizePixels)
-       ,DATA(GetWinSizeChars)
+    ,DATA(GetWinState)
+    ,DATA(GetWinPosition)
+    ,DATA(GetWinSizePixels)
+    ,DATA(GetWinSizeChars)
 #if OPT_MAXIMIZE
-       ,DATA(GetScreenSizeChars)
+    ,DATA(GetScreenSizeChars)
 #endif
-       ,DATA(GetIconTitle)
-       ,DATA(GetWinTitle)
-       ,DATA(PushTitle)
-       ,DATA(PopTitle)
-    /* this item uses all remaining numbers in the sequence */
-       ,DATA(SetWinLines)
-    /* starting at this point, numbers do not apply */
-       ,DATA(SetXprop)
-       ,DATA(GetSelection)
-       ,DATA(SetSelection)
-       ,DATA(GetChecksum)
-       ,DATA(SetChecksum)
+    ,DATA(GetIconTitle)
+    ,DATA(GetWinTitle)
+    ,DATA(PushTitle)
+    ,DATA(PopTitle)
+/* this item uses all remaining numbers in the sequence */
+    ,DATA(SetWinLines)
+/* starting at this point, numbers do not apply */
+    ,DATA(SetXprop)
+    ,DATA(GetSelection)
+    ,DATA(SetSelection)
+    ,DATA(GetChecksum)
+    ,DATA(SetChecksum)
+    ,DATA_END
+};
+#undef DATA
+
+void
+unparse_disallowed_ops(XtermWidget xw, char *value)
+{
+    TScreen *screen = TScreenOf(xw);
+#define DATA(mixed, plain, flags) { #mixed, offsetof(TScreen, plain), 
sizeof(screen->plain), flags }
+    /* *INDENT-OFF* */
+    static const struct {
+       const char *    name;
+       size_t          offset;
+       size_t          length;
+       const FlagList *codes;
+    } table[] = {
+       DATA(allowColorOps,      disallow_color_ops, tblColorOps),
+       DATA(allowFontOps,       disallow_font_ops,  tblFontOps),
+       DATA(allowMouseOps,      disallow_mouse_ops, tblMouseOps),
+       DATA(allowPasteControls, disallow_paste_ops, tblPasteOps),
+       DATA(allowTcapOps,       disallow_tcap_ops,  tblTcapOps),
+       DATA(allowWinOps,        disallow_win_ops,   tblWindowOps),
+    };
+    /* *INDENT-ON* */
+#undef DATA
+    Cardinal j, k, jk;
+    char delim = ';';
+
+    for (j = 0; j < XtNumber(table); ++j) {
+       if (!x_strcasecmp(value, table[j].name)) {
+           const char *flags = (char *) screen + table[j].offset;
+
+           for (k = 0; k < table[j].length; ++k) {
+               if (flags[k]) {
+                   const FlagList *codes = table[j].codes;
+                   Boolean found = False;
+
+                   unparseputc(xw, delim);
+                   for (jk = 0; codes[jk].name; ++jk) {
+                       if (codes[jk].code == (int) k) {
+                           unparseputs(xw, codes[jk].name);
+                           found = True;
+                           break;
+                       }
+                   }
+                   if (!found)
+                       unparseputn(xw, k);
+                   delim = ',';
+               }
+           }
+           break;
+       }
+    }
+}
+
+/* ARGSUSED */
+static void
+VTInitialize(Widget wrequest,
+            Widget new_arg,
+            ArgList args GCC_UNUSED,
+            Cardinal *num_args GCC_UNUSED)
+{
+#define Kolor(name) TScreenOf(wnew)->name.resource
+#define TxtFg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_FG]), Kolor(name))
+#define TxtBg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_BG]), Kolor(name))
+#define DftFg(name) isDefaultForeground(Kolor(name))
+#define DftBg(name) isDefaultBackground(Kolor(name))
+
+#if OPT_BLINK_CURS
+#define DATA(name) { #name, cb##name }
+    static const FlagList tblBlinkOps[] =
+    {
+       DATA(Always)
+       ,DATA(Never)
        ,DATA_END
     };
 #undef DATA
+#endif
 
 #if OPT_RENDERFONT
 #define DATA(name) { #name, er##name }
@@ -10123,11 +10199,11 @@ VTInitialize(Widget wrequest,
                        screen->disallowedMouseOps,
                        tblMouseOps);
 
-    init_Sres(screen.disallowedPasteControls);
+    init_Sres(screen.disallowedPasteOps);
 
-    set_flags_from_list(screen->disallow_paste_controls,
-                       screen->disallowedPasteControls,
-                       tblPasteControls);
+    set_flags_from_list(screen->disallow_paste_ops,
+                       screen->disallowedPasteOps,
+                       tblPasteOps);
 
     init_Sres(screen.disallowedTcapOps);
 
@@ -10480,6 +10556,12 @@ VTInitialize(Widget wrequest,
 
 #if OPT_RENDERFONT
     init_Ires(misc.limit_fontsets);
+    init_Ires(misc.limit_fontwidth);
+    if (wnew->misc.limit_fontwidth > 50) {
+       xtermWarning("limiting extra fontwidth percent to 50 (was %u)\n",
+                    wnew->misc.limit_fontwidth);
+       wnew->misc.limit_fontwidth = 50;
+    }
     wnew->work.max_fontsets = (unsigned) wnew->misc.limit_fontsets;
     if (wnew->work.max_fontsets > 255) {
        xtermWarning("limiting number of fontsets to 255 (was %u)\n",
@@ -11148,7 +11230,7 @@ VTDestroy(Widget w GCC_UNUSED)
     TRACE_FREE_LEAK(screen->disallowedColorOps);
     TRACE_FREE_LEAK(screen->disallowedFontOps);
     TRACE_FREE_LEAK(screen->disallowedMouseOps);
-    TRACE_FREE_LEAK(screen->disallowedPasteControls);
+    TRACE_FREE_LEAK(screen->disallowedPasteOps);
     TRACE_FREE_LEAK(screen->disallowedTcapOps);
     TRACE_FREE_LEAK(screen->disallowedWinOps);
     TRACE_FREE_LEAK(screen->default_string);
@@ -12318,8 +12400,8 @@ VTSetValues(Widget cur,
         T_COLOR(TScreenOf(newvt), TEXT_FG)) ||
        (TScreenOf(curvt)->MenuFontName(TScreenOf(curvt)->menu_font_number) !=
         TScreenOf(newvt)->MenuFontName(TScreenOf(newvt)->menu_font_number)) ||
-       strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) {
-       if (strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) {
+       strcmp(NonNull(DefaultFontN(curvt)), NonNull(DefaultFontN(newvt)))) {
+       if (strcmp(NonNull(DefaultFontN(curvt)), NonNull(DefaultFontN(newvt)))) 
{
            TScreenOf(newvt)->MenuFontName(fontMenu_default) = 
DefaultFontN(newvt);
        }
        if (xtermLoadFont(newvt,
@@ -12328,7 +12410,7 @@ VTSetValues(Widget cur,
            /* resizing does the redisplay, so don't ask for it here */
            refresh_needed = True;
            fonts_redone = True;
-       } else if (strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) {
+       } else if (strcmp(NonNull(DefaultFontN(curvt)), 
NonNull(DefaultFontN(newvt)))) {
            TScreenOf(newvt)->MenuFontName(fontMenu_default) = 
DefaultFontN(curvt);
        }
     }
Index: configure.in
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/configure.in,v
retrieving revision 1.37
diff -u -p -u -r1.37 configure.in
--- configure.in        7 Nov 2022 11:15:27 -0000       1.37
+++ configure.in        28 Jan 2023 17:16:53 -0000
@@ -1,9 +1,9 @@
-dnl $XTermId: configure.in,v 1.390 2022/10/10 16:33:01 tom Exp $
+dnl $XTermId: configure.in,v 1.392 2023/01/08 11:41:52 tom Exp $
 dnl
 dnl 
-----------------------------------------------------------------------------
 dnl this file is part of xterm
 dnl
-dnl Copyright 1997-2021,2022 by Thomas E. Dickey
+dnl Copyright 1997-2022,2023 by Thomas E. Dickey
 dnl
 dnl                         All Rights Reserved
 dnl
@@ -65,14 +65,14 @@ CF_XOPEN_SOURCE(700)
 CF_SIGWINCH
 
 ###    checks for header files
+AC_CHECK_DECL(exit)
 AC_CHECK_HEADERS( \
 ncurses/curses.h \
 ncurses/term.h \
-stdlib.h \
-sys/ptem.h sys/ttydefaults.h \
+sys/ptem.h \
+sys/ttydefaults.h \
 term.h \
 termios.h \
-unistd.h \
 wchar.h \
 )
 AC_HEADER_TIME
@@ -1152,7 +1152,7 @@ if test -n "$cf_cv_lib_part_tgetent"; th
     AC_CHECK_FUNCS(use_extended_names)
 fi
 
-CF_ENABLE_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas 
Wswitch-enum Wno-cast-qual)
+CF_ENABLE_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas 
Wswitch-enum Wno-cast-qual,yes)
 
 AC_SUBST(EXTRA_CFLAGS)
 AC_SUBST(CHARPROC_DEPS)
Index: ctlseqs.ms
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/ctlseqs.ms,v
retrieving revision 1.35
diff -u -p -u -r1.35 ctlseqs.ms
--- ctlseqs.ms  7 Nov 2022 11:15:27 -0000       1.35
+++ ctlseqs.ms  28 Jan 2023 17:16:53 -0000
@@ -1,9 +1,9 @@
 .\"#! troff -ms $1             -*- Nroff -*-
-.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.641 2022/10/10 14:18:26 tom Exp $
+.\" "XTerm Control Sequences" document
+.\" $XTermId: ctlseqs.ms,v 1.666 2023/01/07 01:30:20 tom Exp $
 .\"
 .\"
-.\" Copyright 1996-2021,2022 by Thomas E. Dickey
+.\" Copyright 1996-2022,2023 by Thomas E. Dickey
 .\"
 .\"                         All Rights Reserved
 .\"
@@ -69,8 +69,8 @@
 .\"
 .ds XT XTerm
 .ds xt xterm
-.ds LF Patch #374
-.ds RF 2022/10/10
+.ds LF Patch #378
+.ds RF 2023/01/06
 .\"
 .if n .pl 9999v                \" no page breaks in nroff
 .ND
@@ -346,7 +346,7 @@ X Consortium (1994)
 Thomas Dickey
 .AI
 XFree86 Project (1996-2006)
-invisible-island.net (2006-2022)
+invisible-island.net (2006-2023)
 updated for \*(XT \*(LF (\*(RF)
 .AU
 .
@@ -886,7 +886,7 @@ The string following the \*(``q\*('' is 
 for valid requests, replacing the \*(Pt with the corresponding \*(Cs
 string,
 or
-\*(Dc\*0\*$\*r\*(Pt\*s\*(ST
+\*(Dc\*0\*$\*r\*s\*(ST
 for invalid requests.
 .iP
 .IP \\*(Dc\\*(Ps\\*s\\*$\\*t\\*(Pt\\*s\\*(ST
@@ -903,27 +903,43 @@ The string following the \*(``Q\*('' is 
 encoded in hexadecimal (2 digits per character)
 separated by \*;
 which correspond to \fI\*(xt\fP resource names.
-Only boolean, numeric and string resources are supported by this query.
 .sP
 \fI\*(xt\fP responds with
 .br
 \*(Dc\*1\*+\*R\*(Pt\*s\*(ST
 for valid requests, adding to \*(Pt an \*=,
-and the value of the corresponding resource that \fI\*(xt\fP is using,
+and the value of the corresponding \fI\*(xt\fP resource,
 or
 .br
 \*(Dc\*0\*+\*R\*(Pt\*s\*(ST
 for invalid requests.
 .br
 The strings are encoded in hexadecimal (2 digits per character).
+.sP
+Only boolean, numeric and string resources for the VT100 widget
+are supported by this query.
+\fI\*(XT\fP evaluates resources at startup time.
+Several of \fI\*(xt\fP's state variables
+use resources to determine their initial value.
+Because the resource variable may not reflect the current state,
+\fI\*(xt\fP provides control sequences for querying the state directly:
+.RS
+.iP
+.bP
+XTQALLOWED
+.bP
+XTQMODKEYS
+.RE
 .Ed
 .
 .iP
 .IP \\*(Dc\\*+\\*p\\*(Pt\\*s\\*(ST
 Set Termcap/Terminfo Data (XTSETTCAP), \fI\*(xt\fP.
-The string following the \*(``p\*('' is a name to use for retrieving data from
-the terminal database.
-The data will be used for the \*(``tcap\*('' keyboard
+The string following the \*(``p\*('' is encoded in hexadecimal.
+After decoding it, \fI\*(xt\fP will use the name to
+retrieve data from the terminal database.
+If successful, that overrides the \fBtermName\fP resource when
+handling the \*(``tcap\*('' keyboard
 configuration's function- and special-keys, as well as by the
 Request Termcap/Terminfo String control.
 .
@@ -956,10 +972,14 @@ for valid requests, adding to \*(Pt an \
 and the value of the corresponding string that \fI\*(xt\fP would send,
 or
 .br
-\*(Dc\*0\*+\*r\*(Pt\*s\*(ST
+\*(Dc\*0\*+\*r\*(ST
 for invalid requests.
 .br
 The strings are encoded in hexadecimal (2 digits per character).
+If more than one name is given, \fI\*(xt\fP replies with each
+name/value pair in the same response.
+An invalid name (one not found in \fI\*(xt\fP's tables)
+ends processing of the list of names.
 .Ed
 .\"
 .Ss Functions using \*(Cs, ordered by the final character(s)
@@ -1287,6 +1307,10 @@ Horizontal and Vertical Position [row;co
 .iP
 .IP \\*(Cs\\*(Ps\\*s\\*g
 Tab Clear (TBC).
+ECMA-48 defines additional codes,
+but the VT100 user manual notes that it
+ignores other codes.
+DEC's later terminals (and \fI\*(xt\fP) do the same, for compatibility.
   \*(Ps = \*0 \(-> Clear Current Column (default).
   \*(Ps = \*3 \(-> Clear All.
 .
@@ -1341,7 +1365,7 @@ This may be disabled by the \fBtiteInhib
   \*(Ps = \*6\*7 \(-> Backarrow key sends backspace (DECBKM), VT340, VT420.
 This sets the \fBbackarrowKey\fP resource to \*(``true\*(''.
   \*(Ps = \*6\*9 \(-> Enable left and right margin mode (DECLRMM), VT420 and 
up.
-  \*(Ps = \*8\*0 \(-> Enable \fISixel Display Mode\fP (DECSDM), VT330, VT340, 
VT382. 
+  \*(Ps = \*8\*0 \(-> Enable \fISixel Display Mode\fP (DECSDM), VT330, VT340, 
VT382.
   \*(Ps = \*9\*5 \(-> Do not clear screen when DECCOLM is set/reset
 (DECNCSM), VT510 and up.
   \*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release.
@@ -1477,7 +1501,7 @@ This sets the \fBbackarrowKey\fP resourc
   \*(Ps = \*6\*9 \(-> Disable left and right margin mode (DECLRMM),
 VT420 and up.
   \*(Ps = \*8\*0 \(-> Disable \fISixel Display Mode\fP (DECSDM), VT330, VT340, 
VT382.
-Turns on ``Sixel Scrolling''.
+Turns on \*(``Sixel Scrolling\*(''.
 See the section \fBSixel Graphics\fP and mode \*8\*4\*5\*2.
   \*(Ps = \*9\*5 \(-> Clear screen when DECCOLM is set/reset (DECNCSM),
 VT510 and up.
@@ -1731,6 +1755,31 @@ Values \*3 and \*5 are reserved for keyp
 If no parameters are given, all resources are reset to their initial values.
 .
 .iP
+.IP \\*(Cs\\*?\\*(Pp\\*s\\*m
+Query key modifier options (XTQMODKEYS), \fI\*(xt\fP.
+.iP
+.IP
+The parameter \*(Pp identifies the resource to query.
+.iP
+  \*(Pp = \*0 \(-> \fBmodifyKeyboard\fP.
+  \*(Pp = \*1 \(-> \fBmodifyCursorKeys\fP.
+  \*(Pp = \*2 \(-> \fBmodifyFunctionKeys\fP.
+  \*(Pp = \*4 \(-> \fBmodifyOtherKeys\fP.
+.iP
+.IP
+\*(XT's response can be used to restore this state,
+because it is formatted as an XTMODKEYS control, i.e.,
+.iP
+  \*(Cs\*>\*(Pp\*s\*m
+.iP
+where
+.iP
+  \*(Pp = \*0 \(-> \fBmodifyKeyboard\fP.
+  \*(Pp = \*1 \(-> \fBmodifyCursorKeys\fP.
+  \*(Pp = \*2 \(-> \fBmodifyFunctionKeys\fP.
+  \*(Pp = \*4 \(-> \fBmodifyOtherKeys\fP.
+.
+.iP
 .IP \\*(Cs\\*(Ps\\*s\\*n
 Device Status Report (DSR).
   \*(Ps = \*5 \(-> Status Report.
@@ -2568,6 +2617,34 @@ for each item from the list of selection
 If the second parameter is neither a base64 string nor \*?,
 then the selection is cleared.
 .sP
+  \*(Ps = \*6\*0 \(-> Query allowed features (XTQALLOWED).
+\fI\*(XT\fP replies with
+.sP
+  \*(Os\*6\*0\*s\*;\*(Pt\*s\*(ST
+.sP
+where \*(Pt is a comma-separated list
+of the \fIallowed\fP optional runtime features,
+i.e., zero or more of these resource names:
+.iP
+  \fBallowColorOps\fR
+  \fBallowFontOps\fR
+  \fBallowMouseOps\fR
+  \fBallowPasteControls\fR
+  \fBallowTcapOps\fR
+  \fBallowTitleOps\fR
+  \fBallowWindowOps\fR
+.sP
+  \*(Ps = \*6\*1 \(-> Query disallowed features (XTQDISALLOWED).
+The second parameter (i.e., the main feature)
+must be one of the resource names returned by \*(Os\*6\*0.
+\fI\*(XT\fP replies with
+.sP
+  \*(Os\*6\*1\*s\*;\*(Pt\*s\*(ST
+.sP
+where \*(Pt is a comma-separated list
+of the optional runtime features which would be disallowed
+if the main feature is disabled.
+.sP
   \*(Ps = \*1\*0\*4\*;\fIc\fP \(-> Reset Color Number \fIc\fP.  It is reset to
 the color specified by the corresponding X resource.
 Any number of \fIc\fP parameters may be given.
@@ -2693,14 +2770,14 @@ ordinary keys may be sent as escape sequ
 .bP
 When \fBmodifyOtherKeys\fP is set to 1,
 only the alt- and meta-modifiers apply.
-For example, \fIalt-Tab\fP sends 
+For example, \fIalt-Tab\fP sends
 \*(Cs\*2\*7\*;\*3\*;\*9\*~
 (the second parameter is \*(``3\*('' for \fIalt\fP,
 and the third parameter is the ASCII value of tab, \*(``9\*('').
 .bP
 When \fBmodifyOtherKeys\fP is set to 2,
 all of the modifiers apply.
-For example, \fIshift-Tab\fP sends 
+For example, \fIshift-Tab\fP sends
 \*(Cs\*2\*7\*;\*2\*;\*9\*~
 rather than
 \*(Cs\*Z
@@ -2709,7 +2786,7 @@ rather than
 The \fBformatOtherKeys\fP resource tells \fI\*n\fP to change the
 format of the escape sequences sent when \fBmodifyOtherKeys\fP applies.
 When \fBmodifyOtherKeys\fP is set to 1,
-for example \fIalt-Tab\fP sends 
+for example \fIalt-Tab\fP sends
 \*(Cs\*9\*;\*3\*u
 (changing the order of parameters).
 One drawback to this format is that applications may confuse it with
@@ -3010,7 +3087,7 @@ _
 The VT100/VT220 keypad did not have all of those keys.
 They were implemented in \fI\*(xt\fP in X11R1 (1987),
 defining a mapping of all X11 keys which might be provided on a keypad.
-For instance, a Sun4/II type-4 keyboard provided 
+For instance, a Sun4/II type-4 keyboard provided
 \*(``=\*('' (equal),
 \*(``/\*('' (divide), and
 \*(``*\*('' (multiply).
@@ -3931,7 +4008,7 @@ which each manual agrees should \fIset\f
 The VT330/VT340 graphics programming manual (second edition, March 1988) says
 .RS 5
 .sp
-When sixel display mode is set, the \fISixel Scrolling\fP feature is enabled. 
+When sixel display mode is set, the \fISixel Scrolling\fP feature is enabled.
 .br
 When sixel display mode is reset, the \fISixel Scrolling\fP feature is 
disabled.
 .RE
@@ -4145,7 +4222,7 @@ as defined hereunder.
 This Standard addresses a whole class of devices which can vary greatly
 from each other depending on the application for which a device has
 been specifically designed. Obviously, a
-product which implements all facilities described in this standard \[en]   
+product which implements all facilities described in this standard \[en]
 thus being in \*(``full conformance\*('' with it \[en] whilst theoretically
 possible, would be technically and economically unthinkable.
 .ft R
Index: ctlseqs.txt
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/ctlseqs.txt,v
retrieving revision 1.35
diff -u -p -u -r1.35 ctlseqs.txt
--- ctlseqs.txt 7 Nov 2022 11:15:27 -0000       1.35
+++ ctlseqs.txt 28 Jan 2023 17:16:53 -0000
@@ -20,8 +20,8 @@
 
                              Thomas Dickey
                       XFree86 Project (1996-2006)
-                    invisible-island.net (2006-2022)
-               updated for XTerm Patch #374 (2022/10/10)
+                    invisible-island.net (2006-2023)
+               updated for XTerm Patch #378 (2023/01/06)
 
 
 
@@ -429,7 +429,7 @@ DCS $ q Pt ST
             * |     -> DECSNLS
           xterm responds with DCS 1 $ r Pt ST for valid requests,
           replacing the Pt with the corresponding CSI string, or DCS 0 $
-          r Pt ST for invalid requests.
+          r  ST for invalid requests.
 
 DCS Ps $ t Pt ST
           Restore presentation status (DECRSPS), VT320 and up.  The
@@ -442,24 +442,34 @@ DCS + Q Pt ST
           Request resource values (XTGETXRES), xterm.  The string
           following the "Q" is a list of names encoded in hexadecimal (2
           digits per character) separated by ; which correspond to xterm
-          resource names.  Only boolean, numeric and string resources
-          are supported by this query.
+          resource names.
 
           xterm responds with
           DCS 1 + R Pt ST for valid requests, adding to Pt an = , and
-          the value of the corresponding resource that xterm is using,
-          or
+          the value of the corresponding xterm resource, or
           DCS 0 + R Pt ST for invalid requests.
           The strings are encoded in hexadecimal (2 digits per
           character).
 
+          Only boolean, numeric and string resources for the VT100
+          widget are supported by this query.  XTerm evaluates resources
+          at startup time.  Several of xterm's state variables use
+          resources to determine their initial value.  Because the
+          resource variable may not reflect the current state, xterm
+          provides control sequences for querying the state directly:
+
+          o   XTQALLOWED
+          o   XTQMODKEYS
+
 
 DCS + p Pt ST
           Set Termcap/Terminfo Data (XTSETTCAP), xterm.  The string
-          following the "p" is a name to use for retrieving data from
-          the terminal database.  The data will be used for the "tcap"
-          keyboard configuration's function- and special-keys, as well
-          as by the Request Termcap/Terminfo String control.
+          following the "p" is encoded in hexadecimal.  After decoding
+          it, xterm will use the name to retrieve data from the terminal
+          database.  If successful, that overrides the termName resource
+          when handling the "tcap" keyboard configuration's function-
+          and special-keys, as well as by the Request Termcap/Terminfo
+          String control.
 
 
 DCS + q Pt ST
@@ -482,9 +492,12 @@ DCS + q Pt ST
           DCS 1 + r Pt ST for valid requests, adding to Pt an = , and
           the value of the corresponding string that xterm would send,
           or
-          DCS 0 + r Pt ST for invalid requests.
+          DCS 0 + r ST for invalid requests.
           The strings are encoded in hexadecimal (2 digits per
-          character).
+          character).  If more than one name is given, xterm replies
+          with each name/value pair in the same response.  An invalid
+          name (one not found in xterm's tables) ends processing of the
+          list of names.
 
 
 Functions using CSI , ordered by the final character(s)
@@ -738,7 +751,9 @@ CSI Ps ; Ps f
           Horizontal and Vertical Position [row;column] (default =
           [1,1]) (HVP).
 
-CSI Ps g  Tab Clear (TBC).
+CSI Ps g  Tab Clear (TBC).  ECMA-48 defines additional codes, but the
+          VT100 user manual notes that it ignores other codes.  DEC's
+          later terminals (and xterm) do the same, for compatibility.
             Ps = 0  -> Clear Current Column (default).
             Ps = 3  -> Clear All.
 
@@ -924,7 +939,7 @@ CSI ? Pm l
             Ps = 6 9  -> Disable left and right margin mode (DECLRMM),
           VT420 and up.
             Ps = 8 0  -> Disable Sixel Display Mode (DECSDM), VT330,
-          VT340, VT382.  Turns on ``Sixel Scrolling''.  See the section
+          VT340, VT382.  Turns on "Sixel Scrolling".  See the section
           Sixel Graphics and mode 8 4 5 2 .
             Ps = 9 5  -> Clear screen when DECCOLM is set/reset
           (DECNCSM), VT510 and up.
@@ -1154,6 +1169,28 @@ CSI > Pp m
           If no parameters are given, all resources are reset to their
           initial values.
 
+CSI ? Pp m
+          Query key modifier options (XTQMODKEYS), xterm.
+
+          The parameter Pp identifies the resource to query.
+
+            Pp = 0  -> modifyKeyboard.
+            Pp = 1  -> modifyCursorKeys.
+            Pp = 2  -> modifyFunctionKeys.
+            Pp = 4  -> modifyOtherKeys.
+
+          XTerm's response can be used to restore this state, because it
+          is formatted as an XTMODKEYS control, i.e.,
+
+            CSI > Pp m
+
+          where
+
+            Pp = 0  -> modifyKeyboard.
+            Pp = 1  -> modifyCursorKeys.
+            Pp = 2  -> modifyFunctionKeys.
+            Pp = 4  -> modifyOtherKeys.
+
 CSI Ps n  Device Status Report (DSR).
             Ps = 5  -> Status Report.
           Result ("OK") is CSI 0 n
@@ -1847,6 +1884,32 @@ OSC Ps ; Pt ST
           If the second parameter is neither a base64 string nor ? ,
           then the selection is cleared.
 
+            Ps = 6 0  -> Query allowed features (XTQALLOWED).  XTerm
+          replies with
+
+            OSC 6 0  ; Pt ST
+
+          where Pt is a comma-separated list of the allowed optional
+          runtime features, i.e., zero or more of these resource names:
+
+            allowColorOps
+            allowFontOps
+            allowMouseOps
+            allowPasteControls
+            allowTcapOps
+            allowTitleOps
+            allowWindowOps
+
+            Ps = 6 1  -> Query disallowed features (XTQDISALLOWED).  The
+          second parameter (i.e., the main feature) must be one of the
+          resource names returned by OSC 6 0 .  XTerm replies with
+
+            OSC 6 1  ; Pt ST
+
+          where Pt is a comma-separated list of the optional runtime
+          features which would be disallowed if the main feature is
+          disabled.
+
             Ps = 1 0 4 ; c -> Reset Color Number c.  It is reset to the
           color specified by the corresponding X resource.  Any number
           of c parameters may be given.  These parameters correspond to
@@ -3292,44 +3355,44 @@ o   The SCOSC/SCORC control sequences fo
         be used in termcap for vi, for example, to turn off saving of
         lines, but restore whatever the original state was on exit.
 
-    while  the  SCOSC/SCORC  pair  was  added  in  1995  by XFree86 (and
+    while the SCOSC/SCORC  pair  was  added  in  1995  by  XFree86  (and
     documented long afterwards).
 
-    The SCO  ANSI  console  terminal  descriptions  did  not  use  these
-    controls  (they  used the VT100-compatible SC/RC pair).  SCOSC/SCORC
-    were an artifact of DOS 2.00 (January 1983), by Microsoft and  later
+    The  SCO  ANSI  console  terminal  descriptions  did  not  use these
+    controls (they used the VT100-compatible SC/RC  pair).   SCOSC/SCORC
+    were  an artifact of DOS 2.00 (January 1983), by Microsoft and later
     supported by SCO and other vendors.
 
-    The  SCOSC/SCORC pair is considered a private mode because the final
+    The SCOSC/SCORC pair is considered a private mode because the  final
     characters (s  and u ) fall in the range from "`" to "~" (octal 0140
-    to  octal 0176).  Other private control sequences can be constructed
+    to octal 0176).  Other private control sequences can be  constructed
     by using octets 074 to 077 (characters "<", "=", ">", or "?") at the
     beginning  of  the  parameter  string.   The  XTSAVE  and  XTRESTORE
     controls use "?") in this manner.
 
     Because  the  XTSAVE  and  XTRESTORE  controls  are  private,  other
-    terminals  may  behave differently.  For example, DEC (a contributor
-    to the early xterm as well as a manufacturer of terminals)  used  an
-    incompatible  private control in one of its terminals more than five
+    terminals may behave differently.  For example, DEC  (a  contributor
+    to  the  early xterm as well as a manufacturer of terminals) used an
+    incompatible private control in one of its terminals more than  five
     years later (for the VT420 PCTerm, announced in February 1992).
 
-    In that model of the VT420, CSI ? Pm;  Pc  r  selects  the  PC  TERM
-    emulation  mode.  When this mode is enabled, the keyboard sends scan
-    codes rather than characters (analogous to X keyboard events).   The
-    first  parameter of this private control enables or disables PC TERM
+    In  that  model  of  the  VT420,  CSI ? Pm; Pc r selects the PC TERM
+    emulation mode.  When this mode is enabled, the keyboard sends  scan
+    codes  rather than characters (analogous to X keyboard events).  The
+    first parameter of this private control enables or disables PC  TERM
     mode, while the second selects a character set.  An ambiguity arises
     if an application omits the second parameter.  In that special case,
-    it cannot be distinguished from XTRESTORE.  DEC did  not  take  this
+    it  cannot  be  distinguished from XTRESTORE.  DEC did not take this
     into account when designing the feature.
 
-    If  there  were  potential  users, xterm could accommodate this by a
-    resource setting.  In retrospect (thirty years  later),  there  have
-    been  no  uses  of  PC TERM, while the XTRESTORE feature is still in
+    If there were potential users, xterm could  accommodate  this  by  a
+    resource  setting.   In  retrospect (thirty years later), there have
+    been no uses of PC TERM, while the XTRESTORE  feature  is  still  in
     use.
 
 o   The aixterm manual page gives the format of the control sequence for
-    foreground  and  background  colors  8-15, but does not specify what
-    those colors are.  That is implied by the description's  mention  of
+    foreground and background colors 8-15, but  does  not  specify  what
+    those  colors  are.  That is implied by the description's mention of
     HFT:
 
         The aixterm command provides a standard terminal type for
@@ -3339,7 +3402,7 @@ o   The aixterm manual page gives the fo
         the -v flag.
 
     Unlike xterm, there are no resource names for the 16 colors, leaving
-    the reader to assume that the mapping is  hard-coded.   The  control
-    sequences  for  colors 8-15 are not specified by ECMA-48, but rather
-    (as done in other instances by xterm) chosen to  not  conflict  with
+    the  reader  to  assume that the mapping is hard-coded.  The control
+    sequences for colors 8-15 are not specified by ECMA-48,  but  rather
+    (as  done  in  other instances by xterm) chosen to not conflict with
     current or future standards.
Index: fontutils.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/fontutils.c,v
retrieving revision 1.41
diff -u -p -u -r1.41 fontutils.c
--- fontutils.c 9 Nov 2022 21:55:15 -0000       1.41
+++ fontutils.c 28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.c,v 1.750 2022/10/23 22:55:11 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.760 2023/01/08 23:42:23 tom Exp $ */
 
 /*
- * Copyright 1998-2021,2022 by Thomas E. Dickey
+ * Copyright 1998-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -163,7 +163,7 @@ static Boolean merge_sublist(char ***, c
 #endif
 
 static void save2FontList(XtermWidget, const char *, XtermFontNames *,
-                         VTFontEnum, const char *, Bool);
+                         VTFontEnum, const char *, Bool, Bool);
 
 #if OPT_RENDERFONT
 static void fillInFaceSize(XtermWidget, int);
@@ -1965,6 +1965,8 @@ xtermLoadItalics(XtermWidget xw)
            TRACE(("MERGE_SUBFONT " #dst "." #name " found \"%s\"\n", 
NonNull(dst.name))); \
        }
 #define MERGE_SUBLIST(dst,src,name) \
+       if (dst.fonts.x11.name == NULL) \
+           dst.fonts.x11.name = TypeCalloc(char *); \
        if (merge_sublist(&(dst.fonts.x11.name), src.fonts.x11.name)) { \
            TRACE(("MERGE_SUBLIST " #dst "." #name " merge \"%s\"\n", 
src.fonts.x11.name[0])); \
        } else { \
@@ -2184,10 +2186,20 @@ xtermLoadVTFonts(XtermWidget xw, String 
             * Now, save the string to a font-list for consistency
             */
 #define ALLOC_SUBLIST(which,field) \
-           save2FontList(xw, "cached", \
-                         &(subresourceRec.fonts), \
-                         which, \
-                         subresourceRec.default_font.field, False)
+           if (subresourceRec.default_font.field != NULL) { \
+               char *blob = x_strdup(subresourceRec.default_font.field); \
+               char *base = blob; \
+               for (base = blob; ; base = NULL) { \
+                   char *item = strtok(base, ","); \
+                   if (item == NULL) \
+                       break; \
+                   save2FontList(xw, "cached", \
+                                 &(subresourceRec.fonts), \
+                                 which, \
+                                 item, False, False); \
+               } \
+               free(blob); \
+           }
 
            ALLOC_SUBLIST(fNorm, f_n);
            ALLOC_SUBLIST(fBold, f_b);
@@ -2612,6 +2624,25 @@ checkedXftWidth(Display *dpy,
     return result;
 }
 
+/*
+ * Check if the given character has a glyph known to Xft.  This is likely to be
+ * slower than checking our cache.
+ *
+ * see xc/lib/Xft/xftglyphs.c
+ */
+static Bool
+slowXftMissing(XtermWidget xw, XftFont *font, unsigned wc)
+{
+    TScreen *screen = TScreenOf(xw);
+    Bool result = False;
+
+    if (font != NULL) {
+       if (XftCharIndex(screen->display, font, wc) == 0)
+           result = True;
+    }
+    return result;
+}
+
 static int
 checkXftWidth(XtermWidget xw, XTermXftFonts *data)
 {
@@ -2701,6 +2732,24 @@ checkXftWidth(XtermWidget xw, XTermXftFo
     return failed;
 }
 
+#if OPT_TRACE
+static const char *
+nameOfXftFont(XftFont *fp)
+{
+    static char *result;
+    char buffer[1024];
+    FreeAndNull(result);
+    if (XftNameUnparse(fp->pattern, buffer, (int) sizeof(buffer))) {
+       char *target;
+       char *source = buffer;
+       if ((target = strtok(source, ":")) != 0) {
+           result = x_strdup(target);
+       }
+    }
+    return NonNull(result);
+}
+#endif
+
 #if OPT_REPORT_FONTS
 static void
 reportXftFonts(XtermWidget xw,
@@ -2742,8 +2791,26 @@ reportXftFonts(XtermWidget xw,
        fflush(stdout);
     }
 }
+
+static void
+reportXftFallbackFont(XtermWidget xw,
+                     XTermXftFonts *fontData,
+                     int fontNum,
+                     XftFont *font,
+                     XftPattern *match)
+{
+    if (resource.reportFonts) {
+       char tag[80];
+       sprintf(tag, "%s#%d",
+               whichXftFonts(xw, fontData),
+               fontNum + 1);
+       reportXftFonts(xw, fontData, fontNum, font, "fallback", tag, match);
+    }
+}
+
 #else
 #define reportXftFonts(xw, fontData, fontNum, result, name, tag, match)        
        /* empty */
+#define reportXftFallbackFont(xw, fontData, fontNum, font, match)      /* 
empty */
 #endif /* OPT_REPORT_FONTS */
 
 /*
@@ -2818,7 +2885,7 @@ xtermOpenXft(XtermWidget xw,
     XftFont *result = 0;
 
     TRACE(("xtermOpenXft(name=%s, tag=%s)\n", name, tag));
-    if (pat != 0) {
+    if (pat != 0 && (fontNum <= MaxXftCache)) {
        XftPattern *match;
 
        FcConfigSubstitute(NULL, pat, FcMatchPattern);
@@ -2839,8 +2906,8 @@ xtermOpenXft(XtermWidget xw,
 #endif
            if (result != NULL) {
                TRACE(("...matched %s font\n", tag));
-               if (fontData->fs_size <= (unsigned) fontNum)
-                   fontData->fs_size = (unsigned) (fontNum + 1);
+               if (fontData->fs_size < fontNum)
+                   fontData->fs_size = fontNum;
                XftFpN(fontData, fontNum) = result;
                XftIsN(fontData, fontNum) = xcOpened;
                if (!maybeXftCache(xw, result)) {
@@ -2861,7 +2928,7 @@ xtermOpenXft(XtermWidget xw,
            }
        }
     }
-    if (result == NULL) {
+    if (result == NULL && (fontNum <= MaxXftCache)) {
        XftFpN(fontData, fontNum) = NULL;
        XftIsN(fontData, fontNum) = xcEmpty;
     }
@@ -3213,7 +3280,7 @@ void
 xtermCloseXft(TScreen *screen, XTermXftFonts *pub)
 {
     if (XftFp(pub) != NULL) {
-       Cardinal n;
+       int n;
 
        if (pub->pattern) {
            XftPatternDestroy(pub->pattern);
@@ -3224,7 +3291,7 @@ xtermCloseXft(TScreen *screen, XTermXftF
            pub->fontset = NULL;
        }
 
-       for (n = 0; n < pub->fs_size; ++n) {
+       for (n = 0; n <= pub->fs_size; ++n) {
            if (XftFpN(pub, n) != NULL) {
                closeCachedXft(screen, XftFpN(pub, n));
                XftFpN(pub, n) = NULL;
@@ -4150,45 +4217,62 @@ xtermDrawBoxChar(XTermDraw * params,
 #endif /* OPT_BOX_CHARS */
 
 #if OPT_RENDERFONT
+static int
+checkXftGlyph(XtermWidget xw, XftFont *font, unsigned wc)
+{
+    TScreen *screen = TScreenOf(xw);
+    int result = 0;
+    int expect;
+
+    if ((expect = CharWidth(screen, wc)) > 0) {
+       XGlyphInfo gi;
+       int actual;
+       int limit = (100 + xw->misc.limit_fontwidth);
+
+       XftTextExtents32(screen->display, font, &wc, 1, &gi);
+       /*
+        * Some (more than a few) fonts are sloppy; allow 10% outside
+        * the bounding box to accommodate them.
+        */
+       actual = ((gi.xOff * 100) >= (limit * FontWidth(screen))) ? 2 : 1;
+       if (actual <= expect) {
+           /* allow double-cell if wcwidth agrees */
+           result = 1;
+       } else {
+           /*
+            * Do not use this font for this specific character, but
+            * possibly other characters can be used.
+            */
+           result = -1;
+           TRACE(("SKIP U+%04X %d vs %d (%d vs %d) %s\n",
+                  wc, gi.xOff, FontWidth(screen), actual, expect,
+                  nameOfXftFont(font)));
+       }
+    } else {
+       result = 1;
+    }
+    return result;
+}
+
 /*
  * Check if the glyph is defined in the given font, and (try to) filter out
  * cases where double-width glyphs are stuffed into a single-width outline.
  */
-static Boolean
+static int
 foundXftGlyph(XtermWidget xw, XTermXftFonts *data, int fontNum, unsigned wc)
 {
     XftFont *font = XftFpN(data, fontNum);
-    TScreen *screen = TScreenOf(xw);
-    Boolean result = False;
+    int result = 0;
 
     if (font != 0) {
        if (!xtermXftMissing(xw, data, fontNum, font, wc)) {
-           int expect;
 
            if (XftIsN(data, fontNum) == xcBogus) {
                ;
            } else if (XftIsN(data, fontNum) == xcOpened) {
-               result = True;
-           } else if ((expect = CharWidth(screen, wc)) > 0) {
-               XGlyphInfo gi;
-               int actual;
-
-               XftTextExtents32(screen->display, font, &wc, 1, &gi);
-               /*
-                * Some (more than a few) fonts are sloppy; allow 10% outside
-                * the bounding box to accommodate them.
-                */
-               actual = ((gi.xOff * 10) >= (11 * FontWidth(screen))) ? 2 : 1;
-               if (actual <= expect) {
-                   /* allow double-cell if wcwidth agrees */
-                   result = True;
-               } else {
-                   XftIsN(data, fontNum) = xcBogus;
-                   TRACE(("SKIP U+%04X %d vs %d (%d vs %d)\n",
-                          wc, gi.xOff, FontWidth(screen), actual, expect));
-               }
+               result = 1;
            } else {
-               result = True;
+               result = checkXftGlyph(xw, font, wc);
            }
        }
     }
@@ -4196,7 +4280,7 @@ foundXftGlyph(XtermWidget xw, XTermXftFo
 }
 
 static void
-markXftOpened(XtermWidget xw, XTermXftFonts *which, Cardinal n, unsigned wc)
+markXftOpened(XtermWidget xw, XTermXftFonts *which, int n, unsigned wc)
 {
     if (XftIsN(which, n) != xcOpened) {
        which->opened++;
@@ -4291,8 +4375,8 @@ findXftGlyph(XtermWidget xw, XTermXftFon
     TScreen *screen = TScreenOf(xw);
     XftFont *given;
     XftFont *actual = NULL;
-    Cardinal n;
     FcResult status;
+    int n;
     int result = -1;
 
     /* sanity-check */
@@ -4377,10 +4461,10 @@ findXftGlyph(XtermWidget xw, XTermXftFon
        FcFontSetSortDestroy(sortedFonts);
        FcPatternDestroy(myPattern);
 
-       fontData->fs_size = (unsigned) fontData->fontset->nfont;
+       fontData->fs_size = Min(MaxXftCache, fontData->fontset->nfont);
     } {
        XftFont *check;
-       Cardinal empty = fontData->fs_size;
+       int empty = fontData->fs_size;
 
        for (n = 1; n <= fontData->fs_size; ++n) {
            XTermXftState usage = XftIsN(fontData, n);
@@ -4406,11 +4490,15 @@ findXftGlyph(XtermWidget xw, XTermXftFon
            && (fontData->opened < xw->work.max_fontsets)) {
            FcPattern *myPattern = NULL;
            FcPattern *myReport = NULL;
+           int defer = -1;
 
            if (empty == 0)     /* should not happen */
                empty++;
-           for (n = empty; n < fontData->fs_size; ++n) {
-               unsigned nn = n - 1;
+
+           for (n = empty; n <= fontData->fs_size; ++n) {
+               int found;
+               int nn = n - 1;
+
                if (XftIsN(fontData, n) != xcEmpty) {
                    continue;
                }
@@ -4422,8 +4510,6 @@ findXftGlyph(XtermWidget xw, XTermXftFon
                myPattern = FcPatternDuplicate(fontData->fontset->fonts[nn]);
                check = XftFontOpenPattern(screen->display, myPattern);
                (void) maybeXftCache(xw, check);
-               if (fontData->fs_size <= n)
-                   fontData->fs_size = (n + 1);
                XftFpN(fontData, n) = check;
                if (check == NULL) {
                    ;           /* shouldn't happen... */
@@ -4433,27 +4519,48 @@ findXftGlyph(XtermWidget xw, XTermXftFon
                    XftIsN(fontData, n) = xcBogus;
                } else
 #endif
-               if (foundXftGlyph(xw, fontData, (int) n, wc)) {
-                   char tag[80];
-                   if (resource.reportFonts) {
-                       sprintf(tag, "%s#%d",
-                               whichXftFonts(xw, fontData),
-                               n + 1);
-                   } else {
-                       tag[0] = '\0';
-                   }
+                   if ((found = foundXftGlyph(xw, fontData, (int) n, wc))
+                       != 0) {
                    markXftOpened(xw, fontData, n, wc);
-                   reportXftFonts(xw, fontData, (int) n, check,
-                                  "fallback", tag, myReport);
+                   reportXftFallbackFont(xw, fontData, (int) n, check, 
myReport);
+                   if (found < 0) {
+                       if (defer < 0) {
+                           defer = (int) n;
+                           TRACE(("Deferring font choice #%d\n", n + 1));
+                           continue;
+                       } else if (slowXftMissing(xw, check, wc)) {
+                           TRACE(("Deferred, continuing  #%d\n", n + 1));
+                           continue;
+                       }
+                   } else if (defer >= 0) {
+                       defer = -1;
+                       TRACE(("Deferred, replacing %d with %d\n",
+                              defer + 1, n + 1));
+                   }
                    actual = check;
                    result = (int) n;
                    TRACE_FALLBACK(xw, "new", wc, result, actual);
                    break;
                } else {
-                   /*
-                    * The slot is opened, but we are not using it yet.
-                    */
-                   XftIsN(fontData, n) = xcUnused;
+                   Bool ok;
+                   if (defer >= 0
+                       && (ok = !slowXftMissing(xw, check, wc))
+                       && checkXftGlyph(xw, check, wc)) {
+                       XTermFontMap *font_map = &(fontData->font_map);
+                       TRACE(("checkrecover2 %d\n", n));
+                       markXftOpened(xw, fontData, n, wc);
+                       reportXftFallbackFont(xw, fontData, (int) n, check, 
myReport);
+                       actual = check;
+                       result = (int) n;
+                       TRACE_FALLBACK(xw, "fix", wc, result, actual);
+                       font_map->per_font[wc] = (XTfontNum) (result + 1);
+                       break;
+                   } else {
+                       /*
+                        * The slot is opened, but we are not using it yet.
+                        */
+                       XftIsN(fontData, n) = xcUnused;
+                   }
                }
            }
            if (myReport != NULL)
@@ -4497,8 +4604,10 @@ xtermXftMissing(XtermWidget xw,
            font_map->depth = (fontNum + 1);
            /* allocate space */
            if (last > font_map->last_char) {
-               font_map->per_font = realloc(font_map->per_font, last);
-               memset(font_map->per_font + font_map->last_char, 0, (last - 
font_map->last_char));
+               size_t need = (last * sizeof(XTfontNum));
+               size_t c1st = (font_map->last_char * sizeof(XTfontNum));
+               font_map->per_font = realloc(font_map->per_font, need);
+               memset(font_map->per_font + font_map->last_char, 0, (need - 
c1st));
                font_map->last_char = last;
            }
 
@@ -4526,12 +4635,13 @@ xtermXftMissing(XtermWidget xw,
                                               &nextPage)) != FC_CHARSET_DONE);
            (void) added;
            (void) actual;
-           TRACE(("xtermXftMissing U+%04X #%-3d %6u added vs %6u of %6ld %s\n",
+           TRACE(("xtermXftMissing U+%04X #%-3d %6u added vs %6u of %6ld %s: 
%s\n",
                   wc,
                   font_map->depth,
                   added, actual,
                   font_map->last_char + 1,
-                  whichXftFonts(xw, data)));
+                  whichXftFonts(xw, data),
+                  nameOfXftFont(font)));
        }
        if (wc < font_map->last_char) {
            result = (font_map->per_font[wc] != (fontNum + 1));
@@ -5242,6 +5352,7 @@ save2FontList(XtermWidget xw,
              XtermFontNames * fontnames,
              VTFontEnum which,
              const char *source,
+             Bool check,
              Bool ttf)
 {
     char *value;
@@ -5386,9 +5497,7 @@ save2FontList(XtermWidget xw,
                           (unsigned long) count,
                           value));
                } else {
-                   fprintf(stderr,
-                           "realloc failure in save2FontList(%s)\n",
-                           name);
+                   xtermWarning("realloc failure in save2FontList(%s)\n", 
name);
                    freeFontList(list);
                    success = False;
                }
@@ -5401,10 +5510,11 @@ save2FontList(XtermWidget xw,
            size_t limit = use_ttf ? MAX_XFT_FONTS : MAX_XLFD_FONTS;
 #endif
            if (count > limit && *x_skip_blanks(value)) {
-               fprintf(stderr, "%s: too many fonts for %s, ignoring %s\n",
-                       ProgramName,
-                       whichFontEnum(which),
-                       value);
+               if (check) {
+                   xtermWarning("too many fonts for %s, ignoring %s\n",
+                                whichFontEnum(which),
+                                value);
+               }
                if (list && *list) {
                    free((*list)[limit]);
                    (*list)[limit] = 0;
@@ -5465,7 +5575,7 @@ allocFontList(XtermWidget xw,
        if (list) {
            for (n = 0; list[n] != 0; ++n) {
                if (*list[n]) {
-                   save2FontList(xw, name, target, which, list[n], ttf);
+                   save2FontList(xw, name, target, which, list[n], True, ttf);
                }
            }
            free(list);
@@ -5484,7 +5594,7 @@ initFontList(XtermWidget xw,
 
     TRACE(("initFontList(%s)\n", name));
     for (which = 0; which < fMAX; ++which) {
-       save2FontList(xw, name, target, (VTFontEnum) which, "", ttf);
+       save2FontList(xw, name, target, (VTFontEnum) which, "", False, ttf);
     }
 }
 
Index: input.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/input.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 input.c
--- input.c     17 Oct 2021 09:10:00 -0000      1.27
+++ input.c     28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: input.c,v 1.368 2021/09/12 18:20:03 tom Exp $ */
+/* $XTermId: input.c,v 1.369 2022/11/24 12:48:54 tom Exp $ */
 
 /*
- * Copyright 1999-2020,2021 by Thomas E. Dickey
+ * Copyright 1999-2021,2022 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -627,6 +627,7 @@ ModifyOtherKeys(XtermWidget xw,
                        result = True;
                    break;
 #endif
+               case XK_Escape:
                case XK_Return:
                case XK_Tab:
                    result = (modify_parm != 0);
@@ -634,8 +635,8 @@ ModifyOtherKeys(XtermWidget xw,
                default:
                    if (IsControlInput(kd)) {
                        result = True;
-                   } else if (state == ShiftMask) {
-                       result = (kd->keysym == ' ' || kd->keysym == XK_Return);
+                   } else if (state == ShiftMask && kd->keysym == ' ') {
+                       result = True;
                    } else if (computeMaskedModifier(xw, state, ShiftMask)) {
                        result = True;
                    }
Index: main.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/main.c,v
retrieving revision 1.62
diff -u -p -u -r1.62 main.c
--- main.c      9 Nov 2022 21:55:15 -0000       1.62
+++ main.c      28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: main.c,v 1.891 2022/10/21 23:02:38 tom Exp $ */
+/* $XTermId: main.c,v 1.892 2023/01/09 00:28:06 tom Exp $ */
 
 /*
- * Copyright 2002-2021,2022 by Thomas E. Dickey
+ * Copyright 2002-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -3798,9 +3798,7 @@ xtermTrimEnv(void)
        char *equals = strchr(environ[j], '=');
        size_t dstlen = strlen(environ[j]);
 
-       if (equals == NULL)
-           equals = (environ[j] + dstlen);
-       else
+       if (equals != NULL)
            dstlen = (size_t) (equals - environ[j]);
 
        for (k = 0; k < XtNumber(table); ++k) {
Index: main.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/main.h,v
retrieving revision 1.19
diff -u -p -u -r1.19 main.h
--- main.h      7 Nov 2022 11:15:27 -0000       1.19
+++ main.h      28 Jan 2023 17:16:53 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.81 2022/07/07 09:44:28 tom Exp $ */
+/* $XTermId: main.h,v 1.82 2022/11/21 22:28:35 tom Exp $ */
 
 /*
  * Copyright 2000-2021,2022 by Thomas E. Dickey
@@ -240,7 +240,7 @@
 #endif
 
 #ifndef DEF_TRACK_USAGE
-#define DEF_TRACK_USAGE                True
+#define DEF_TRACK_USAGE                False
 #endif
 
 #ifndef DEF_XFT_CACHE
Index: misc.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/misc.c,v
retrieving revision 1.50
diff -u -p -u -r1.50 misc.c
--- misc.c      22 Jan 2023 14:22:05 -0000      1.50
+++ misc.c      28 Jan 2023 17:16:53 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: misc.c,v 1.1030 2022/10/23 22:56:44 tom Exp $ */
+/* $XTermId: misc.c,v 1.1044 2023/01/07 01:11:16 tom Exp $ */
 
 /*
- * Copyright 1999-2021,2022 by Thomas E. Dickey
+ * Copyright 1999-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -3542,6 +3542,28 @@ typedef enum {
 #define OSC_RESET 100
 #define OSC_Reset(code) (code) + OSC_RESET
 
+/*
+ * Other (non-color) OSC controls
+ */
+typedef enum {
+    OSC_IconBoth = 0
+    ,OSC_IconOnly = 1
+    ,OSC_TitleOnly = 2
+    ,OSC_X_Property = 3
+    ,OSC_SetAnsiColor = 4
+    ,OSC_GetAnsiColors = 5
+    ,OSC_ColorMode = 6
+    ,OSC_SetupPointer = 22
+    ,OSC_Unused_30 = 30                /* Konsole (unused) */
+    ,OSC_Unused_31 = 31                /* Konsole (unused) */
+    ,OSC_NewLogFile = 46
+    ,OSC_FontOps = 50
+    ,OSC_Unused_51             /* Emacs (unused) */
+    ,OSC_SelectionData = 52
+    ,OSC_AllowedOps = 60
+    ,OSC_DisallowedOps = 61
+} OscMiscOps;
+
 static Bool
 GetOldColors(XtermWidget xw)
 {
@@ -3693,6 +3715,7 @@ OscToColorIndex(OscTextColors mode)
     case OSC_NCOLORS:
        break;
     }
+#undef CASE
     return result;
 }
 
@@ -3972,6 +3995,44 @@ ChangeFontRequest(XtermWidget xw, String
 
 /***====================================================================***/
 
+static void
+report_allowed_ops(XtermWidget xw, int final)
+{
+    TScreen *screen = TScreenOf(xw);
+    char delimiter = ';';
+
+    unparseputc1(xw, ANSI_OSC);
+    unparseputn(xw, OSC_AllowedOps);
+
+#define CASE(name) \
+    if (screen->name) { \
+       unparseputc(xw, delimiter); \
+       unparseputs(xw, #name); \
+       delimiter = ','; \
+    }
+    CASE(allowColorOps);
+    CASE(allowFontOps);
+    CASE(allowMouseOps);
+    CASE(allowPasteControls);
+    CASE(allowTcapOps);
+    CASE(allowTitleOps);
+    CASE(allowWindowOps);
+#undef CASE
+
+    unparseputc1(xw, final);
+}
+
+static void
+report_disallowed_ops(XtermWidget xw, char *value, int final)
+{
+    unparseputc1(xw, ANSI_OSC);
+    unparseputn(xw, OSC_DisallowedOps);
+    unparse_disallowed_ops(xw, value);
+    unparseputc1(xw, final);
+}
+
+/***====================================================================***/
+
 void
 do_osc(XtermWidget xw, Char *oscbuf, size_t len, int final)
 {
@@ -4058,14 +4119,15 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
      */
     if (xw->work.palette_changed) {
        switch (mode) {
-       case 03:                /* change X property */
-       case 30:                /* Konsole (unused) */
-       case 31:                /* Konsole (unused) */
-       case 50:                /* font operations */
-       case 51:                /* Emacs (unused) */
-#if OPT_PASTE64
-       case 52:                /* selection data */
-#endif
+       case OSC_AllowedOps:
+       case OSC_DisallowedOps:
+       case OSC_FontOps:
+       case OSC_NewLogFile:
+       case OSC_SelectionData:
+       case OSC_Unused_30:
+       case OSC_Unused_31:
+       case OSC_Unused_51:
+       case OSC_X_Property:
            TRACE(("forced repaint after palette changed\n"));
            xw->work.palette_changed = False;
            xtermRepaint(xw);
@@ -4081,10 +4143,10 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
      * a special case.
      */
     switch (mode) {
-    case 50:
+    case OSC_FontOps:
 #if OPT_ISO_COLORS
-    case OSC_Reset(4):
-    case OSC_Reset(5):
+    case OSC_Reset(OSC_SetAnsiColor):
+    case OSC_Reset(OSC_GetAnsiColors):
        need_data = False;
        optional_data = True;
        break;
@@ -4102,6 +4164,7 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
     case OSC_Reset(OSC_TEK_BG):
     case OSC_Reset(OSC_TEK_CURSOR):
 #endif
+    case OSC_AllowedOps:
        need_data = False;
        break;
 #endif
@@ -4135,34 +4198,34 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
     }
 
     switch (mode) {
-    case 0:                    /* new icon name and title */
+    case OSC_IconBoth:         /* new icon name and title */
        ChangeIconName(xw, buf);
        ChangeTitle(xw, buf);
        break;
 
-    case 1:                    /* new icon name only */
+    case OSC_IconOnly:         /* new icon name only */
        ChangeIconName(xw, buf);
        break;
 
-    case 2:                    /* new title only */
+    case OSC_TitleOnly:        /* new title only */
        ChangeTitle(xw, buf);
        break;
 
-    case 3:                    /* change X property */
+    case OSC_X_Property:       /* change X property */
        if (AllowWindowOps(xw, ewSetXprop))
            ChangeXprop(buf);
        break;
 #if OPT_ISO_COLORS
-    case 5:
+    case OSC_GetAnsiColors:
        ansi_colors = NUM_ANSI_COLORS;
        /* FALLTHRU */
-    case 4:
+    case OSC_SetAnsiColor:
        if (ChangeAnsiColorRequest(xw, mode, buf, ansi_colors, final))
            xw->work.palette_changed = True;
        break;
-    case 6:
+    case OSC_ColorMode:
        /* FALLTHRU */
-    case OSC_Reset(6):
+    case OSC_Reset(OSC_ColorMode):
        TRACE(("parse colorXXMode:%s\n", buf));
        while (*buf != '\0') {
            long which = 0;
@@ -4213,10 +4276,10 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
            }
        }
        break;
-    case OSC_Reset(5):
+    case OSC_Reset(OSC_GetAnsiColors):
        ansi_colors = NUM_ANSI_COLORS;
        /* FALLTHRU */
-    case OSC_Reset(4):
+    case OSC_Reset(OSC_SetAnsiColor):
        if (ResetAnsiColorRequest(xw, buf, ansi_colors))
            xw->work.palette_changed = True;
        break;
@@ -4258,17 +4321,12 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
        }
        break;
 
-    case 22:
+    case OSC_SetupPointer:
        xtermSetupPointer(xw, buf);
        break;
 
-    case 30:
-    case 31:
-       /* reserved for Konsole (Stephan Binner <stephan.bin...@gmx.de>) */
-       break;
-
 #ifdef ALLOWLOGGING
-    case 46:                   /* new log file */
+    case OSC_NewLogFile:
 #ifdef ALLOWLOGFILECHANGES
        /*
         * Warning, enabling this feature allows people to overwrite
@@ -4288,7 +4346,7 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
        break;
 #endif /* ALLOWLOGGING */
 
-    case 50:
+    case OSC_FontOps:
 #if OPT_SHIFT_FONTS
        if (*buf == '?') {
            QueryFontRequest(xw, buf, final);
@@ -4297,19 +4355,24 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
        }
 #endif /* OPT_SHIFT_FONTS */
        break;
-    case 51:
-       /* reserved for Emacs shell (Rob Mayoff <may...@dqd.com>) */
-       break;
 
 #if OPT_PASTE64
-    case 52:
+    case OSC_SelectionData:
        ManipulateSelectionData(xw, screen, buf, final);
        break;
 #endif
-       /*
-        * One could write code to send back the display and host names,
-        * but that could potentially open a fairly nasty security hole.
-        */
+
+    case OSC_AllowedOps:       /* XTQALLOWED */
+       report_allowed_ops(xw, final);
+       break;
+
+    case OSC_DisallowedOps:    /* XTQDISALLOWED */
+       report_disallowed_ops(xw, buf, final);
+       break;
+
+    case OSC_Unused_30:
+    case OSC_Unused_31:
+    case OSC_Unused_51:
     default:
        TRACE(("do_osc - unrecognized code\n"));
        break;
@@ -4825,12 +4888,12 @@ do_dcs(XtermWidget xw, Char *dcsbuf, siz
        cp++;
        switch (*cp) {
 #if OPT_TCAP_QUERY
-       case 'p':
+       case 'p':               /* XTSETTCAP */
            if (AllowTcapOps(xw, etSetTcap)) {
                set_termcap(xw, cp + 1);
            }
            break;
-       case 'q':
+       case 'q':               /* XTGETTCAP */
            if (AllowTcapOps(xw, etGetTcap)) {
                Bool fkey;
                unsigned state;
@@ -4909,11 +4972,12 @@ do_dcs(XtermWidget xw, Char *dcsbuf, siz
            break;
 #endif
 #if OPT_XRES_QUERY
-       case 'Q':
+       case 'Q':               /* XTGETXRES */
            ++cp;
            if (AllowXResOps(xw)) {
                Boolean first = True;
-               while (*cp != '\0') {
+               okay = True;
+               while (*cp != '\0' && okay) {
                    const char *parsed = 0;
                    const char *tmp;
                    char *name = x_decode_hex(cp, &parsed);
@@ -4922,6 +4986,9 @@ do_dcs(XtermWidget xw, Char *dcsbuf, siz
                    if (cp == parsed || name == NULL) {
                        free(name);
                        break;  /* no data found, error */
+                   }
+                   if ((cp - parsed) > 1024) {
+                       break;  /* ignore improbable resource */
                    }
                    TRACE(("query-feature '%s'\n", name));
                    if ((value = vt100ResourceToString(xw, name)) != 0) {
Index: ptyx.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/ptyx.h,v
retrieving revision 1.53
diff -u -p -u -r1.53 ptyx.h
--- ptyx.h      7 Nov 2022 11:15:27 -0000       1.53
+++ ptyx.h      28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: ptyx.h,v 1.1076 2022/10/07 08:00:53 Ben.Wong Exp $ */
+/* $XTermId: ptyx.h,v 1.1082 2023/01/02 13:24:41 tom Exp $ */
 
 /*
- * Copyright 1999-2021,2022 by Thomas E. Dickey
+ * Copyright 1999-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -1912,12 +1912,13 @@ typedef struct {
         * FIXME: initially implement for Xft, but replace known_missing[] in
         * X11 fonts as well.
         */
+typedef Char XTfontNum;
 typedef struct {
        int             depth;          /* number of fonts merged for map */
        size_t          limit;          /* allocated size of per_font, etc */
        size_t          first_char;     /* merged first-character index */
        size_t          last_char;      /* merged last-character index */
-       Char *          per_font;       /* index 1-n of first font with char */
+       XTfontNum *     per_font;       /* index 1-n of first font with char */
 } XTermFontMap;
 
 typedef enum {
@@ -1961,11 +1962,13 @@ typedef struct {
        XTermXftState   usage;
 } XTermXftCache;
 
+#define MaxXftCache    MaxUChar
+
 typedef struct {
        XftPattern *    pattern;        /* pattern for main font */
        XftFontSet *    fontset;        /* ordered list of fallback patterns */
-       XTermXftCache   cache[MaxUChar + 1]; /* list of open font pointers */
-       unsigned        fs_size;        /* allocated size of cache[] */
+       XTermXftCache   cache[MaxXftCache + 1]; /* list of open font pointers */
+       int             fs_size;        /* last usable index of cache[] */
        Char            opened;         /* number in cache[] with xcOpened */
        XTermFontInfo   font_info;      /* summary of font metrics */
        XTermFontMap    font_map;       /* map of glyphs provided in fontset */
@@ -2495,8 +2498,8 @@ typedef struct {
        String          disallowedMouseOps;
        char            disallow_mouse_ops[emLAST];
 
-       String          disallowedPasteControls;
-       char            disallow_paste_controls[epLAST];
+       String          disallowedPasteOps;
+       char            disallow_paste_ops[epLAST];
 
        String          disallowedTcapOps;
        char            disallow_tcap_ops[etLAST];
@@ -3227,6 +3230,7 @@ typedef struct _Misc {
     float face_size[NMENUFONTS];
     char *render_font_s;
     int limit_fontsets;
+    int limit_fontwidth;
 #endif
 } Misc;
 
Index: terminfo
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/terminfo,v
retrieving revision 1.15
diff -u -p -u -r1.15 terminfo
--- terminfo    7 Nov 2022 11:15:27 -0000       1.15
+++ terminfo    28 Jan 2023 17:16:54 -0000
@@ -1,10 +1,10 @@
-# $XTermId: terminfo,v 1.204 2022/06/20 23:37:59 tom Exp $
+# $XTermId: terminfo,v 1.206 2023/01/08 10:51:12 tom Exp $
 #
 # Updates/notes/new entries (e.g., xterm-8bit, xterm-16color, xterm-256color)
 # - Thomas E. Dickey
 #
 #------------------------------------------------------------------------------
-# Copyright 1996-2021,2022 by Thomas E. Dickey
+# Copyright 1996-2022,2023 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -145,6 +145,8 @@ xterm-new|modern xterm terminal emulator
        use=xterm+pcfkeys,
        use=xterm+tmux,
        use=xterm+nofkeys,
+       use=bracketed+paste,
+       use=report+version,
 
 # Left/right margins are supported in xterm since patch #279 (2012/05/10)
 vt420+lrmm|VT420 left/right margins,
@@ -965,6 +967,28 @@ xterm+x11mouse|X11 xterm mouse protocol,
                %'\s'%+%c
                %p2%'!'%+%c
                %p1%'!'%+%c,
+
+# https://invisible-island.net/xterm/xterm-paste64.html
+#
+# Bracketed paste was introduced by xterm patch #203 in May 2005, as part of a
+# larger feature for manipulating the clipboard selection.  Few terminals aside
+# from xterm fully implement the clipboard feature, but several copy this
+# detail.  The names for the extended capabilities here were introduced by vim
+# in January 2017, but used internally.  In 2023, vim patch 9.0.1117 is needed
+# to work with this change.
+bracketed+paste|xterm bracketed paste,
+       BD=\E[?2004l,
+       BE=\E[?2004h,
+       PE=\E[201~,
+       PS=\E[200~,
+
+# https://invisible-island.net/xterm/xterm.log.html#xterm_354
+#
+# The response is a DSR sequence identifying the version: DCS > | text ST
+# For example:
+#      ^[P>|XTerm(354)^[\
+report+version|Report xterm name and version (XTVERSION).,
+       RV=\E[>0q,
 
 # This chunk is used for building the VT220/Sun/PC keyboard variants.
 xterm-basic|modern xterm terminal emulator - common,
Index: util.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/util.c,v
retrieving revision 1.43
diff -u -p -u -r1.43 util.c
--- util.c      7 Nov 2022 11:15:27 -0000       1.43
+++ util.c      28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: util.c,v 1.913 2022/09/25 17:46:22 tom Exp $ */
+/* $XTermId: util.c,v 1.914 2023/01/04 09:21:31 tom Exp $ */
 
 /*
- * Copyright 1999-2021,2022 by Thomas E. Dickey
+ * Copyright 1999-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -2699,34 +2699,6 @@ isDefaultBackground(const char *name)
 {
     return (Boolean) !x_strcasecmp(name, XtDefaultBackground);
 }
-
-#if OPT_WIDE_CHARS
-/*
- * Check for Unicode BIDI control characters, which may be miscategorized via
- * wcwidth() and iswprint() as zero-width printable characters.
- */
-Boolean
-isWideControl(unsigned ch)
-{
-    Boolean result;
-
-    switch (ch) {
-    case 0x200E:
-    case 0x200F:
-    case 0x202A:
-    case 0x202B:
-    case 0x202C:
-    case 0x202D:
-    case 0x202E:
-       result = True;
-       break;
-    default:
-       result = False;
-       break;
-    }
-    return result;
-}
-#endif
 
 /***====================================================================***/
 
Index: version.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/version.h,v
retrieving revision 1.57
diff -u -p -u -r1.57 version.h
--- version.h   9 Nov 2022 21:55:15 -0000       1.57
+++ version.h   28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: version.h,v 1.529 2022/10/24 00:25:39 tom Exp $ */
+/* $XTermId: version.h,v 1.536 2023/01/09 10:29:58 tom Exp $ */
 
 /*
- * Copyright 1998-2021,2022 by Thomas E. Dickey
+ * Copyright 1998-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -38,8 +38,8 @@
  * version of X to which this version of xterm has been built.  The resulting
  * number in parentheses is my patch number (Thomas E. Dickey).
  */
-#define XTERM_PATCH   375
-#define XTERM_DATE    2022-10-23
+#define XTERM_PATCH   378
+#define XTERM_DATE    2023-01-09
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm/OpenBSD"
Index: xstrings.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xstrings.c,v
retrieving revision 1.18
diff -u -p -u -r1.18 xstrings.c
--- xstrings.c  10 Jan 2021 09:23:57 -0000      1.18
+++ xstrings.c  28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: xstrings.c,v 1.78 2020/10/12 18:50:28 tom Exp $ */
+/* $XTermId: xstrings.c,v 1.79 2022/11/16 23:54:32 tom Exp $ */
 
 /*
- * Copyright 2000-2019,2020 by Thomas E. Dickey
+ * Copyright 2000-2020,2022 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -395,29 +395,39 @@ x_freeargs(char **argv)
 int
 x_strcasecmp(const char *s1, const char *s2)
 {
-    size_t len = strlen(s1);
+    size_t len1 = (s1 != NULL) ? strlen(s1) : 0;
+    size_t len2 = (s2 != NULL) ? strlen(s2) : 0;
 
-    if (len != strlen(s2))
-       return 1;
-
-    return x_strncasecmp(s1, s2, (unsigned) len);
+    return ((len1 != len2)
+           ? 1
+           : x_strncasecmp(s1, s2, (unsigned) len1));
 }
 
 int
 x_strncasecmp(const char *s1, const char *s2, unsigned n)
 {
-    while (n-- != 0) {
-       char c1 = x_toupper(*s1);
-       char c2 = x_toupper(*s2);
-       if (c1 != c2)
-           return 1;
-       if (c1 == 0)
-           break;
-       s1++;
-       s2++;
+    int result = 0;
+
+    if (s1 != NULL && s2 != NULL) {
+       while (n-- != 0) {
+           char c1 = x_toupper(*s1);
+           char c2 = x_toupper(*s2);
+           if (c1 != c2) {
+               result = 1;
+               break;
+           } else if (c1 == 0) {
+               break;
+           }
+           s1++;
+           s2++;
+       }
+    } else if (s1 == NULL && s2 != NULL) {
+       result = 1;
+    } else if (s1 != NULL && s2 == NULL) {
+       result = 1;
     }
 
-    return 0;
+    return result;
 }
 
 /*
Index: xterm.appdata.xml
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xterm.appdata.xml,v
retrieving revision 1.11
diff -u -p -u -r1.11 xterm.appdata.xml
--- xterm.appdata.xml   9 Nov 2022 21:55:15 -0000       1.11
+++ xterm.appdata.xml   28 Jan 2023 17:16:54 -0000
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright 2014-2021,2022 Thomas Dickey <dic...@invisible-island.net> -->
+<!-- Copyright 2014-2022,2023 Thomas Dickey <dic...@invisible-island.net> -->
 <component type="desktop">
   <id>xterm.desktop</id>
   <metadata_license>CC-BY-3.0</metadata_license>
@@ -35,7 +35,7 @@
     <keyword>terminal</keyword>
   </keywords>
   <releases>
-    <release version="375" date="2022-10-23"/>
+    <release version="378" date="2023-01-09"/>
   </releases>
   <url type="homepage">https://invisible-island.net/xterm/</url>
   <update_contact>dic...@invisible-island.net</update_contact>
Index: xterm.h
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xterm.h,v
retrieving revision 1.53
diff -u -p -u -r1.53 xterm.h
--- xterm.h     9 Nov 2022 21:55:15 -0000       1.53
+++ xterm.h     28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: xterm.h,v 1.919 2022/10/23 13:37:56 tom Exp $ */
+/* $XTermId: xterm.h,v 1.922 2023/01/04 09:21:42 tom Exp $ */
 
 /*
- * Copyright 1999-2021,2022 by Thomas E. Dickey
+ * Copyright 1999-2022,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -550,6 +550,7 @@ extern char **environ;
 #define XtNkeepSelection       "keepSelection"
 #define XtNkeyboardDialect     "keyboardDialect"
 #define XtNlimitFontsets       "limitFontsets"
+#define XtNlimitFontWidth      "limitFontWidth"
 #define XtNlimitResize         "limitResize"
 #define XtNlimitResponse       "limitResponse"
 #define XtNlocale              "locale"
@@ -760,6 +761,7 @@ extern char **environ;
 #define XtCKeepSelection       "KeepSelection"
 #define XtCKeyboardDialect     "KeyboardDialect"
 #define XtCLimitFontsets       "LimitFontsets"
+#define XtCLimitFontWidth      "LimitFontWidth"
 #define XtCLimitResize         "LimitResize"
 #define XtCLimitResponse       "LimitResponse"
 #define XtCLocale              "Locale"
@@ -1028,16 +1030,17 @@ extern void resetCharsets (TScreen * /* 
 extern void resetMargins (XtermWidget /* xw */);
 extern void restoreCharsets (TScreen * /* screen */, DECNRCM_codes * /* source 
*/);
 extern void saveCharsets (TScreen * /* screen */, DECNRCM_codes * /* target 
*/);
-extern void set_max_col(TScreen *  /* screen */, int  /* cols */);
-extern void set_max_row(TScreen *  /* screen */, int  /* rows */);
+extern void set_max_col(TScreen * /* screen */, int  /* cols */);
+extern void set_max_row(TScreen * /* screen */, int  /* rows */);
+extern void unparse_disallowed_ops (XtermWidget /* xw */, char * /* value */);
 extern void unparse_end (XtermWidget /* xw */);
 extern void unparseputc (XtermWidget /* xw */, int  /* c */);
 extern void unparseputc1 (XtermWidget /* xw */, int  /* c */);
 extern void unparseputn (XtermWidget /* xw */, unsigned /* n */);
 extern void unparseputs (XtermWidget /* xw */, const char * /* s */);
 extern void unparseseq (XtermWidget /* xw */, ANSI * /* ap */);
-extern void v_write (int  /* f */, const Char * /* d */, size_t  /* len */);
-extern void xtermAddInput (Widget  /* w */);
+extern void v_write (int /* f */, const Char * /* d */, size_t  /* len */);
+extern void xtermAddInput (Widget /* w */);
 extern void xtermDecodeSCS (XtermWidget /* xw */, int /* which */, int /* 
sgroup */, int /* prefix */, int /* suffix */);
 
 #if OPT_BLINK_CURS
@@ -1761,7 +1764,6 @@ extern void putXtermCell (TScreen * /* s
 #endif
 
 #if OPT_WIDE_CHARS
-extern Boolean isWideControl(unsigned /* ch */);
 extern int DamagedCells(TScreen * /* screen */, unsigned /* n */, int * /* klp 
*/, int * /* krp */, int /* row */, int /* col */);
 extern int DamagedCurCells(TScreen * /* screen */, unsigned /* n */, int * /* 
klp */, int * /* krp */);
 extern unsigned AsciiEquivs(unsigned /* ch */);
Index: xterm.log.html
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xterm.log.html,v
retrieving revision 1.53
diff -u -p -u -r1.53 xterm.log.html
--- xterm.log.html      9 Nov 2022 21:55:15 -0000       1.53
+++ xterm.log.html      28 Jan 2023 17:17:25 -0000
@@ -2,7 +2,7 @@
  *****************************************************************************
  * this file is part of xterm                                                *
  *                                                                           *
- * Copyright 1997-2021,2022 by Thomas E. Dickey                              *
+ * Copyright 1997-2022,2023 by Thomas E. Dickey                              *
  *                                                                           *
  * All Rights Reserved                                                       *
  *                                                                           *
@@ -30,7 +30,7 @@
  * sale, use or other dealings in this Software without prior written        *
  * authorization.                                                            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.2453 2022/10/24 00:25:20 tom Exp $
+  $XTermId: xterm.log.html,v 1.2478 2023/01/09 10:29:25 tom Exp $
   -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <html>
@@ -50,7 +50,7 @@
 <body>
   <hr>
 
-  <p>Copyright &copy; 1997-2021,2022 by <a href=
+  <p>Copyright &copy; 1997-2022,2023 by <a href=
   "mailto:dic...@invisible-island.net";>Thomas E. Dickey</a></p>
 
   <hr>
@@ -70,6 +70,12 @@
   CHANGELOG</a>).</p>
 
   <ul>
+    <li><a href="#xterm_378">Patch #378 - 2023/01/09</a></li>
+
+    <li><a href="#xterm_377">Patch #377 - 2022/11/25</a></li>
+
+    <li><a href="#xterm_376">Patch #376 - 2022/11/16</a></li>
+
     <li><a href="#xterm_375">Patch #375 - 2022/10/23</a></li>
 
     <li><a href="#xterm_374">Patch #374 - 2022/10/10</a></li>
@@ -1026,6 +1032,80 @@
     <li><a href="#xterm_02">Patch #2 - 1996/1/7</a></li>
 
     <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
+  </ul>
+
+  <h1><a name="xterm_378" id="xterm_378">Patch #378 -
+  2023/01/09</a></h1>
+
+  <ul>
+    <li>improve descriptions of <em>XTQMODKEYS</em> and
+    <em>XTQALLOWED</em> features in <tt>ctlseqs.ms</tt> (reports by
+    Bram Moolenaar, Thomas Wolff).</li>
+
+    <li>add <tt>bracketed+paste</tt> and <tt>report+version</tt>
+    building blocks to terminfo, from ncurses 6.4</li>
+
+    <li>improve check for unsupported formatting characters, e.g.,
+    zero-width space, to properly ignore them (report by Thomas
+    Wolff).</li>
+
+    <li>improve/document error-checking for some of the controls
+    which return responses: DECRQSS, XTGETXRES, XTSETTCAP,
+    XTGETTCAP (prompted by discussion with David Leadbeater).</li>
+
+    <li>improve limit-checks for fallback font cache (report by
+    Dimitrije Erdeljan).</li>
+
+    <li>improve check for too-wide glyph in fallback font by
+    allowing xterm to continue searching for a suitable font rather
+    than just failing on the first. Also add
+    <tt>limitFontWidth</tt> to allow changing the amount by which a
+    glyph must extend outside the font's bounding box to disallow
+    it.</li>
+  </ul>
+
+  <h1><a name="xterm_377" id="xterm_377">Patch #377 -
+  2022/11/25</a></h1>
+
+  <ul>
+    <li>add control sequences for reporting the current state of
+    the modified keys options (XTQMODKEYS) and allowed/disallowed
+    operations (XTQALLOWED), (prompted by discussion with Bram
+    Moolenaar).</li>
+
+    <li>amend <code>modifyOtherKeys</code> case 2 to distinguish
+    the escape character with modifiers, e.g., shift-escape, from a
+    plain escape character (suggested by Bram Moolenaar).</li>
+
+    <li>improve parsing and error-recovery in the case where a list
+    of X11 bitmap fonts is given in the <code>-fn</code> and
+    related options.</li>
+
+    <li>change default for <code>xftTrackMemUsage</code> to false,
+    because libXft does not handle certain fonts.</li>
+  </ul>
+
+  <h1><a name="xterm_376" id="xterm_376">Patch #376 -
+  2022/11/16</a></h1>
+
+  <ul>
+    <li>modify configure script to always check for gcc
+    attributes,</li>
+
+    <li>update <code>install-sh</code>.</li>
+
+    <li>fix parsing of <code>result&nbsp;-u</code> in
+    <code>vttests/halves.pl</code>.</li>
+
+    <li>add a note in <code>ctlseqs.ms</code> about compatibility
+    of <code>TBC</code>.</li>
+
+    <li>fix a copy/paste error in manual (patch by Grady
+    Martin).</li>
+
+    <li>add null-pointer checks in <code>x_strcasecmp</code> and
+    <code>x_strncasecmp</code>, to help with error-recovery for a
+    missing font (Debian #1022942).</li>
   </ul>
 
   <h1><a name="xterm_375" id="xterm_375">Patch #375 -
Index: xterm.man
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xterm.man,v
retrieving revision 1.60
diff -u -p -u -r1.60 xterm.man
--- xterm.man   7 Nov 2022 11:15:27 -0000       1.60
+++ xterm.man   28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
 '\" t
-.\" $XTermId: xterm.man,v 1.864 2022/10/08 00:17:27 tom Exp $
+.\" $XTermId: xterm.man,v 1.874 2023/01/08 19:20:45 tom Exp $
 .\"
-.\" Copyright 1996-2021,2022 by Thomas E. Dickey
+.\" Copyright 1996-2022,2023 by Thomas E. Dickey
 .\"
 .\"                         All Rights Reserved
 .\"
@@ -279,8 +279,8 @@ See \fIXterm Control Sequences\fP for de
 .
 .\" ***************************************************************************
 .SH OPTIONS
-Because \fI\*n\fP uses the X Toolkit library,
-it accepts the standard X Toolkit command line options.
+Because \fI\*n\fP uses the \fIX Toolkit\fP library,
+it accepts the standard \fIX Toolkit\fP command line options.
 \fI\*N\fP also accepts many application-specific options.
 .PP
 By convention, if an option begins with a \*(``\fB+\fP\*(''
@@ -288,17 +288,17 @@ instead of a \*(``\fB\-\fP\*('',
 the option is restored to its default value.
 .\" ***************************************************************************
 .PP
-Most of the \fI\*n\fP options are actually parsed by the X Toolkit,
+Most of the \fI\*n\fP options are actually parsed by the \fIX Toolkit\fP,
 which sets resource values, and
 overrides corresponding resource-settings in your X resource files.
-\fI\*N\fP provides the X Toolkit with a table of options.
-A few of these are marked, telling the X Toolkit to ignore them
+\fI\*N\fP provides the \fIX Toolkit\fP with a table of options.
+A few of these are marked, telling the \fIX Toolkit\fP to ignore them
 (\fB\-help\fP,
 \fB\-version\fP,
 \fB\-class\fP,
 \fB\-e\fP, and
 \fB\-into\fP).
-After the X Toolkit has parsed the command-line parameters,
+After the \fIX Toolkit\fP has parsed the command-line parameters,
 it removes those which it handles,
 leaving the specially-marked parameters for \fI\*n\fP to handle.
 .\" ***************************************************************************
@@ -333,9 +333,9 @@ The \fB\-version\fP and \fB\-help\fP opt
 cannot open the display, and are useful for testing and configuration scripts.
 Along with \fB\-class\fP, they are checked before other options.
 To do this, \fI\*n\fP has its own (much simpler) argument parser,
-along with a table of the X Toolkit's built-in list of options.
+along with a table of the \fIX Toolkit\fP's built-in list of options.
 .PP
-Relying upon the X Toolkit to parse the options and associated values
+Relying upon the \fIX Toolkit\fP to parse the options and associated values
 has the advantages of simplicity and good integration with the X resource
 mechanism.
 There are a few drawbacks
@@ -355,7 +355,7 @@ In the design of these options,
 some are deemed more important,
 and can override other options.
 .IP
-The X Toolkit uses patterns (constants and wildcards) to match resources.
+The \fIX Toolkit\fP uses patterns (constants and wildcards) to match resources.
 Once a particular pattern has been used,
 it will not modify it.
 To override a given setting,
@@ -365,7 +365,7 @@ Some poorly-designed resource files are 
 to allow the command-line options to affect the relevant widget values.
 .bP
 In a few cases,
-the X Toolkit combines its standard options in ways which do not work
+the \fIX Toolkit\fP combines its standard options in ways which do not work
 well with \fI\*n\fP.
 This happens with the color (\fB\-fg\fP, \fB\-bg\fP) and reverse (\fB\-rv\fP)
 options.
@@ -524,7 +524,7 @@ Normally it is \*(``__default_class__\*(
 can be set to another class such as
 \*(``U__default_class__\*('' to override selected resources.
 .IP
-X Toolkit sets the \fBWM_CLASS\fP property using the instance name
+\fIX Toolkit\fP sets the \fBWM_CLASS\fP property using the instance name
 and this class value.
 .TP 8
 .B "\-cm"
@@ -605,7 +605,7 @@ When a CJK
 double-width font is specified, you also need to turn
 on the \fBcjkWidth\fP resource.
 .IP
-If you specify both \fB\-fa\fP and the X Toolkit option \fB\-fn\fP,
+If you specify both \fB\-fa\fP and the \fIX Toolkit\fP option \fB\-fn\fP,
 the \fB\-fa\fP setting overrides the latter.
 .IP
 See also the \fBrenderFont\fP resource,
@@ -1363,8 +1363,8 @@ initialization or the \fB\-S\fP option t
 .PP
 The following command line arguments are provided for compatibility with
 older versions.
-They may not be supported in the next release as the X
-Toolkit provides standard options that accomplish the same task.
+They may not be supported in the next release as the
+\fIX Toolkit\fP provides standard options that accomplish the same task.
 .TP 8
 .B "%\fIgeom\fP"
 This option specifies the preferred size and position of the Tektronix window.
@@ -1381,12 +1381,12 @@ It is equivalent to \fB\-title\fP.
 .BI \-n " string"
 This option specifies the icon name for \fI\*n\fP's windows.
 It is shorthand for specifying the \*(``\fBiconName\fP\*('' resource.
-Note that this is not the same as the toolkit option \fB\-name\fP.
+Note that this is not the same as the \fIX Toolkit\fP option \fB\-name\fP.
 The default icon name is the application name.
 .IP
 If no suitable icon is found, \fI\*n\fP provides a compiled-in pixmap.
 .IP
-X Toolkit sets the \fBWM_ICON_NAME\fP property using this value.
+\fIX Toolkit\fP sets the \fBWM_ICON_NAME\fP property using this value.
 .TP 8
 .B \-r
 This option indicates that reverse video should be simulated by swapping
@@ -1400,17 +1400,18 @@ It is equivalent to \fB\-borderwidth\fP 
 .
 .SS X Toolkit Options
 .PP
-The following standard X Toolkit command line arguments are commonly used
+The following standard \fIX Toolkit\fP command line arguments are commonly used
 with \fI\*n\fP:
 .TP 8
 .B \-bd \fIcolor\fP
 This option specifies the color to use for the border of the window.
 The corresponding resource name is \fBborderColor\fP.
-\fI\*N\fP uses the X Toolkit default, which is \*(``XtDefaultForeground\*(''.
+\fI\*N\fP uses the \fIX Toolkit\fP default,
+which is \*(``XtDefaultForeground\*(''.
 .IP
 \fI\*N\fP's VT100 window has two borders:
 the \fIinner\fP border \fBinternalBorder\fP
-and the \fIouter\fP border \fBborderWidth\fP, managed by the X Toolkit.
+and the \fIouter\fP border \fBborderWidth\fP, managed by the \fIX Toolkit\fP.
 .IP
 Normally \fI\*n\fP fills the inner border using the VT100 window's
 background color.
@@ -1446,6 +1447,12 @@ The default is
 This option specifies the font to be used for displaying normal text.
 The corresponding resource name is \fIfont\fP.
 The resource value default is \fIfixed\fP.
+.IP
+\fI\*N\fP's \fB\-fn\fP option accepts a comma-separated list like \fB\-fa\fP,
+for the VT100 widget,
+using the first bitmap font (and discarding additional fonts).
+However, other widgets (such as the toolbar) will be confused by this
+and give a warning.
 .TP 8
 .B \-font \fIfont\fP
 This is the same as \fB\-fn\fP.
@@ -1486,14 +1493,14 @@ The default title is the command
 line specified after the \fB\-e\fP option, if any, otherwise the application
 name.
 .IP
-X Toolkit sets the \fBWM_NAME\fP property using this value.
+\fIX Toolkit\fP sets the \fBWM_NAME\fP property using this value.
 .TP 8
 .B \-xrm \fIresourcestring\fP
 This option specifies a resource string to be used.
 This is especially
 useful for setting resources that do not have separate command line options.
 .PP
-X Toolkit accepts alternate names for a few of these options, e.g.,
+\fIX Toolkit\fP accepts alternate names for a few of these options, e.g.,
 .bP
 \*(``\fB\-background\fP\*('' for \*(``\fB\-bg\fP\*(''
 .bP
@@ -1506,8 +1513,9 @@ Abbreviated options also are supported, 
 .
 .
 .SH RESOURCES
-\fI\*N\fP understands all of the core X Toolkit resource names and classes.
-It also uses the X Toolkit resource types (such as
+\fI\*N\fP understands all of the core
+\fIX Toolkit\fP resource names and classes.
+It also uses the \fIX Toolkit\fP resource types (such as
 booleans,
 colors,
 fonts,
@@ -1517,7 +1525,7 @@ along with their respective converters.
 Those resource types are not always sufficient:
 .bP
 \fI\*N\fP's resource values may be lists of names.
-X Toolkit resource types do not include lists.
+\fIX Toolkit\fP resource types do not include lists.
 \fI\*N\fP uses a string for the resource, and parses it.
 .IP
 Comma-separated lists of names ignore case.
@@ -1811,7 +1819,7 @@ The default is
 .TP 8
 .B "menuHeight\fP (class\fB MenuHeight\fP)"
 Specifies the height of the toolbar,
-which may be increased by the X toolkit layout widget depending upon
+which may be increased by the \fIX Toolkit\fP Layout widget depending upon
 the fontsize used.
 The default is
 \*(``25\*(''.
@@ -1819,7 +1827,7 @@ The default is
 .B "menuLocale\fP (class\fB MenuLocale\fP)"
 Specify the locale used for character-set computations when loading
 the popup menus.
-Use this to improve initialization performance of the Athena popup menus,
+Use this to improve initialization performance of the \fIAthena\fP popup menus,
 which may load unnecessary (and very large) fonts, e.g.,
 in a locale having UTF-8 encoding.
 The default is \*(``C\*('' (POSIX).
@@ -2477,7 +2485,7 @@ default is \*(``true\*(''.
 .TP 8
 .B "awaitInput\fP (class\fB AwaitInput\fP)"
 Specifies whether or not \fI\*n\fR uses a 50 millisecond timeout to
-await input (i.e., to support the Xaw3d arrow scrollbar).
+await input (i.e., to support the \fIXaw3d\fP arrow scrollbar).
 The default is \*(``false\*(''.
 .TP 8
 .B "backarrowKey\fP (class\fB BackarrowKey\fP)"
@@ -3480,7 +3488,7 @@ XTerm*faceName: x:fixed,xft:Bitstream Ve
 .IP
 Two TrueType fonts can be specified in this way.
 The first is the primary font;
-the second acts as a manual override to the fontconfig fontset.
+the second acts as a manual override to the \fIfontconfig\fP fontset.
 .IP
 If no \fBfaceName\fP resource is specified,
 or if there is no match for both TrueType normal and bold fonts,
@@ -3976,7 +3984,8 @@ which change character sets.
 The default is \*(``B\*('', which corresponds to US ASCII.
 .TP 8
 .B "limitFontsets\fP (class\fB LimitFontsets\fP)"
-Limits the number of TrueType fallback fonts (i.e., fontset) which can be 
tested.
+Limits the number of TrueType fallback fonts (i.e., fontset)
+which can be tested.
 The default is \*(``50\*(''.
 No more than \*(``255\*('' will be scanned.
 .IP
@@ -3992,6 +4001,17 @@ to the standard output.
 .IP
 Set this to \*(``0\*('' to disable fallbacks entirely.
 .TP 8
+.B "limitFontWidth\fP (class\fB LimitFontWidth\fP)"
+When looking for fallback fonts, \fI\*n\fP checks to see that the
+the character to be displayed is the same width as the primary font.
+If a character extends outside the font's bounding box,
+\fI\*n\fP will clip it, to fit.
+.IP
+This resource controls the amount by which the character can extend
+outside its bounding box before \fI\*n\fP looks further for a better font.
+.IP
+The default is \*(``10\*('' (percent).
+.TP 8
 .B "limitResize\fP (class\fB LimitResize\fP)"
 Limits resizing of the screen via control sequence to a given multiple of
 the display dimensions.
@@ -4084,7 +4104,7 @@ you can add those after the command, e.g
 .NE
 .IP
 Alternatively,
-you may put those parameter within a shell script to execute the converter,
+you may put those parameters within a shell script to execute the converter,
 and set this resource to point to the shell script.
 .IP
 When using a locale-filter, e.g., with the \fI\-e\fP option, or the shell,
@@ -4363,7 +4383,7 @@ Specifies the number of characters from 
 bell should be rung, when enabled by the \fBmarginBell\fP resource.
 The default is \*(``10\*(''.
 .TP 8
-.B "\fIname\fP\fBKeymap\fP (class\fB \fIName\fP\fBKeymap\fP)"
+.B "\fIname\fBKeymap\fR (class\fB \fIName\fBKeymap\fR)"
 See the discussion of the \fBkeymap()\fP action.
 .TP 8
 .B "nextEventDelay\fP (class\fB NextEventDelay\fP)"
@@ -4928,7 +4948,7 @@ There are several aspects to reverse vid
 The command-line \fB\-rv\fP option tells the X libraries to reverse
 the foreground and background colors.
 \fI\*N\fP's command-line options set resource values.
-In particular, the X Toolkit sets the \fBreverseVideo\fP resource
+In particular, the \fIX Toolkit\fP sets the \fBreverseVideo\fP resource
 when the \fB\-rv\fP option is used.
 .bP
 If the user has also used command-line options \fB\-fg\fP or \fB\-bg\fP
@@ -5251,7 +5271,7 @@ Specifies the key and button bindings fo
 strings\*('', etc.
 The \fBtranslations\fP resource,
 which provides much of \fI\*n\fP's configurability,
-is a feature of the X Toolkit Intrinsics library (Xt).
+is a feature of the \fIX Toolkit Intrinsics\fP library (Xt).
 See the \fBActions\fP section.
 .TP 8
 .B "trimSelection\fP (class\fB TrimSelection\fP)"
@@ -5511,7 +5531,7 @@ The default is \*(``0\*('' to use Xft's 
 Enables glyph memory tracking (introduced in Xft 2.3.5),
 which allows Xft to efficiently discard obsolete data when running
 short of memory.
-The default is \*(``true\*(''.
+The default is \*(``false\*(''.
 .TP 8
 .B "ximFont\fP (class\fB XimFont\fP)"
 This option specifies the font to be used for displaying the preedit string
@@ -5570,7 +5590,7 @@ Specifies the width of the Tektronix win
 .SS Menu Resources
 .PP
 The resources that may be specified for the various menus are described in
-the documentation for the Athena \fBSimpleMenu\fP widget.
+the documentation for the \fIAthena\fP \fBSimpleMenu\fP widget.
 The name and classes of the entries in each of the menus are listed below.
 Resources named \*(``\fBline\fIN\fR\*('' where \fIN\fR is a number
 are separators with class \fBSmeLine\fR.
@@ -5892,7 +5912,7 @@ This entry invokes the \fBset\-visibilit
 .\"
 .SS Scrollbar Resources
 .PP
-The following resources are useful when specified for the Athena Scrollbar
+The following resources are useful when specified for the \fIAthena\fP 
Scrollbar
 widget:
 .TP 8
 .B "background\fP (class\fB Background\fP)"
@@ -6924,7 +6944,7 @@ which can be controlled by writing escap
 These are disabled if the SendEvents feature is enabled:
 .RS
 .TP
-.B Allow Color Ops\fP (resource \fBallow\-font\-ops\fP)
+.B Allow Color Ops\fP (resource \fBallow\-color\-ops\fP)
 This corresponds to the \fBallowColorOps\fP resource.
 Enable or disable control sequences that set/query the colors.
 .TP
@@ -8176,7 +8196,7 @@ keys for entering commonly-typed words:
 Key bindings are normally associated with the \fIvt100\fP or \fItek4014\fP
 widgets which act as terminal emulators.
 \fI\*N\fP's scrollbar (and toolbar if it is configured) are separate widgets.
-Because all of these use the X Toolkit,
+Because all of these use the \fIX Toolkit\fP,
 they have corresponding \fBtranslations\fP resources.
 Those resources are distinct,
 and match different patterns, e.g., the differences in widget-name and
@@ -8540,7 +8560,7 @@ In the output from \fBxprop\fP(1), there
 .TP 5
 .B WM_CLASS
 This shows the \fIinstance name\fP and the X resource \fIclass\fP,
-passed to X Toolkit during initialization of \fI\*n\fP,
+passed to \fIX Toolkit\fP during initialization of \fI\*n\fP,
 e.g.,
 .NS
 WM_CLASS(STRING) = "xterm", "UXTerm"
@@ -8556,7 +8576,7 @@ WM_CLIENT_LEADER(WINDOW): window id # 0x
 .TP 5
 .B WM_COMMAND
 This shows the command-line arguments for \fI\*n\fP
-which are passed to X Toolkit during initialization, e.g.,
+which are passed to \fIX Toolkit\fP during initialization, e.g.,
 .NS
 WM_COMMAND(STRING) = { "xterm", "\-class", "UXTerm", "\-title", "uxterm", 
"\-u8" }
 .NE
@@ -8580,7 +8600,7 @@ This holds the window title, normally at
 It is set via the \fBtitle\fP resource.
 Applications can change this using control sequences.
 .SS Properties set by Xterm
-X Toolkit does not manage EWMH properties.
+\fIX Toolkit\fP does not manage EWMH properties.
 \*N does this directly.
 .TP 5
 .B _NET_WM_ICON_NAME
@@ -8605,7 +8625,8 @@ That may include other window manager hi
 properties for a window manager which claims EWMH compliance.
 .TP 5
 .B _NET_WM_STATE
-This tells \fI\*n\fP whether its window has been maximized by the window 
manager,
+This tells \fI\*n\fP whether
+its window has been maximized by the window manager,
 and if so, what type of maximizing:
 .RS
 .TP 5
@@ -8920,7 +8941,7 @@ https://invisible\-island.net/xterm/xter
 https://invisible\-island.net/xterm/xterm.log.html
 .RE
 .PP
-\fIX Toolkit Intrinsics \(en C Language Interface\fP (Xt),
+\fIX Toolkit Intrinsics \(en C Language Interface\fR (Xt),
 .br
 Joel McCormack, Paul Asente, Ralph R. Swick (1994),
 .br
Index: xtermcap.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/xtermcap.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 xtermcap.c
--- xtermcap.c  10 Jan 2021 09:23:57 -0000      1.15
+++ xtermcap.c  28 Jan 2023 17:16:54 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: xtermcap.c,v 1.56 2020/10/12 18:51:05 tom Exp $ */
+/* $XTermId: xtermcap.c,v 1.58 2023/01/02 18:19:19 tom Exp $ */
 
 /*
- * Copyright 2007-2018,2020 by Thomas E. Dickey
+ * Copyright 2007-2020,2023 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -576,9 +576,10 @@ isLegalTcapName(const char *name)
     Bool result = False;
 
     if (*name != '\0') {
+       int length = 0;
        result = True;
        while (*name != '\0') {
-           if (isgraph(CharOf(*name))) {
+           if (++length < 32 && isgraph(CharOf(*name))) {
                if (strchr("\\|,:'\"", *name) != 0) {
                    result = False;
                    break;
@@ -615,6 +616,7 @@ set_termcap(XtermWidget xw, const char *
        if ((value = x_decode_hex(name, &temp)) != 0) {
            if (*temp == '\0' && isLegalTcapName(value)) {
                if (TcapInit(buffer, value)) {
+                   TRACE(("...set_termcap(%s)\n", NonNull(value)));
 #if !USE_TERMINFO
                    memcpy(screen->tcapbuf, buffer, sizeof(buffer));
 #endif
Index: package/xterm.spec
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/package/xterm.spec,v
retrieving revision 1.36
diff -u -p -u -r1.36 xterm.spec
--- package/xterm.spec  9 Nov 2022 21:55:15 -0000       1.36
+++ package/xterm.spec  28 Jan 2023 17:16:54 -0000
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.152 2022/10/21 00:45:30 tom Exp $
+# $XTermId: xterm.spec,v 1.156 2022/11/26 12:25:02 tom Exp $
 Summary: X terminal emulator (development version)
 %global my_middle xterm
 %global my_suffix -dev
 %global fullname %{my_middle}%{my_suffix}
 %global my_class XTermDev
 Name: %{fullname}
-Version: 375
+Version: 378
 Release: 1
 License: X11
 Group: User Interface/X
@@ -27,7 +27,9 @@ Provides: x-terminal-emulator >= %{versi
 BuildRequires: x11-docs
 %else
 %if %{is_redhat}
-BuildRequires: xorg-x11-docs
+# missing in Fedora 37:
+## BuildRequires: xorg-x11-docs
+BuildRequires: ncurses-devel
 %else
 %if %{is_suse}
 BuildRequires: xorg-docs
@@ -244,6 +246,9 @@ exit 0
 %{_pixmapsdir}/*.xpm
 
 %changelog
+
+* Fri Nov 25 2022 Thomas E. Dickey
+- Fedora 37 has no xorg-x11-docs
 
 * Thu Feb 24 2022 Thomas E. Dickey
 - double-buffer is not enabled by default
Index: package/debian/changelog
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/package/debian/changelog,v
retrieving revision 1.37
diff -u -p -u -r1.37 changelog
--- package/debian/changelog    9 Nov 2022 21:55:15 -0000       1.37
+++ package/debian/changelog    28 Jan 2023 17:16:53 -0000
@@ -1,3 +1,21 @@
+xterm-dev (378) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dic...@invisible-island.net>  Sat, 26 Nov 2022 07:25:02 
-0500
+
+xterm-dev (377) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dic...@invisible-island.net>  Sun, 20 Nov 2022 19:18:58 
-0500
+
+xterm-dev (376) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <dic...@invisible-island.net>  Sun, 30 Oct 2022 06:48:25 
-0400
+
 xterm-dev (375) unstable; urgency=low
 
   * maintenance updates
Index: package/debian/copyright
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/package/debian/copyright,v
retrieving revision 1.12
diff -u -p -u -r1.12 copyright
--- package/debian/copyright    25 Apr 2022 19:20:38 -0000      1.12
+++ package/debian/copyright    28 Jan 2023 17:16:54 -0000
@@ -35,7 +35,7 @@ authorization.
 Files: * */*
 License: MIT-X11
 
-Copyright 1996-2021,2022 by Thomas E. Dickey
+Copyright 1996-2022,2023 by Thomas E. Dickey
 
 (date ranges vary, depending on when the respective files were first changed
 significantly, and run through the most recent change date).
Index: package/freebsd/Makefile
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/package/freebsd/Makefile,v
retrieving revision 1.26
diff -u -p -u -r1.26 Makefile
--- package/freebsd/Makefile    9 Nov 2022 21:55:15 -0000       1.26
+++ package/freebsd/Makefile    28 Jan 2023 17:16:54 -0000
@@ -1,4 +1,4 @@
-# $XTermId: Makefile,v 1.96 2022/10/21 00:45:30 tom Exp $
+# $XTermId: Makefile,v 1.99 2022/11/26 12:25:02 tom Exp $
 # $FreeBSD: head/x11/xterm/Makefile 492827 2019-02-13 06:43:36Z ehaupt $
 
 # This is adapted from the FreeBSD port, installing as "xterm-dev" with
@@ -7,7 +7,7 @@
 # and "make makesum".
 
 PORTNAME=      xterm
-PORTVERSION=   375
+PORTVERSION=   378
 CATEGORIES=    x11
 MASTER_SITES=  ftp://ftp.invisible-island.net/xterm/:src1 \
                https://invisible-mirror.net/archives/xterm/:src1
Index: package/pkgsrc/Makefile
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/package/pkgsrc/Makefile,v
retrieving revision 1.8
diff -u -p -u -r1.8 Makefile
--- package/pkgsrc/Makefile     9 Nov 2022 21:55:15 -0000       1.8
+++ package/pkgsrc/Makefile     28 Jan 2023 17:16:54 -0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.117 2018/03/12 11:18:00 wiz Exp $
 
-DISTNAME=      xterm-375
+DISTNAME=      xterm-378
 PKGREVISION=   1
 CATEGORIES=    x11
 MASTER_SITES=  ftp://ftp.invisible-island.net/xterm/
Index: vttests/halves.pl
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/vttests/halves.pl,v
retrieving revision 1.2
diff -u -p -u -r1.2 halves.pl
--- vttests/halves.pl   7 Nov 2022 11:15:28 -0000       1.2
+++ vttests/halves.pl   28 Jan 2023 17:16:54 -0000
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $XTermId: halves.pl,v 1.10 2022/10/10 23:59:05 tom Exp $
+# $XTermId: halves.pl,v 1.11 2022/11/17 00:45:00 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
@@ -53,6 +53,7 @@ sub screen_width() {
         if ( $input[$n] =~ /^COLUMNS=/ ) {
             $result = $input[$n];
             $result =~ s/^[^=]*=//;
+            $result =~ s/;.*//;
             last;
         }
     }
@@ -84,8 +85,8 @@ sub double_cells($) {
     pack(
         "U*",
         map {
-            ( $_ <= 32 || $_ > 127 )    # if non-ASCII character...
-              ? 32                      # ...just show a blank
+            ( $_ <= 32 || $_ > 127 )        # if non-ASCII character...
+              ? 32                          # ...just show a blank
               : ( 0xff00 + ( $_ - 32 ) )    # map to "Fullwidth Form"
         } unpack( "C*", $value )
     );                                      # unpack unsigned-char characters
Index: vttests/modify-keys.pl
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/xterm/vttests/modify-keys.pl,v
retrieving revision 1.2
diff -u -p -u -r1.2 modify-keys.pl
--- vttests/modify-keys.pl      10 Jan 2021 09:23:58 -0000      1.2
+++ vttests/modify-keys.pl      28 Jan 2023 17:16:54 -0000
@@ -1,9 +1,9 @@
 #!/usr/bin/env perl
-# $XTermId: modify-keys.pl,v 1.91 2020/11/15 16:43:35 tom Exp $
+# $XTermId: modify-keys.pl,v 1.92 2022/11/24 12:43:26 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2019,2020 by Thomas E. Dickey
+# Copyright 2019-2020,2022 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -612,7 +612,10 @@ sub ModifyOtherKeys($$$$) {
                     $result = 1
                       if ( &computeMaskedModifier( $state, $ShiftMask ) );
                 }
-                elsif ( $sym eq "XK_Return" or $sym eq "XK_Tab" ) {
+                elsif ($sym eq "XK_Escape"
+                    or $sym eq "XK_Return"
+                    or $sym eq "XK_Tab" )
+                {
 
                     $result = ( $modify_parm != 0 );
                 }
@@ -620,8 +623,8 @@ sub ModifyOtherKeys($$$$) {
                     if ( &IsControlInput($code) ) {
                         $result = 1;
                     }
-                    elsif ( $state == $ShiftMask ) {
-                        $result = ( $sym eq "XK_space" or $sym eq "XK_Return" 
);
+                    elsif ( $state == $ShiftMask and $sym eq "XK_space" ) {
+                        $result = 1;
                     }
                     elsif ( &computeMaskedModifier( $state, $ShiftMask ) ) {
                         $result = 1;

-- 
Matthieu Herrb

Reply via email to