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

xterm: Changes to 'upstream-unstable'



 INSTALL                  |    6 
 MANIFEST                 |    2 
 charproc.c               |   24 -
 configure                |    6 
 configure.in             |    6 
 ctlseqs.ms               |  129 ++++-
 ctlseqs.txt              |  119 ++++-
 fontutils.c              |   53 +-
 graphics.c               |   53 +-
 graphics.h               |    7 
 graphics_regis.c         | 1022 ++++++++++++++++++++++++++++++++++-------------
 main.c                   |    7 
 misc.c                   |   17 
 package/debian/changelog |    6 
 package/freebsd/Makefile |    2 
 package/xterm.spec       |    4 
 version.h                |    6 
 vttests/fonts.sh         |    7 
 xterm.h                  |    4 
 xterm.log.html           |   60 ++
 xterm.man                |    6 
 xtermcfg.hin             |    3 
 22 files changed, 1134 insertions(+), 415 deletions(-)

New commits:
commit e27b1046f0ab81daba99fa741507e5bf9826867d
Author: Sven Joachim <svenjoac@gmx.de>
Date:   Thu Aug 20 19:54:05 2015 +0200

    Imported Upstream version 319

diff --git a/INSTALL b/INSTALL
index 7c4dfd2..f049a7c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
--- $XTermId: INSTALL,v 1.157 2015/04/12 20:44:43 tom Exp $
+-- $XTermId: INSTALL,v 1.158 2015/08/10 23:38:32 tom Exp $
 -------------------------------------------------------------------------------
 -- Copyright 1997-2014,2015 by Thomas E. Dickey
 --
@@ -385,14 +385,14 @@ The options (in alphabetic order):
 
 	This sets the default resource value, which is shown in the manpage.
 
-  --enable-broken-osc     allow broken Linux OSC-strings],
+  --enable-broken-osc     allow broken Linux OSC-strings
 
 	Compile-in code to accommodate scripts that write Linux's malformed
 	palette control strings without checking.  The result makes xterm
 	appear to freeze.  This workaround makes xterm ignore the strings,
 	and is compiled-in by default for Linux.
 
-  --enable-builtin-xpms   allow broken Linux OSC-strings],
+  --enable-builtin-xpms   compile-in icon data
 
 	Compile-in X pixmap data for these icons:
 		filled-xterm
diff --git a/MANIFEST b/MANIFEST
index 455149c..424d573 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-318, version xterm-318
+MANIFEST for xterm-319, version xterm-319
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
diff --git a/charproc.c b/charproc.c
index df6adf4..c331a5f 100644
--- a/charproc.c
+++ b/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1409 2015/04/12 16:57:00 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1413 2015/07/15 09:21:40 tom Exp $ */
 
 /*
  * Copyright 1999-2014,2015 by Thomas E. Dickey
@@ -7075,9 +7075,23 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text)
 
     TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text));
 
-    if ((int) (askedWidth = (Dimension) cols) < cols
-	|| (int) (askedHeight = (Dimension) rows) < rows)
-	return;
+    /* check first if the row/column values fit into a Dimension */
+    if (cols > 0) {
+	if ((int) (askedWidth = (Dimension) cols) < cols) {
+	    TRACE(("... cols too large for Dimension\n"));
+	    return;
+	}
+    } else {
+	askedWidth = 0;
+    }
+    if (rows > 0) {
+	if ((int) (askedHeight = (Dimension) rows) < rows) {
+	    TRACE(("... rows too large for Dimension\n"));
+	    return;
+	}
+    } else {
+	askedHeight = 0;
+    }
 
     if (askedHeight == 0
 	|| askedWidth == 0
@@ -10921,7 +10935,7 @@ HandleKeymapChange(Widget w,
     size_t len;
 
     TRACE(("HandleKeymapChange(%#lx, %s)\n",
-	   w,
+	   (unsigned long) w,
 	   (*param_count
 	    ? params[0]
 	    : "missing")));
diff --git a/configure b/configure
index 39486ea..3919996 100755
--- a/configure
+++ b/configure
@@ -15807,13 +15807,13 @@ if test "${enable_builtin_xpms+set}" = set; then
   enableval="$enable_builtin_xpms"
   test "$enableval" != yes && enableval=no
   if test "$enableval" != "no" ; then
-    enable_builtin_xpms=no
-  else
     enable_builtin_xpms=yes
+  else
+    enable_builtin_xpms=no
   fi
 else
   enableval=no
-  enable_builtin_xpms=yes
+  enable_builtin_xpms=no
 
 fi;
 echo "$as_me:15819: result: $enable_builtin_xpms" >&5
diff --git a/configure.in b/configure.in
index ff5d563..d5139f4 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.335 2015/04/12 20:41:52 tom Exp $
+dnl $XTermId: configure.in,v 1.336 2015/08/10 23:45:36 tom Exp $
 dnl
 dnl -----------------------------------------------------------------------------
 dnl this file is part of xterm
@@ -495,8 +495,8 @@ test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0,[Define to 0 to disal
 AC_MSG_CHECKING(if you want to compile-in icon data)
 CF_ARG_ENABLE(builtin-xpms,
 	[  --enable-builtin-xpms   compile-in icon data],
-	[enable_builtin_xpms=no],
-	[enable_builtin_xpms=yes])
+	[enable_builtin_xpms=yes],
+	[enable_builtin_xpms=no])
 AC_MSG_RESULT($enable_builtin_xpms)
 test "$enable_builtin_xpms" = yes && AC_DEFINE(OPT_BUILTIN_XPMS,1,[Define to 1 to compile-in icon data])
 
diff --git a/ctlseqs.ms b/ctlseqs.ms
index 8a42eee..89f3a89 100644
--- a/ctlseqs.ms
+++ b/ctlseqs.ms
@@ -1,6 +1,6 @@
 .\"#! troff -ms $1		-*- Nroff -*-
 .\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.320 2015/04/12 20:55:48 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.324 2015/08/19 23:20:41 tom Exp $
 .\"
 .\"
 .\" Copyright 1996-2014,2015 by Thomas E. Dickey
@@ -70,7 +70,7 @@
 .ds XT XTerm
 .ds xt xterm
 .ds LF Patch #318
-.ds RF 2015/04/12
+.ds RF 2015/08/19
 .\"
 .if n .pl 9999v		\" no page breaks in nroff
 .ND
@@ -114,6 +114,13 @@
 \\$*
 .br
 ..
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds AQ \(aq
+.el       .ds AQ '
+.ie \n(.g .ds `` \(lq
+.el       .ds `` ``
+.ie \n(.g .ds '' \(rq
+.el       .ds '' ''
 .ds CH \" as nothing
 .ds LH \*(XT Control Sequences
 .nr s 6*\n(PS/10
@@ -351,6 +358,62 @@ Individual values for the parameters are listed with \*(Ps .
 .IP \*(Pt
 A text parameter composed of printable characters.
 .
+.Sh "Control Bytes, Characters, and Sequences"
+.LP
+ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
+Those are respectively codes 128 to 159 and 0 to 31.
+ECMA-48 avoids referring to these codes as characters,
+because that term is associated with \fIgraphic characters\fP.
+Instead, it uses \*(``bytes\*('' and \*(``codes\*('',
+with occasional lapses to \*(``characters\*(''
+where the meaning cannot be mistaken.
+.LP
+Controls (including the escape code 27) are processed once:
+.bP
+This means that a C1 control can be mistaken for badly-formed UTF-8
+when the terminal runs
+in UTF-8 mode because C1 controls are valid \fIcontinuation bytes\fP of
+a UTF-8 encoded (multibyte) value.
+.bP
+It is not possible to use a C1 control obtained from decoding the UTF-8 text,
+because that would require reprocessing the data.
+Consequently there is no ambiguity in the way
+this document uses the term \*(``character\*('' to refer to
+bytes in a control sequence.
+.LP
+The order of processing is a necessary consequence of the way ECMA-48
+is designed:
+.bP
+Each byte sent to the terminal can be unambiguously determined to
+fall into one of a few categories (C0, C1 and graphic characters).
+.bP
+ECMA-48 is \fImodal\fP; once it starts processing a control sequence,
+the terminal continues until the sequence is complete,
+or some byte is found which is not allowed in the sequence.
+.bP
+Intermediate, parameter and final bytes may
+use the same codes as graphic characters,
+but they are processed as part of a control sequence and are not actually
+graphic characters.
+.bP
+Eight-bit controls can have intermediate, etc., bytes in the range 160 to 255.
+Those can be treated as their counterparts in the range 32 to 127.
+.bP
+Single-byte controls can be handled separately from multi-byte
+control sequences because ECMA-48's rules are unambiguous.
+.IP
+As a special case, ECMA-48 (section 9) mentions that the control functions
+shift-in and shift-out are allowed to occur within a 7-bit multibyte control
+sequence because those cannot alter the meaning of the control sequence.
+.bP
+Some controls (such as \*(Os) introduce a string mode,
+which is ended on a \*(ST (string terminator).
+.IP
+Again, the terminal should accept single-byte controls within the string.
+However, \fIxterm\fP has a resource setting \fBbrokenLinuxOSC\fP to allow
+recovery from applications which rely upon malformed palette sequences
+used by the Linux console.
+.
 .Sh "C1 (8-Bit) Control Characters"
 .LP
 The \fIxterm\fP program recognizes both 8-bit and 7-bit control characters.
@@ -808,12 +871,12 @@ Repeat the preceding graphic character \*(Ps times (REP).
 Send Device Attributes (Primary DA).
   \*(Ps = \*0 or omitted \(-> request attributes from terminal.
 The response depends on the \fBdecTerminalID\fP resource setting.
-  \(->\ \*(Cs\*?\*1\*;\*2\*c (``VT100 with Advanced Video Option'')
-  \(->\ \*(Cs\*?\*1\*;\*0\*c (``VT101 with No Options'')
-  \(->\ \*(Cs\*?\*6\*c (``VT102'')
-  \(->\ \*(Cs\*?\*6\*2\*;\*(Ps\*c (``VT220'')
-  \(->\ \*(Cs\*?\*6\*3\*;\*(Ps\*c (``VT320'')
-  \(->\ \*(Cs\*?\*6\*4\*;\*(Ps\*c (``VT420'')
+  \(->\ \*(Cs\*?\*1\*;\*2\*c (\*(``VT100 with Advanced Video Option\*('')
+  \(->\ \*(Cs\*?\*1\*;\*0\*c (\*(``VT101 with No Options\*('')
+  \(->\ \*(Cs\*?\*6\*c (\*(``VT102\*('')
+  \(->\ \*(Cs\*?\*6\*2\*;\*(Ps\*c (\*(``VT220\*('')
+  \(->\ \*(Cs\*?\*6\*3\*;\*(Ps\*c (\*(``VT320\*('')
+  \(->\ \*(Cs\*?\*6\*4\*;\*(Ps\*c (\*(``VT420\*('')
 .br
 The VT100-style response parameters do not mean anything by themselves.
 VT220 (and higher) parameters do, telling the host what features the terminal supports:
@@ -838,16 +901,16 @@ It should apply only to VT220 and up, but \fIxterm\fP extends this to VT100.
   \(-> \*(Cs\*s\*>\*(Pp\*s\*;\*(Pv\*s\*;\*(Pc\*s\*c
 .br
 where \*(Pp denotes the terminal type
-  \*(Pp = \*0 \(-> ``VT100''.
-  \*(Pp = \*1 \(-> ``VT220''.
-  \*(Pp = \*2 \(-> ``VT240''.
-  \*(Pp = \*18 \(-> ``VT330''.
-  \*(Pp = \*19 \(-> ``VT340''.
-  \*(Pp = \*24 \(-> ``VT320''.
-  \*(Pp = \*41 \(-> ``VT420''.
-  \*(Pp = \*61 \(-> ``VT510''.
-  \*(Pp = \*64 \(-> ``VT520''.
-  \*(Pp = \*65 \(-> ``VT525''.
+  \*(Pp = \*0 \(-> \*(``VT100\*(''.
+  \*(Pp = \*1 \(-> \*(``VT220\*(''.
+  \*(Pp = \*2 \(-> \*(``VT240\*(''.
+  \*(Pp = \*18 \(-> \*(``VT330\*(''.
+  \*(Pp = \*19 \(-> \*(``VT340\*(''.
+  \*(Pp = \*24 \(-> \*(``VT320\*(''.
+  \*(Pp = \*41 \(-> \*(``VT420\*(''.
+  \*(Pp = \*61 \(-> \*(``VT510\*(''.
+  \*(Pp = \*64 \(-> \*(``VT520\*(''.
+  \*(Pp = \*65 \(-> \*(``VT525\*(''.
 .br
 and \*(Pv is the firmware version (for \fIxterm\fP, this was originally
 the XFree86 patch number, starting with 95).
@@ -1154,7 +1217,7 @@ If no parameters are given, all resources are reset to their initial values.
 Device Status Report (DSR).
   \*(Ps = \*5 \(-> Status Report.
 .br
-Result (``OK'') is
+Result (\*(``OK\*('') is
 \*(Cs\*0\*n
   \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column].
 .br
@@ -1542,17 +1605,17 @@ Valid values for the event:
   \*(Pe = \*9 \(-> M4 button up.
   \*(Pe = \*1\*0 \(-> locator outside filter rectangle.
 .br
-The ``\fIbutton\fP'' parameter is a bitmask indicating which buttons are pressed:
+The \*(``\fIbutton\fP\*('' parameter is a bitmask indicating which buttons are pressed:
   \*(Pb = \*0 \(<- no buttons down.
   \*(Pb & \*1 \(<- right button down.
   \*(Pb & \*2 \(<- middle button down.
   \*(Pb & \*4 \(<- left button down.
   \*(Pb & \*8 \(<- M4 button down.
 .br
-The ``\fIrow\fP'' and ``\fIcolumn\fP'' parameters are the coordinates of the locator
+The \*(``\fIrow\fP\*('' and \*(``\fIcolumn\fP\*('' parameters are the coordinates of the locator
 position in the \fI\*(xt\fP window, encoded as ASCII decimal.
 .br
-The ``\fIpage\fP'' parameter is not used by \*(xt.
+The \*(``\fIpage\fP\*('' parameter is not used by \*(xt.
 .
 .IP \\*(Cs\\*(Pm\\*s\\*(qu\\*}
 Insert \*(Ps Column(s) (default = 1) (DECIC), VT420 and up.
@@ -1916,9 +1979,13 @@ F12	\*(Cs\*2\*4\*(c~
 _
 .TE
 .sP
-Older versions of \fIxterm\fP implement different escape sequences for F1 through F4.
+Note that F1 through F4 are prefixed with \*(S3,
+while the other keys are prefixed with \*(Cs.
+Older versions of \fIxterm\fP implement different escape sequences
+for F1 through F4, with a \*(Cs prefix.
 These can be activated by setting the \fBoldXtermFKeys\fP resource.
-However, since they do not correspond to any hardware terminal, they have been deprecated.
+However, since they do not correspond to any hardware terminal,
+they have been deprecated.
 (The DEC VT220 reserves F1 through F5 for local functions such as \fBSetup\fP).
 .TS H
 center;
@@ -1935,10 +2002,14 @@ F4	\*(Cs\*1\*4\*(c~
 _
 .TE
 In normal mode, i.e., a Sun/PC keyboard
-when the \fBsunKeyboard\fP resource is false,
-\fIxterm\fP recognizes function key modifiers
-which are parameters appended before the final character
-of the control sequence.
+when the \fBsunKeyboard\fP resource is false
+(and none of the other keyboard resources
+such as \fBoldXtermFKeys\fP resource is set),
+\fIxterm\fP encodes function key modifiers
+as parameters appended before the \fIfinal\fP character of the control sequence.
+As a special case,
+the \*(S3 sent before F1 through F4 is altered to \*(Cs when sending
+a function key modifier as a parameter.
 .TS H
 center;
 cf3w(2c)	lf3w(2c) .
@@ -2646,7 +2717,7 @@ Erase from the cursor to the end of the line.
 Move the cursor to given row and column.
 .IP \\*(Es\\*Z
 Identify.
-  \(-> \*(Es\*s\*/\*s\*Z (``I am a VT52.'').
+  \(-> \*(Es\*s\*/\*s\*Z (\*(``I am a VT52.\*('').
 .IP \\*(Es\\*=
 Enter alternate keypad mode.
 .IP \\*(Es\\*>
diff --git a/ctlseqs.txt b/ctlseqs.txt
index 4cb0a70..4a8858b 100644
--- a/ctlseqs.txt
+++ b/ctlseqs.txt
@@ -21,7 +21,7 @@
                              Thomas Dickey
                       XFree86 Project (1996-2006)
                     invisible-island.net (2006-2015)
-               updated for XTerm Patch #318 (2015/04/12)
+               updated for XTerm Patch #318 (2015/08/19)
 
 
 
@@ -40,6 +40,59 @@ Pm   A multiple numeric parameter composed of any number of single
 
 Pt   A text parameter composed of printable characters.
 
+Control Bytes, Characters, and Sequences
+
+ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
+Those are respectively codes 128 to 159 and 0 to 31.  ECMA-48 avoids
+referring to these codes as characters, because that term is associated
+with graphic characters.  Instead, it uses "bytes" and "codes", with
+occasional lapses to "characters" where the meaning cannot be mistaken.
+
+Controls (including the escape code 27) are processed once:
+
+o This means that a C1 control can be mistaken for badly-formed UTF-8
+  when the terminal runs in UTF-8 mode because C1 controls are valid
+  continuation bytes of a UTF-8 encoded (multibyte) value.
+
+o It is not possible to use a C1 control obtained from decoding the
+  UTF-8 text, because that would require reprocessing the data.  Conse-
+  quently there is no ambiguity in the way this document uses the term
+  "character" to refer to bytes in a control sequence.
+
+The order of processing is a necessary consequence of the way ECMA-48 is
+designed:
+
+o Each byte sent to the terminal can be unambiguously determined to fall
+  into one of a few categories (C0, C1 and graphic characters).
+
+o ECMA-48 is modal; once it starts processing a control sequence, the
+  terminal continues until the sequence is complete, or some byte is
+  found which is not allowed in the sequence.
+
+o Intermediate, parameter and final bytes may use the same codes as
+  graphic characters, but they are processed as part of a control
+  sequence and are not actually graphic characters.
+
+o Eight-bit controls can have intermediate, etc., bytes in the range 160
+  to 255.  Those can be treated as their counterparts in the range 32 to
+  127.
+
+o Single-byte controls can be handled separately from multi-byte control
+  sequences because ECMA-48's rules are unambiguous.
+
+  As a special case, ECMA-48 (section 9) mentions that the control func-
+  tions shift-in and shift-out are allowed to occur within a 7-bit
+  multibyte control sequence because those cannot alter the meaning of
+  the control sequence.
+
+o Some controls (such as OSC ) introduce a string mode, which is ended
+  on a ST  (string terminator).
+
+  Again, the terminal should accept single-byte controls within the
+  string.  However, xterm has a resource setting brokenLinuxOSC to allow
+  recovery from applications which rely upon malformed palette sequences
+  used by the Linux console.
+
 C1 (8-Bit) Control Characters
 
 The xterm program recognizes both 8-bit and 7-bit control characters.
@@ -312,12 +365,12 @@ CSI Ps b  Repeat the preceding graphic character Ps times (REP).
 CSI Ps c  Send Device Attributes (Primary DA).
             Ps = 0  or omitted -> request attributes from terminal.  The
           response depends on the decTerminalID resource setting.
-            -> CSI ? 1 ; 2 c  (``VT100 with Advanced Video Option'')
-            -> CSI ? 1 ; 0 c  (``VT101 with No Options'')
-            -> CSI ? 6 c  (``VT102'')
-            -> CSI ? 6 2 ; Psc  (``VT220'')
-            -> CSI ? 6 3 ; Psc  (``VT320'')
-            -> CSI ? 6 4 ; Psc  (``VT420'')
+            -> CSI ? 1 ; 2 c  ("VT100 with Advanced Video Option")
+            -> CSI ? 1 ; 0 c  ("VT101 with No Options")
+            -> CSI ? 6 c  ("VT102")
+            -> CSI ? 6 2 ; Psc  ("VT220")
+            -> CSI ? 6 3 ; Psc  ("VT320")
+            -> CSI ? 6 4 ; Psc  ("VT420")
           The VT100-style response parameters do not mean anything by
           themselves.  VT220 (and higher) parameters do, telling the
           host what features the terminal supports:
@@ -341,16 +394,16 @@ CSI > Ps c
           this to VT100.
             -> CSI  > Pp ; Pv ; Pc c
           where Pp denotes the terminal type
-            Pp = 0  -> ``VT100''.
-            Pp = 1  -> ``VT220''.
-            Pp = 2  -> ``VT240''.
-            Pp = 1 8 -> ``VT330''.
-            Pp = 1 9 -> ``VT340''.
-            Pp = 2 4 -> ``VT320''.
-            Pp = 4 1 -> ``VT420''.
-            Pp = 6 1 -> ``VT510''.
-            Pp = 6 4 -> ``VT520''.
-            Pp = 6 5 -> ``VT525''.
+            Pp = 0  -> "VT100".
+            Pp = 1  -> "VT220".
+            Pp = 2  -> "VT240".
+            Pp = 1 8 -> "VT330".
+            Pp = 1 9 -> "VT340".
+            Pp = 2 4 -> "VT320".
+            Pp = 4 1 -> "VT420".
+            Pp = 6 1 -> "VT510".
+            Pp = 6 4 -> "VT520".
+            Pp = 6 5 -> "VT525".
           and Pv is the firmware version (for xterm, this was originally
           the XFree86 patch number, starting with 95).  In a DEC termi-
           nal, Pc indicates the ROM cartridge registration number and is
@@ -647,7 +700,7 @@ CSI > Ps; Ps m
           initial values.
 CSI Ps n  Device Status Report (DSR).
             Ps = 5  -> Status Report.
-          Result (``OK'') is CSI 0 n
+          Result ("OK") is CSI 0 n
             Ps = 6  -> Report Cursor Position (CPR) [row;column].
           Result is CSI r ; c R
 
@@ -963,17 +1016,17 @@ CSI Ps ' |
             Pe = 8  -> M4 button down.
             Pe = 9  -> M4 button up.
             Pe = 1 0  -> locator outside filter rectangle.
-          The ``button'' parameter is a bitmask indicating which buttons
+          The "button" parameter is a bitmask indicating which buttons
           are pressed:
             Pb = 0  <- no buttons down.
             Pb & 1  <- right button down.
             Pb & 2  <- middle button down.
             Pb & 4  <- left button down.
             Pb & 8  <- M4 button down.
-          The ``row'' and ``column'' parameters are the coordinates of
-          the locator position in the xterm window, encoded as ASCII
-          decimal.
-          The ``page'' parameter is not used by xterm.
+          The "row" and "column" parameters are the coordinates of the
+          locator position in the xterm window, encoded as ASCII deci-
+          mal.
+          The "page" parameter is not used by xterm.
 CSI Pm ' }
           Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
 CSI Pm ' ~
@@ -1267,11 +1320,12 @@ pose keys:
                        ---------+-----------------
 
 
-Older versions of xterm implement different escape sequences for F1
-through F4.  These can be activated by setting the oldXtermFKeys
-resource.  However, since they do not correspond to any hardware termi-
-nal, they have been deprecated.  (The DEC VT220 reserves F1 through F5
-for local functions such as Setup).
+Note that F1 through F4 are prefixed with SS3 , while the other keys are
+prefixed with CSI .  Older versions of xterm implement different escape
+sequences for F1 through F4, with a CSI  prefix.  These can be activated
+by setting the oldXtermFKeys resource.  However, since they do not cor-
+respond to any hardware terminal, they have been deprecated.  (The DEC
+VT220 reserves F1 through F5 for local functions such as Setup).
 
                        Key        Escape Sequence
                        ---------+-----------------
@@ -1282,8 +1336,11 @@ for local functions such as Setup).
                        ---------+-----------------
 
 In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
-false, xterm recognizes function key modifiers which are parameters
-appended before the final character of the control sequence.
+false (and none of the other keyboard resources such as oldXtermFKeys
+resource is set), xterm encodes function key modifiers as parameters
+appended before the final character of the control sequence.  As a spe-
+cial case, the SS3  sent before F1 through F4 is altered to CSI  when
+sending a function key modifier as a parameter.
 
                     Code     Modifiers
                   ---------+---------------------------
@@ -1805,7 +1862,7 @@ ESC K     Erase from the cursor to the end of the line.
 ESC Y Ps Ps
           Move the cursor to given row and column.
 ESC Z     Identify.
-            -> ESC  /  Z  (``I am a VT52.'').
+            -> ESC  /  Z  ("I am a VT52.").
 ESC =     Enter alternate keypad mode.
 ESC >     Exit alternate keypad mode.
 ESC <     Exit VT52 mode (Enter VT100 mode).
diff --git a/fontutils.c b/fontutils.c
index 3bfc919..9487dc2 100644
--- a/fontutils.c
+++ b/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.448 2015/03/02 13:19:36 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.451 2015/08/18 00:55:19 tom Exp $ */
 
 /*
  * Copyright 1998-2014,2015 by Thomas E. Dickey
@@ -534,7 +534,7 @@ xtermSpecialFont(TScreen *screen, unsigned attr_flags, unsigned draw_flags, unsi
 	TRACE(("pixel_size = %d\n", pixel_size));
 	TRACE(("spacing    = %s\n", props->spacing));
 	old_props.res_x = res_x;
-	old_props.res_x = res_y;
+	old_props.res_y = res_y;
 	old_props.pixel_size = pixel_size;
 	old_props.spacing = old_spacing;
 	sprintf(old_spacing, "%.*s", (int) sizeof(old_spacing) - 2, props->spacing);
@@ -865,25 +865,36 @@ xtermCloseFont(XtermWidget xw, XTermFonts * fnt)
 }
 
 /*
+ * Close and free the font (as well as any aliases).
+ */
+static void
+xtermCloseFont2(XtermWidget xw, XTermFonts * fnts, int which)
+{
+    XFontStruct *thisFont = fnts[which].fs;
+    int k;
+
+    if (thisFont != 0) {
+	xtermCloseFont(xw, &fnts[which]);
+	for (k = 0; k < fMAX; ++k) {
+	    if (k != which) {
+		if (thisFont == fnts[k].fs) {
+		    xtermFreeFontInfo(&fnts[k]);
+		}
+	    }
+	}
+    }
+}
+
+/*
  * Close the listed fonts, noting that some may use copies of the pointer.
  */
 void
 xtermCloseFonts(XtermWidget xw, XTermFonts * fnts)
 {
-    int j, k;
+    int j;
 
     for (j = 0; j < fMAX; ++j) {
-	/*
-	 * Need to save the pointer since xtermCloseFont zeroes it
-	 */
-	XFontStruct *thisFont = fnts[j].fs;
-	if (thisFont != 0) {
-	    xtermCloseFont(xw, &fnts[j]);
-	    for (k = j + 1; k < fMAX; ++k) {
-		if (thisFont == fnts[k].fs)
-		    xtermFreeFontInfo(&fnts[k]);
-	    }
-	}
+	xtermCloseFont2(xw, fnts, j);
     }
 }
 
@@ -1162,7 +1173,7 @@ xtermLoadFont(XtermWidget xw,
 	    TRACE(("...got a matching bold font\n"));
 	    cache_menu_font_name(screen, fontnum, fBold, myfonts.f_b);
 	} else {
-	    xtermCloseFont(xw, &fnts[fBold]);
+	    xtermCloseFont2(xw, fnts, fBold);
 	    fnts[fBold] = fnts[fNorm];
 	    TRACE(("...did not get a matching bold font\n"));
 	}
@@ -1225,7 +1236,7 @@ xtermLoadFont(XtermWidget xw,
 
 	    if (derived
 		&& !compatibleWideCounts(fnts[fWide].fs, fnts[fWBold].fs)) {
-		xtermCloseFont(xw, &fnts[fWBold]);
+		xtermCloseFont2(xw, fnts, fWBold);
 	    }
 	    if (fnts[fWBold].fs == 0) {
 		FREE_FNAME(f_wb);
@@ -1277,7 +1288,7 @@ xtermLoadFont(XtermWidget xw,
     if (!same_font_size(xw, fnts[fNorm].fs, fnts[fBold].fs)
 	&& (is_fixed_font(fnts[fNorm].fs) && is_fixed_font(fnts[fBold].fs))) {
 	TRACE(("...ignoring mismatched normal/bold fonts\n"));
-	xtermCloseFont(xw, &fnts[fBold]);
+	xtermCloseFont2(xw, fnts, fBold);
 	xtermCopyFontInfo(&fnts[fBold], &fnts[fNorm]);
     }
 
@@ -1289,7 +1300,7 @@ xtermLoadFont(XtermWidget xw,
 		    && is_fixed_font(fnts[fWide].fs)
 		    && is_fixed_font(fnts[fWBold].fs)))) {
 	    TRACE(("...ignoring mismatched normal/bold wide fonts\n"));
-	    xtermCloseFont(xw, &fnts[fWBold]);
+	    xtermCloseFont2(xw, fnts, fWBold);
 	    xtermCopyFontInfo(&fnts[fWBold], &fnts[fWide]);
 	}
     });
@@ -3091,7 +3102,7 @@ dec2ucs(unsigned ch)
 
 #endif /* OPT_WIDE_CHARS */
 
-#if OPT_SHIFT_FONTS
+#if OPT_RENDERFONT || OPT_SHIFT_FONTS
 static int
 lookupOneFontSize(XtermWidget xw, int fontnum)
 {
@@ -3133,6 +3144,7 @@ lookupFontSizes(XtermWidget xw)
 	(void) lookupOneFontSize(xw, n);
     }
 }
+#endif /* OPT_RENDERFONT || OPT_SHIFT_FONTS */
 
 #if OPT_RENDERFONT
 static double
@@ -3268,6 +3280,7 @@ useFaceSizes(XtermWidget xw)
 }
 #endif /* OPT_RENDERFONT */
 
+#if OPT_SHIFT_FONTS
 /*
  * Find the index of a larger/smaller font (according to the sign of 'relative'
  * and its magnitude), starting from the 'old' index.
@@ -3391,7 +3404,7 @@ HandleSmallerFont(Widget w GCC_UNUSED,
 	}
     }
 }
-#endif
+#endif /* OPT_SHIFT_FONTS */
 
 int
 xtermGetFont(const char *param)
diff --git a/graphics.c b/graphics.c
index 665b749..e76f562 100644
--- a/graphics.c
+++ b/graphics.c
@@ -1,7 +1,7 @@
-/* $XTermId: graphics.c,v 1.62 2014/12/23 00:08:58 Ross.Combs Exp $ */
+/* $XTermId: graphics.c,v 1.68 2015/07/13 08:58:48 Ross.Combs Exp $ */
 
 /*
- * Copyright 2013,2014 by Ross Combs
+ * Copyright 2013-2014,2015 by Ross Combs
  *
  *                         All Rights Reserved
  *
@@ -52,13 +52,14 @@
  * graphics TODO list
  *
  * ReGIS:
- * - find a suitable default alphabet zero font instead of scaling Xft fonts
+ * - ship a default alphabet zero font instead of scaling Xft fonts
  * - input and output cursors
  * - mouse input
- * - investigate second graphic page for ReGIS -- does it also apply to text and sixel graphics? are the contents preserved?
+ * - fix graphic pages for ReGIS -- they should also apply to text and sixel graphics
  * - fix interpolated curves to more closely match implementation (identical despite direction and starting point)
  * - non-ASCII alphabets
- * - enter/leave during a command
+ * - enter/leave anywhere in a command
+ * - locator key definitions (DECLKD)
  * - command display mode
  * - re-rasterization on resize
  * - macros
@@ -94,7 +95,9 @@
  * - ability to show non-scroll-mode sixel graphics in a separate window
  * - ability to show ReGIS graphics in a separate window
  * - ability to show Tektronix graphics in VT100 window
- * - truncate graphics at bottom edge of window?
+ * - truncate graphics at bottom edge of terminal?
+ * - locator events (DECEFR DECSLE DECELR DECLRP)
+ * - locator controller mode (CSI6i / CSI7i)
  *
  * new escape sequences:
  * - way to query text font size without "window ops" (or make "window ops" permissions more fine grained)
@@ -690,6 +693,7 @@ init_graphic(Graphic *graphic,
 
     TRACE(("initializing graphic object\n"));
 
+    graphic->hidden = 0;
     graphic->dirty = 1;
     for (i = 0U; i < max_pixels; i++)
 	graphic->pixels[i] = COLOR_HOLE;
@@ -804,15 +808,24 @@ get_new_or_matching_graphic(XtermWidget xw,
     unsigned ii;
 
     FOR_EACH_SLOT(ii) {
-	if ((graphic = getActiveSlot(ii)) &&
-	    graphic->type == type &&
-	    graphic->bufferid == bufferid &&
-	    graphic->charrow == charrow &&
-	    graphic->charcol == charcol &&
-	    graphic->actual_width == actual_width &&
-	    graphic->actual_height == actual_height) {
-	    TRACE(("found existing graphic index=%u id=%u\n", ii, graphic->id));
-	    return graphic;
+	TRACE(("checking slot=%u for graphic at %d,%d %dx%d bufferid=%d type=%u\n", ii,
+	       charrow, charcol,
+	       actual_width, actual_height,
+	       bufferid, type));
+	if ((graphic = getActiveSlot(ii))) {
+	    if (graphic->type == type &&
+		graphic->bufferid == bufferid &&
+		graphic->charrow == charrow &&
+		graphic->charcol == charcol &&
+		graphic->actual_width == actual_width &&
+		graphic->actual_height == actual_height) {
+		TRACE(("found existing graphic slot=%u id=%u\n", ii, graphic->id));
+		return graphic;
+	    }
+	    TRACE(("not a match: graphic at %d,%d %dx%d bufferid=%d type=%u\n",
+		   graphic->charrow, graphic->charcol,
+		   graphic->actual_width, graphic->actual_height,
+		   graphic->bufferid, graphic->type));
 	}
     }
 
@@ -820,6 +833,10 @@ get_new_or_matching_graphic(XtermWidget xw,
     if ((graphic = get_new_graphic(xw, charrow, charcol, type))) {
 	graphic->actual_width = actual_width;
 	graphic->actual_height = actual_height;
+	TRACE(("no match; created graphic at %d,%d %dx%d bufferid=%d type=%u\n",
+	       graphic->charrow, graphic->charcol,
+	       graphic->actual_width, graphic->actual_height,
+	       graphic->bufferid, graphic->type));
     }
     return graphic;
 }
@@ -1340,6 +1357,8 @@ refresh_graphics(XtermWidget xw,
 		continue;
 	    }
 	}
+	if (graphic->hidden)
+	    continue;
 	ordered_graphics[active_count++] = graphic;
     }
 
@@ -1688,6 +1707,8 @@ scroll_displayed_graphics(XtermWidget xw, int rows)
 	    continue;
 	if (graphic->bufferid != screen->whichBuf)
 	    continue;
+	if (graphic->hidden)
+	    continue;
 
 	graphic->charrow -= rows;
     }
@@ -1716,6 +1737,8 @@ pixelarea_clear_displayed_graphics(TScreen const *screen,
 	    continue;
 	if (graphic->bufferid != screen->whichBuf)
 	    continue;
+	if (graphic->hidden)
+	    continue;
 
 	graph_x = graphic->charcol * FontWidth(screen);
 	graph_y = graphic->charrow * FontHeight(screen);
diff --git a/graphics.h b/graphics.h
index f1edaca..724e847 100644
--- a/graphics.h
+++ b/graphics.h
@@ -1,8 +1,8 @@
-/* $XTermId: graphics.h,v 1.20 2014/11/28 19:48:36 tom Exp $ */
+/* $XTermId: graphics.h,v 1.22 2015/04/23 00:47:24 tom Exp $ */
 
 /*
- * Copyright 2013,2014 by Ross Combs
- * Copyright 2013,2014 by Thomas E. Dickey
+ * Copyright 2013-2014,2015 by Ross Combs
+ * Copyright 2013-2014,2015 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -73,6 +73,7 @@ typedef struct {
     unsigned id;                /* sequential id used for preserving layering */
     int valid;                  /* if the graphic has been initialized */
     int dirty;                  /* if the graphic needs to be redrawn */
+    int hidden;                 /* if the graphic should not be displayed */
 } Graphic;
 
 extern Graphic *get_new_graphic(XtermWidget xw, int charrow, int charcol, unsigned type);
diff --git a/graphics_regis.c b/graphics_regis.c
index 3a983a8..59e92c2 100644
--- a/graphics_regis.c
+++ b/graphics_regis.c
@@ -1,7 +1,7 @@
-/* $XTermId: graphics_regis.c,v 1.62 2014/12/23 01:39:00 tom Exp $ */
+/* $XTermId: graphics_regis.c,v 1.76 2015/07/13 22:52:29 tom Exp $ */
 
 /*
- * Copyright 2014 by Ross Combs
+ * Copyright 2014,2015 by Ross Combs
  *
  *                         All Rights Reserved
  *
@@ -79,12 +79,15 @@
 
 #define SCALE_FIXED_POINT 16U
 
+#undef DEBUG_PARSING
+#undef DEBUG_ALPHABET_LOOKUP
 #undef DEBUG_ALPHABETS
 #undef DEBUG_BEZIER
 #undef DEBUG_SPLINE_SEGMENTS
 #undef DEBUG_SPLINE_POINTS
 #undef DEBUG_SPLINE_WITH_ROTATION
 #undef DEBUG_SPLINE_WITH_OVERDRAW
+#undef DEBUG_ARC_POINTS
 #undef DEBUG_ARC_CENTER
 #undef DEBUG_ARC_START
 #undef DEBUG_ARC_END
@@ -94,6 +97,7 @@
 #undef DEBUG_FONT_NAME
 #undef DEBUG_FONT_SIZE_SEARCH
 #undef DEBUG_XFT_GLYPH
+#undef DEBUG_USER_GLYPH
 #undef DEBUG_LOAD
 
 /* controls for extensions over VT3x0 limitations */
@@ -104,8 +108,8 @@
 #define ENABLE_USER_FONT_SIZE
 #define ENABLE_VARIABLE_ITALICS
 
-#define MIN_ITERATIONS_BEFORE_REFRESH 20U
-#define MIN_MS_BEFORE_REFRESH 30
+#define MIN_ITERATIONS_BEFORE_REFRESH 10U
+#define MIN_MS_BEFORE_REFRESH 33
 /* *INDENT-OFF* */
 typedef struct RegisPoint {
     int  x, y;
@@ -144,6 +148,8 @@ typedef struct RegisTextControls {
 #define FixedCopy(dst, src, len) strncpy(dst, src, len - 1)[len - 1] = '\0'
 #define CopyFontname(dst, src) FixedCopy(dst, src, REGIS_FONTNAME_LEN)
 
+#define MAX_REGIS_PAGES 8U
+
 #define MAX_REGIS_ALPHABETS 8U
 #define REGIS_ALPHABET_NAME_LEN 11U
 #define REGIS_FONTNAME_LEN 256U
@@ -212,7 +218,8 @@ typedef struct RegisParseState {
 } RegisParseState;
 
 typedef struct RegisGraphicsContext {
-    Graphic *graphic;
+    Graphic *destination_graphic;
+    Graphic *display_graphic;
     int terminal_id;
     int x_off, y_off;
     int x_div, y_div;
@@ -234,9 +241,13 @@ typedef struct RegisGraphicsContext {
     int fill_mode;
     RegisPoint fill_points[MAX_FILL_POINTS];
     unsigned fill_point_count;
+    unsigned destination_page;
+    unsigned display_page;
+    int force_refresh;
 } RegisGraphicsContext;
 
 static RegisGraphicsContext persistent_context;
+static RegisParseState persistent_state;
 
 #define MAX_PATTERN_BITS 8U
 
@@ -247,6 +258,7 @@ static RegisGraphicsContext persistent_context;
 
 #define WRITE_SHADING_REF_Y 0U
 #define WRITE_SHADING_REF_X 1U
+#define WRITE_SHADING_REF_NONE 2U
 
 /* keypress event example: http://iraf.net/forum/viewtopic.php?showtopic=61692 */
 
@@ -259,15 +271,24 @@ static RegisGraphicsContext persistent_context;
 			   ((V) >> (8U - ((N) & 3U))) )
 #define ROT_LEFT(V) ( (((V) << 1U) & 255U) | ((V) >> 7U) )
 
+/* convert user coordinates to absolute pixel coordinates */
 #define SCALE_XCOORD(C, X, S) ( ( (X) * ((C)->width  - 1) ) / ( (C)->x_div * (S) ) )
 #define SCALE_YCOORD(C, Y, S) ( ( (Y) * ((C)->height - 1) ) / ( (C)->y_div * (S) ) )
 #define TRANSLATE_XCOORD(C, X, S) SCALE_XCOORD((C), (X) - (C)->x_off * (S), (S) )
 #define TRANSLATE_YCOORD(C, Y, S) SCALE_YCOORD((C), (Y) - (C)->y_off * (S), (S) )
 
-#define READ_PIXEL(C, X, Y) read_pixel((C)->graphic, (X), (Y))
-#define DRAW_PIXEL(C, X, Y, COL) draw_solid_pixel((C)->graphic, (X), (Y), (COL))
+#if 0
+/* convert absolute pixel coordinate to user coordinates */
+#define SCALE_XPIX(C, X, S) ( ( (X) * ((C)->x_div * (S) ) ) / ((C)->width  - 1) )
+#define SCALE_YPIX(C, Y, S) ( ( (Y) * ((C)->y_div * (S) ) ) / ((C)->height - 1) )
+#define TRANSLATE_XPIX(C, X, S) ( SCALE_XPIX((C), (X), (S) ) + (C)->x_off * (S) )
+#define TRANSLATE_YPIX(C, Y, S) ( SCALE_YPIX((C), (Y), (S) ) + (C)->y_off * (S) )
+#endif
+
+#define READ_PIXEL(C, X, Y) read_pixel((C)->destination_graphic, (X), (Y))
+#define DRAW_PIXEL(C, X, Y, COL) draw_solid_pixel((C)->destination_graphic, (X), (Y), (COL))
 #define DRAW_ALL(C, COL) \
-    draw_solid_rectangle((C)->graphic, 0, 0, (C)->width, (C)->height, (COL))
+    draw_solid_rectangle((C)->destination_graphic, 0, 0, (C)->width, (C)->height, (COL))
 
 static unsigned get_shade_character_pixel(unsigned char const *pixels,
 					  unsigned w, unsigned h,
@@ -379,7 +400,7 @@ shade_pattern_to_pixel(RegisGraphicsContext *context, unsigned dim, int ref,
 		context->pattern_bit;
 	    draw_regis_pixel(context, curr_x, y, value);
 	}
-    } else {
+    } else if (dim == WRITE_SHADING_REF_Y) {
 	int delta = y > ref ? 1 : -1;
 	int curr_y;
 
@@ -389,6 +410,8 @@ shade_pattern_to_pixel(RegisGraphicsContext *context, unsigned dim, int ref,
 		context->pattern_bit;
 	    draw_regis_pixel(context, x, curr_y, value);
 	}
+    } else {
+	TRACE(("ERROR: shading requested, but there is no reference axis\n"));
     }
 }
 
@@ -421,7 +444,7 @@ shade_char_to_pixel(RegisGraphicsContext *context, unsigned char const *pixels,
 					      curr_x, y);
 	    draw_regis_pixel(context, curr_x, y, value);
 	}
-    } else {
+    } else if (dim == WRITE_SHADING_REF_Y) {
 	int delta = y > ref ? 1 : -1;
 	int curr_y;
 
@@ -430,6 +453,8 @@ shade_char_to_pixel(RegisGraphicsContext *context, unsigned char const *pixels,
 					      curr_y);
 	    draw_regis_pixel(context, x, curr_y, value);
 	}


Reply to: