xterm-127.patch.txt

# ------------------------------------------------------------------------------
#  XTerm.ad       |    3 ++-
#  charproc.c     |    7 +++++++
#  ctlseqs.ms     |    4 +++-
#  input.c        |   31 ++++++++-----------------------
#  menu.c         |   23 +++++++++++++++++++++++
#  menu.h         |    7 +++++++
#  ptyx.h         |   19 ++++++++++++++++++-
#  version.h      |    4 ++--
#  xterm.h        |    2 ++
#  xterm.log.html |   16 ++++++++++++++++
#  xterm.man      |   17 +++++++++++++++++
#  11 files changed, 105 insertions, 28 deletions
# ------------------------------------------------------------------------------
Index: XTerm.ad
--- xterm-126+/XTerm.ad Sat Feb 12 06:47:41 2000
+++ xterm-127/XTerm.ad  Sat Feb 12 15:54:48 2000
@@ -22,9 +22,10 @@
 *mainMenu*print*Label:  Print Window
 *mainMenu*redraw*Label:  Redraw Window
 *mainMenu*8-bit control*Label: 8-Bit Controls
-*mainMenu*backarrow key*Label: Backarrow Key
+*mainMenu*backarrow key*Label: Backarrow Key (BS/DEL)
 *mainMenu*num-lock*Label: Alt/NumLock Modifiers
 *mainMenu*meta-esc*Label: Meta Sends Escape
+*mainMenu*delete-is-del*Label: Delete is DEL
 *mainMenu*old function-keys*Label: Old Function-Keys
 *mainMenu*sun function-keys*Label: Sun Function-Keys
 *mainMenu*sun keyboard*Label: VT220 Keyboard
Index: charproc.c
--- xterm-126+/charproc.c       Sat Feb 12 06:47:41 2000
+++ xterm-127/charproc.c        Sat Feb 12 16:15:53 2000
@@ -283,6 +283,8 @@
     { "print",                 HandlePrint },
     { "quit",                  HandleQuit },
     { "redraw",                        HandleRedraw },
+    { "delete-is-del",         HandleDeleteIsDEL },
+    { "meta-sends-escape",     HandleMetaEsc },
     { "scroll-back",           HandleScrollBack },
     { "scroll-forw",           HandleScrollForward },
     { "secure",                        HandleSecure },
@@ -468,6 +470,7 @@
 {XtNoldXtermFKeys, XtCOldXtermFKeys, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, screen.old_fkeys),
        XtRBoolean, (XtPointer) &defaultFALSE},
+Bres(XtNdeleteIsDEL,   XtCDeleteIsDEL,         screen.delete_is_del,   FALSE),
 #ifdef ALLOWLOGGING
 {XtNlogFile, XtCLogfile, XtRString, sizeof(char *),
        XtOffsetOf(XtermWidgetRec, screen.logfile),
@@ -3269,6 +3272,9 @@
                        screen->meta_sends_esc = (func == bitset) ? ON : OFF;
                        break;
 #endif
+               case 1037:
+                       screen->delete_is_del = (func == bitset) ? ON : OFF;
+                       break;
                case 1048:
                        if (!termw->misc.titeInhibit) {
                                if(func == bitset)
@@ -4182,6 +4188,7 @@
    wnew->screen.border = request->screen.border;
    wnew->screen.jumpscroll = request->screen.jumpscroll;
    wnew->screen.old_fkeys = request->screen.old_fkeys;
+   wnew->screen.delete_is_del = request->screen.delete_is_del;
    init_keyboard_type(keyboardIsLegacy, wnew->screen.old_fkeys);
 #ifdef ALLOWLOGGING
    wnew->screen.logfile = request->screen.logfile;
Index: ctlseqs.ms
--- xterm-126+/ctlseqs.ms       Sat Feb 12 06:47:41 2000
+++ xterm-127/ctlseqs.ms        Sat Feb 12 16:11:49 2000
@@ -740,6 +740,7 @@
   \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys.
   \*(Ps = \*1\*0\*3\*6 \(-> Send ESC when Meta modifies a key
 (enables the \fBmetaSendsEscape\fP resource).
+  \*(Ps = \*1\*0\*3\*7 \(-> Send DEL from the editing-keypad Delete key
   \*(Ps = \*1\*0\*4\*7 \(-> Use Alternate Screen Buffer (unless
 disabled by the \fBtiteInhibit\fP resource)
   \*(Ps = \*1\*0\*4\*8 \(-> Save cursor as in DECSC (unless
@@ -810,6 +811,7 @@
   \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for Alt and NumLock keys.
   \*(Ps = \*1\*0\*3\*6 \(-> Don't send ESC when Meta modifies a key
 (disables the \fBmetaSendsEscape\fP resource).
+  \*(Ps = \*1\*0\*3\*7 \(-> Send VT220 Remove from the editing-keypad Delete key
   \*(Ps = \*1\*0\*4\*7 \(-> Use Normal Screen Buffer, clearing screen
 first if in the Alternate Screen (unless
 disabled by the \fBtiteInhibit\fP resource)
@@ -865,7 +867,7 @@
   \*(Ps = \*9\*3 \(-> Set foreground color to Yellow
   \*(Ps = \*9\*4 \(-> Set foreground color to Blue
   \*(Ps = \*9\*5 \(-> Set foreground color to Magenta
-  \*(Ps = \*9\*7 \(-> Set foreground color to Cyan
+  \*(Ps = \*9\*6 \(-> Set foreground color to Cyan
   \*(Ps = \*9\*7 \(-> Set foreground color to White
   \*(Ps = \*1\*0\*0 \(-> Set background color to Black
   \*(Ps = \*1\*0\*1 \(-> Set background color to Red
Index: input.c
--- xterm-126+/input.c  Sat Feb 12 06:47:41 2000
+++ xterm-127/input.c   Sat Feb 12 16:37:26 2000
@@ -408,22 +408,6 @@
        }
 #endif
 
-#if OPT_NUM_LOCK
-       /*
-        * Send ESC if we have a META modifier and metaSendsEcape is true.
-        * This is similar to the effect of 'eightbit' when eightBitInput
-        * is false, except that we do this for all keys, including function
-        * keys.
-        */
-       if (screen->meta_sends_esc
-        && !term->misc.meta_trans
-        && ((event->state & term->misc.meta_left) != 0
-         || (event->state & term->misc.meta_right)) != 0) {
-               TRACE(("...input is modified by META\n"));
-               eightbit = False;
-               unparseputc (ESC, pty);  /* escape */
-       }
-#endif
        /*
         * If we are in the normal (possibly Sun/PC) keyboard state, allow
         * modifiers to add a parameter to the function-key control sequences.
@@ -541,9 +525,11 @@
                || (keysym == XK_Delete
                 && ((modify_parm > 1)
 #if OPT_SUNPC_KBD
-                 || term->keyboard.type == keyboardIsVT220)
+                 || ( !screen->delete_is_del
+                  && term->keyboard.type == keyboardIsDefault)
+                 || term->keyboard.type == keyboardIsVT220
 #endif
-                 )) {
+                 ))) {
 #if OPT_SUNPC_KBD
                if (term->keyboard.type == keyboardIsVT220) {
                        if ((event->state & ControlMask)
@@ -565,7 +551,7 @@
                /*
                 * Interpret F1-F4 as PF1-PF4 for VT52, VT100
                 */
-               else if (term->keyboard.type != keyboardIsSun 
+               else if (term->keyboard.type != keyboardIsSun
                 && term->keyboard.type != keyboardIsLegacy
                 && (dec_code >= 11 && dec_code <= 14))
                {
@@ -621,9 +607,8 @@
 #if OPT_NUM_LOCK
                        /*
                         * Send ESC if we have a META modifier and
-                        * metaSendsEcape is true.  This case applies only if
-                        * we decided to not modify function keys because META
-                        * is used in translations.
+                        * metaSendsEcape is true.  Like eightBitInput, except
+                        * that it is not associated with terminal settings.
                         */
                        if (eightbit
                         && screen->meta_sends_esc
@@ -677,7 +662,7 @@
 {
        int     pty     = screen->respond;
 
-       TRACE(("InputString %s\n", visibleChars(PAIRED_CHARS(string,0), nbytes)));
+       TRACE(("InputString (%s,%d)\n", visibleChars(PAIRED_CHARS(string,0), nbytes), nbytes));
 #if OPT_TEK4014
        if(nbytes && screen->TekGIN) {
                TekEnqMouse(*string++);
Index: menu.c
--- xterm-126+/menu.c   Sat Feb 12 06:47:41 2000
+++ xterm-127/menu.c    Sat Feb 12 15:52:14 2000
@@ -89,6 +89,7 @@
 static void do_clearsavedlines PROTO_XT_CALLBACK_ARGS;
 static void do_continue        PROTO_XT_CALLBACK_ARGS;
 static void do_cursesemul      PROTO_XT_CALLBACK_ARGS;
+static void do_delete_del      PROTO_XT_CALLBACK_ARGS;
 static void do_hardreset       PROTO_XT_CALLBACK_ARGS;
 static void do_interrupt       PROTO_XT_CALLBACK_ARGS;
 static void do_jumpscroll      PROTO_XT_CALLBACK_ARGS;
@@ -187,6 +188,7 @@
     { "num-lock",      do_num_lock,    NULL },
     { "meta-esc",      do_meta_esc,    NULL },
 #endif
+    { "delete-is-del", do_delete_del,  NULL },
     { "old function-keys",do_old_fkeys,        NULL },
 #if OPT_HP_FUNC_KEYS
     { "hp function-keys",do_hp_fkeys,  NULL },
@@ -476,6 +478,7 @@
            update_decbkm();
            update_num_lock();
            update_meta_esc();
+           update_delete_del();
            update_keyboard_type();
            if (screen->terminal_id < 200) {
                set_sensitivity (mw,
@@ -744,6 +747,15 @@
 }
 #endif
 
+static void do_delete_del (
+       Widget gw GCC_UNUSED,
+       XtPointer closure GCC_UNUSED,
+       XtPointer data GCC_UNUSED)
+{
+    term->screen.delete_is_del = ! term->screen.delete_is_del;
+    update_delete_del();
+}
+
 static void do_old_fkeys (
        Widget gw GCC_UNUSED,
        XtPointer closure GCC_UNUSED,
@@ -1524,6 +1536,16 @@
 }
 #endif
 
+void HandleDeleteIsDEL(
+       Widget w,
+       XEvent *event GCC_UNUSED,
+       String *params,
+       Cardinal *param_count)
+{
+    handle_toggle (do_delete_del, term->screen.delete_is_del,
+                  params, *param_count, w, (XtPointer)0, (XtPointer)0);
+}
+
 void HandleOldFunctionKeys(
        Widget w,
        XEvent *event GCC_UNUSED,
@@ -1533,6 +1555,7 @@
     handle_toggle (do_old_fkeys, term->keyboard.type == keyboardIsLegacy,
                   params, *param_count, w, (XtPointer)0, (XtPointer)0);
 }
+
 #if OPT_SUNPC_KBD
 void HandleSunKeyboard(
        Widget w,
Index: menu.h
--- xterm-126+/menu.h   Sat Feb 12 06:47:41 2000
+++ xterm-127/menu.h    Sat Feb 12 15:53:00 2000
@@ -87,6 +87,7 @@
 extern void HandleCreateMenu       PROTO_XT_ACTIONS_ARGS;
 extern void HandleCursesEmul       PROTO_XT_ACTIONS_ARGS;
 extern void HandleCursorBlink      PROTO_XT_ACTIONS_ARGS;
+extern void HandleDeleteIsDEL      PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontDoublesize   PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontLoading      PROTO_XT_ACTIONS_ARGS;
 extern void HandleHardReset        PROTO_XT_ACTIONS_ARGS;
@@ -146,6 +147,7 @@
     mainMenu_num_lock,
     mainMenu_meta_esc,
 #endif
+    mainMenu_delete_del,
     mainMenu_old_fkeys,
 #if OPT_HP_FUNC_KEYS
     mainMenu_hp_fkeys,
@@ -327,6 +329,11 @@
   update_menu_item (term->screen.mainMenu, \
                    mainMenuEntries[mainMenu_old_fkeys].widget, \
                    term->keyboard.type == keyboardIsLegacy)
+
+#define update_delete_del() \
+  update_menu_item (term->screen.mainMenu, \
+                   mainMenuEntries[mainMenu_delete_del].widget, \
+                   term->screen.delete_is_del)
 
 #if OPT_SUNPC_KBD
 #define update_sun_kbd() \
Index: ptyx.h
--- xterm-126+/ptyx.h   Sat Feb 12 06:47:41 2000
+++ xterm-127/ptyx.h    Sat Feb 12 15:34:41 2000
@@ -318,9 +318,25 @@
                                 ((n)==TEK_FG?TEK_BG:\
                                 ((n)==TEXT_BG?TEK_FG:(n))))))))
 
+#ifndef RES_OFFSET
+#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset)
+#endif
+
+#define Bres(name,class,offset,value) \
+       {name, class, XtRBoolean, sizeof(Boolean), \
+        RES_OFFSET(offset), XtRImmediate, (XtPointer) value}
+
+#define Ires(name,class,offset,value) \
+       {name, class, XtRInt, sizeof(int), \
+        RES_OFFSET(offset), XtRInt, (XtPointer) value}
+
+#define Sres(name,class,offset,value) \
+       {name, class, XtRString, sizeof(String), \
+        RES_OFFSET(offset), XtRString, (XtPointer) value}
+
 #define COLOR_RES(name,offset,value) \
        {name, XtCForeground, XtRPixel, sizeof(Pixel), \
-        XtOffsetOf(XtermWidgetRec, offset), XtRString, value}
+        RES_OFFSET(offset), XtRString, value}
 
 typedef struct {
        unsigned        which;  /* must have NCOLORS bits */
@@ -1014,6 +1030,7 @@
        int             refresh_amt;    /* amount to refresh            */
        int             protected_mode; /* 0=off, 1=DEC, 2=ISO          */
        Boolean         old_fkeys;      /* true for compatible fkeys    */
+       Boolean         delete_is_del;  /* true for compatible Delete key */
        Boolean         jumpscroll;     /* whether we should jumpscroll */
        Boolean         always_highlight; /* whether to highlight cursor */
        Boolean         underline;      /* whether to underline text    */
Index: version.h
--- xterm-126+/version.h        Sat Feb 12 06:47:41 2000
+++ xterm-127/version.h Sat Feb 12 16:25:53 2000
@@ -6,5 +6,5 @@
  * XFree86 to which this version of xterm has been built.  The number in
  * parentheses is my patch number (T.Dickey).
  */
-#define XTERM_PATCH   126
-#define XFREE86_VERSION "XFree86 3.9.17c"
+#define XTERM_PATCH   127
+#define XFREE86_VERSION "XFree86 3.9.17e"
Index: xterm.h
--- xterm-126+/xterm.h  Sat Feb 12 06:47:41 2000
+++ xterm-127/xterm.h   Sat Feb 12 15:35:28 2000
@@ -248,6 +248,7 @@
 #define XtNcutNewline          "cutNewline"
 #define XtNcutToBeginningOfLine        "cutToBeginningOfLine"
 #define XtNdecTerminalID       "decTerminalID"
+#define XtNdeleteIsDEL         "deleteIsDEL"
 #define XtNdynamicColors       "dynamicColors"
 #define XtNeightBitControl     "eightBitControl"
 #define XtNeightBitInput       "eightBitInput"
@@ -330,6 +331,7 @@
 #define XtCCutNewline          "CutNewline"
 #define XtCCutToBeginningOfLine        "CutToBeginningOfLine"
 #define XtCDecTerminalID       "DecTerminalID"
+#define XtCDeleteIsDEL         "DeleteIsDEL"
 #define XtCDynamicColors       "DynamicColors"
 #define XtCEightBitControl     "EightBitControl"
 #define XtCEightBitInput       "EightBitInput"
Index: xterm.log.html
--- xterm-126+/xterm.log.html   Sat Feb 12 06:47:41 2000
+++ xterm-127/xterm.log.html    Sat Feb 12 16:05:10 2000
@@ -41,6 +41,7 @@
 xc/programs/Xserver/hw/xfree86).
 
 <UL>
+<LI><A HREF="#xterm_127">Patch #127 - 2000/2/12 - XFree86 3.9.17e</A>
 <LI><A HREF="#xterm_126">Patch #126 - 2000/2/8 - XFree86 3.9.17c</A>
 <LI><A HREF="#xterm_125">Patch #125 - 2000/1/31 - XFree86 3.9.17c</A>
 <LI><A HREF="#xterm_124">Patch #124 - 2000/1/27 - XFree86 3.9.17b</A>
@@ -169,6 +170,21 @@
 <LI><A HREF="#xterm_02">Patch #2 - 1996/1/7</A>
 <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
 </UL>
+
+<H1><A NAME="xterm_127">Patch #127 - 2000/2/12 - XFree86 3.9.17e</A></H1>
+<ul>
+       <li>add resource, popup menu entry and control sequence to allow
+         changing the Delete key to send either DEL or the VT220-style
+         Remove escape sequence.
+
+       <li>remove logic for metaSendsEscape that would allow xterm to send
+         <code>&lt;esc&gt;[3~</code> before a function key that would begin
+         with <code>&lt;esc&gt;[3~</code> (request by Christian Weisgerber).
+
+       <li>add missing action and documentation for meta-sends-escape.
+
+       <li>correct a few typos in ctlseqs.ms (incorrect code for Cyan color)
+</ul>
 
 <H1><A NAME="xterm_126">Patch #126 - 2000/2/8 - XFree86 3.9.17c</A></H1>
 <ul>
Index: xterm.man
--- xterm-126+/xterm.man        Sat Feb 12 06:47:41 2000
+++ xterm-127/xterm.man Sat Feb 12 16:24:17 2000
@@ -1073,6 +1073,11 @@
 the type of response to a DA control sequence.
 The default is 100.
 .TP 8
+.B "deleteIsDEL (\fPclass\fB DeleteIsDEL)"
+Specifies whether the Delete key on the editing keypad should send DEL (127)
+or the VT220-style Remove escape sequence.
+The default is ``false,'' for the latter.
+.TP 8
 .B "dynamicColors (\fPclass\fB DynamicColors)"
 Specifies whether or not escape sequences to change colors assigned to
 different attributes are recognized.
@@ -1467,6 +1472,12 @@
 .B "num-lock (\fPclass\fB SmeBSB)"
 This entry invokes the \fBset-num-lock(toggle)\fP action.
 .TP 8
+.B "meta-esc (\fPclass\fB SmeBSB)"
+This entry invokes the \fBmeta-sends-escape(toggle)\fP action.
+.TP 8
+.B "delete-is-del (\fPclass\fB SmeBSB)"
+This entry invokes the \fBdelete-is-del(toggle)\fP action.
+.TP 8
 .B "old\ function-keys (\fPclass\fB SmeBSB)"
 This entry invokes the \fBold\ function-keys(toggle)\fP action.
 .TP 8
@@ -2008,6 +2019,9 @@
 .B "deiconify()"
 Changes the window state back to normal, if it was iconified.
 .TP 8
+.B "delete-is-del()"
+This action toggles the state of the \fBdeleteIsDEL\fP resource.
+.TP 8
 .B "dired-button()"
 Handles a button event (other than press and release)
 by echoing the event's position
@@ -2063,6 +2077,9 @@
 .TP 8
 .B "maximize()"
 Resizes the window to fill the screen.
+.TP 8
+.B "meta-sends-escape()"
+This action toggles the state of the \fBmetaSendsEscape\fP resource.
 .TP 8
 .B "popup-menu(\fImenuname\fP)"
 This action displays the specified popup menu.  Valid names (case is