summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-08-25 18:05:58 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-08-25 18:05:58 +0000
commit8178291553b032de1eb17eddaf1b776d58a08f8a (patch)
tree9d62774ffa340b2d23952c8ac62b5625f514d060
parent7f8f6db35e2fbeae9a6f2ce8c5ed7f4dd7498a3f (diff)
xterm-236. Tested by form@ and simon@.
-rw-r--r--app/xterm/MANIFEST2
-rw-r--r--app/xterm/Tekproc.c10
-rw-r--r--app/xterm/VTPrsTbl.c343
-rw-r--r--app/xterm/VTparse.def10
-rw-r--r--app/xterm/VTparse.h10
-rw-r--r--app/xterm/aclocal.m471
-rw-r--r--app/xterm/button.c124
-rw-r--r--app/xterm/charproc.c293
-rw-r--r--app/xterm/charsets.c789
-rw-r--r--app/xterm/configure.in13
-rw-r--r--app/xterm/ctlseqs.ms170
-rw-r--r--app/xterm/ctlseqs.txt1550
-rw-r--r--app/xterm/cursor.c29
-rw-r--r--app/xterm/data.h1
-rw-r--r--app/xterm/fontutils.c10
-rw-r--r--app/xterm/input.c772
-rw-r--r--app/xterm/main.c22
-rw-r--r--app/xterm/menu.c544
-rw-r--r--app/xterm/misc.c1692
-rw-r--r--app/xterm/ptydata.c4
-rw-r--r--app/xterm/ptyx.h9
-rw-r--r--app/xterm/screen.c581
-rw-r--r--app/xterm/scrollbar.c52
-rw-r--r--app/xterm/trace.c283
-rw-r--r--app/xterm/trace.h32
-rw-r--r--app/xterm/version.h4
-rw-r--r--app/xterm/xterm.h10
-rw-r--r--app/xterm/xterm.log.html79
-rw-r--r--app/xterm/xterm.man24
-rw-r--r--app/xterm/xtermcap.c294
-rw-r--r--app/xterm/xtermcfg.hin4
31 files changed, 4927 insertions, 2904 deletions
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 1351cab2d..a51ffbf28 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-233, version xterm-233
+MANIFEST for xterm-236, version xterm-236
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index 0666f0819..bf38747b6 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.159 2008/02/21 20:21:51 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.160 2008/06/03 20:55:56 tom Exp $ */
/*
* Warning, there be crufty dragons here.
@@ -1493,11 +1493,9 @@ TekRealize(Widget gw,
else
tw->hints.flags |= PSize;
- TRACE(("make resize request %dx%d\n", height, width));
- (void) XtMakeResizeRequest((Widget) tw,
- width, height,
- &tw->core.width, &tw->core.height);
- TRACE(("...made resize request %dx%d\n", tw->core.height, tw->core.width));
+ (void) REQ_RESIZE((Widget) tw,
+ width, height,
+ &tw->core.width, &tw->core.height);
/* XXX This is bogus. We are parsing geometries too late. This
* is information that the shell widget ought to have before we get
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index 38b04fa4e..370ae0e1f 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,9 +1,8 @@
-/* $XTermId: VTPrsTbl.c,v 1.48 2006/07/31 22:14:03 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.50 2008/05/26 22:38:23 tom Exp $ */
-/* $XFree86: xc/programs/xterm/VTPrsTbl.c,v 3.31 2006/02/13 01:14:58 dickey Exp $ */
/*
*
- * Copyright 1999-2005,2006 by Thomas E. Dickey
+ * Copyright 1999-2006,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -3141,7 +3140,7 @@ CASE_SET_MOD_FKEYS,
CASE_SET_MOD_FKEYS0,
CASE_GROUND_STATE,
/* p q r s */
-CASE_GROUND_STATE,
+CASE_HIDE_POINTER,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -4353,9 +4352,9 @@ CASE_SCS2_STATE,
CASE_SCS3_STATE,
/* , - . / */
CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
+CASE_SCS1A_STATE,
+CASE_SCS2A_STATE,
+CASE_SCS3A_STATE,
/* 0 1 2 3 */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -4513,9 +4512,9 @@ CASE_SCS2_STATE,
CASE_SCS3_STATE,
/* notsign hyphen registered macron */
CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
-CASE_ESC_IGNORE,
+CASE_SCS1A_STATE,
+CASE_SCS2A_STATE,
+CASE_SCS3A_STATE,
/* degree plusminus twosuperior threesuperior */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
@@ -5590,6 +5589,330 @@ CASE_GROUND_STATE,
CASE_IGNORE,
};
+Const PARSE_T scs96table[] = /* ESC - etc. */
+{
+/* NUL SOH STX ETX */
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+/* EOT ENQ ACK BEL */
+CASE_IGNORE,
+CASE_ENQ,
+CASE_IGNORE,
+CASE_BELL,
+/* BS HT NL VT */
+CASE_BS,
+CASE_TAB,
+CASE_VMOT,
+CASE_VMOT,
+/* NP CR SO SI */
+CASE_VMOT,
+CASE_CR,
+CASE_SO,
+CASE_SI,
+/* DLE DC1 DC2 DC3 */
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+/* DC4 NAK SYN ETB */
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+/* CAN EM SUB ESC */
+CASE_GROUND_STATE,
+CASE_IGNORE,
+CASE_GROUND_STATE,
+CASE_ESC,
+/* FS GS RS US */
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+CASE_IGNORE,
+/* SP ! " # */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* $ % & ' */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* ( ) * + */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* , - . / */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* 0 1 2 3 */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 4 5 6 7 */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 8 9 : ; */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* < = > ? */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* @ A B C */
+CASE_GROUND_STATE,
+CASE_GSETS,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* D E F G */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* H I J K */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* L M N O */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* P Q R S */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* T U V W */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* X Y Z [ */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* \ ] ^ _ */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* ` a b c */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* d e f g */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* h i j k */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* l m n o */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* p q r s */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* t u v w */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* x y z { */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* | } ~ DEL */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_IGNORE,
+/* 0x80 0x81 0x82 0x83 */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 0x84 0x85 0x86 0x87 */
+CASE_IND,
+CASE_NEL,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 0x88 0x89 0x8a 0x8b */
+CASE_HTS,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 0x8c 0x8d 0x8e 0x8f */
+CASE_GROUND_STATE,
+CASE_RI,
+CASE_SS2,
+CASE_SS3,
+/* 0x90 0x91 0x92 0x93 */
+CASE_DCS,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* 0x94 0x95 0x96 0x97 */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_SPA,
+CASE_EPA,
+/* 0x98 0x99 0x9a 0x9b */
+CASE_SOS,
+CASE_GROUND_STATE,
+CASE_DECID,
+CASE_CSI_STATE,
+/* 0x9c 0x9d 0x9e 0x9f */
+CASE_ST,
+CASE_OSC,
+CASE_PM,
+CASE_APC,
+/* nobreakspace exclamdown cent sterling */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* currency yen brokenbar section */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* diaeresis copyright ordfeminine guillemotleft */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* notsign hyphen registered macron */
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+CASE_ESC_IGNORE,
+/* degree plusminus twosuperior threesuperior */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* acute mu paragraph periodcentered */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* cedilla onesuperior masculine guillemotright */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* onequarter onehalf threequarters questiondown */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Agrave Aacute Acircumflex Atilde */
+CASE_GROUND_STATE,
+CASE_GSETS,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Adiaeresis Aring AE Ccedilla */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Egrave Eacute Ecircumflex Ediaeresis */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Igrave Iacute Icircumflex Idiaeresis */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Eth Ntilde Ograve Oacute */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Ocircumflex Otilde Odiaeresis multiply */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Ooblique Ugrave Uacute Ucircumflex */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* Udiaeresis Yacute Thorn ssharp */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* agrave aacute acircumflex atilde */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* adiaeresis aring ae ccedilla */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* egrave eacute ecircumflex ediaeresis */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* igrave iacute icircumflex idiaeresis */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* eth ntilde ograve oacute */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* ocircumflex otilde odiaeresis division */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* oslash ugrave uacute ucircumflex */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+/* udiaeresis yacute thorn ydiaeresis */
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_GROUND_STATE,
+CASE_IGNORE,
+};
+
/*
* This table is treated specially. The CASE_IGNORE entries correspond to the
* characters that can be accumulated for the string function (e.g., OSC).
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index 85bd578f2..c1438db3b 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,11 +1,11 @@
-# $XTermId: VTparse.def,v 1.29 2006/07/31 22:17:10 tom Exp $
+# $XTermId: VTparse.def,v 1.32 2008/05/26 21:30:10 tom Exp $
+#
+# vile:confmode rs=lf
#
# List of symbols that need to be defined for VTparse.h. If you need to
# change any of the CASE_ macros, make the change here and rerun the command
# shown in VTparse.h.
#
-# $XFree86: xc/programs/xterm/VTparse.def,v 3.18 2006/02/13 01:14:58 dickey Exp $
-#
CASE_GROUND_STATE
CASE_IGNORE
@@ -140,3 +140,7 @@ CASE_DECRARA
CASE_CSI_STAR_STATE
CASE_SET_MOD_FKEYS
CASE_SET_MOD_FKEYS0
+CASE_HIDE_POINTER
+CASE_SCS1A_STATE
+CASE_SCS2A_STATE
+CASE_SCS3A_STATE
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index 0bbb399d3..cdc781507 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,8 +1,7 @@
-/* $XTermId: VTparse.h,v 1.42 2006/07/31 22:17:40 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.45 2008/05/28 21:11:23 tom Exp $ */
-/* $XFree86: xc/programs/xterm/VTparse.h,v 3.24 2006/02/13 01:14:58 dickey Exp $ */
/*
- * Copyright 2002-2005,2006 by Thomas E. Dickey
+ * Copyright 2002-2006,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -76,6 +75,7 @@ extern Const PARSE_T eigtable[];
extern Const PARSE_T esc_sp_table[];
extern Const PARSE_T esc_table[];
extern Const PARSE_T scrtable[];
+extern Const PARSE_T scs96table[];
extern Const PARSE_T scstable[];
extern Const PARSE_T sos_table[];
@@ -242,5 +242,9 @@ extern Const PARSE_T esc_pct_table[];
#define CASE_CSI_STAR_STATE 130
#define CASE_SET_MOD_FKEYS 131
#define CASE_SET_MOD_FKEYS0 132
+#define CASE_HIDE_POINTER 133
+#define CASE_SCS1A_STATE 134
+#define CASE_SCS2A_STATE 135
+#define CASE_SCS3A_STATE 136
#endif /* included_VTparse_h */
diff --git a/app/xterm/aclocal.m4 b/app/xterm/aclocal.m4
index 7bee0f2e0..e4152999f 100644
--- a/app/xterm/aclocal.m4
+++ b/app/xterm/aclocal.m4
@@ -1,4 +1,4 @@
-dnl $XTermId: aclocal.m4,v 1.247 2008/02/24 19:30:23 tom Exp $
+dnl $XTermId: aclocal.m4,v 1.253 2008/07/27 15:28:15 tom Exp $
dnl
dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.65 2006/06/19 00:36:50 dickey Exp $
dnl
@@ -219,7 +219,7 @@ ifelse($3,,[ :]dnl
])dnl
])])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
+dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
dnl --------------
dnl Check if we're accidentally using a cache from a different machine.
dnl Derive the system name, as a check for reusing the autoconf cache.
@@ -250,7 +250,7 @@ test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name
if test ".$system_name" != ".$cf_cv_system_name" ; then
AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
- AC_ERROR("Please remove config.cache and try again.")
+ AC_MSG_ERROR("Please remove config.cache and try again.")
fi
])dnl
dnl ---------------------------------------------------------------------------
@@ -635,7 +635,7 @@ if test "$GCC" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GCC_WARNINGS version: 22 updated: 2007/07/29 09:55:12
+dnl CF_GCC_WARNINGS version: 23 updated: 2008/07/26 17:54:02
dnl ---------------
dnl Check if the compiler supports useful warning options. There's a few that
dnl we don't use, simply because they're too noisy:
@@ -730,7 +730,7 @@ then
;;
Winline) #(vi
case $GCC_VERSION in
- 3.3*)
+ [[34]].*)
CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
continue;;
esac
@@ -783,7 +783,7 @@ AC_DEFUN([CF_HELP_MESSAGE],
[AC_DIVERT_HELP([$1])dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_IMAKE_CFLAGS version: 29 updated: 2007/05/24 20:53:19
+dnl CF_IMAKE_CFLAGS version: 30 updated: 2008/03/23 15:04:54
dnl ---------------
dnl Use imake to obtain compiler flags. We could, in principle, write tests to
dnl get these, but if imake is properly configured there is no point in doing
@@ -864,14 +864,14 @@ CF_EOF
esac
done
if test -z "$cf_config" ; then
- AC_WARN(Could not find imake config-directory)
+ AC_MSG_WARN(Could not find imake config-directory)
else
cf_imake_opts="$cf_imake_opts -I$cf_config"
if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC)
then
CF_VERBOSE(Using $IMAKE $cf_config)
else
- AC_WARN(Cannot run $IMAKE)
+ AC_MSG_WARN(Cannot run $IMAKE)
fi
fi
fi
@@ -1093,7 +1093,7 @@ if test -n "$cf_path_prog" ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
+dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
dnl --------------
dnl Check the argument to see that it looks like a pathname. Rewrite it if it
dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -1125,7 +1125,7 @@ case ".[$]$1" in #(vi
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
;;
*)
- ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
+ ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
;;
esac
])dnl
@@ -1809,7 +1809,36 @@ else
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_TYPE_FD_SET version: 3 updated: 1999/10/16 13:49:00
+dnl CF_TYPE_FD_MASK version: 2 updated: 2008/03/25 20:59:57
+dnl ---------------
+dnl Check for the declaration of fd_mask, which is like fd_set, associated
+dnl with select(). The check for fd_set should have pulled in this as well,
+dnl but there is a special case for Mac OS X, possibly other BSD-derived
+dnl platforms.
+AC_DEFUN([CF_TYPE_FD_MASK],
+[
+AC_REQUIRE([CF_TYPE_FD_SET])
+
+AC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[
+ if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then
+ AC_TRY_COMPILE([
+#include <X11/Xpoll.h>],[fd_mask x],,
+ [CF_MSG_LOG(if we must define CSRG_BASED)
+# Xosdefs.h on Mac OS X may not define this (but it should).
+ AC_TRY_COMPILE([
+#define CSRG_BASED
+#include <X11/Xpoll.h>],[fd_mask x],
+ cf_cv_type_fd_mask=CSRG_BASED)])
+ else
+ cf_cv_type_fd_mask=$cf_cv_type_fd_set
+ fi
+])
+if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then
+ AC_DEFINE(CSRG_BASED)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_TYPE_FD_SET version: 4 updated: 2008/03/25 20:56:03
dnl --------------
dnl Check for the declaration of fd_set. Some platforms declare it in
dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>.
@@ -1817,20 +1846,22 @@ dnl Finally, if we are using this for an X application, Xpoll.h may include
dnl <sys/select.h>, so we don't want to do it twice.
AC_DEFUN([CF_TYPE_FD_SET],
[
+AC_CHECK_HEADERS(X11/Xpoll.h)
+
AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set,
- [echo "trying sys/types alone" 1>&AC_FD_CC
+ [CF_MSG_LOG(sys/types alone)
AC_TRY_COMPILE([
#include <sys/types.h>],
[fd_set x],
[cf_cv_type_fd_set=sys/types.h],
- [echo "trying X11/Xpoll.h" 1>&AC_FD_CC
+ [CF_MSG_LOG(X11/Xpoll.h)
AC_TRY_COMPILE([
#ifdef HAVE_X11_XPOLL_H
#include <X11/Xpoll.h>
#endif],
[fd_set x],
[cf_cv_type_fd_set=X11/Xpoll.h],
- [echo "trying sys/select.h" 1>&AC_FD_CC
+ [CF_MSG_LOG(sys/select.h)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/select.h>],
@@ -2289,7 +2320,7 @@ int x = XkbBI_Info
test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT)
])
dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 25 updated: 2007/01/29 18:36:38
+dnl CF_XOPEN_SOURCE version: 26 updated: 2008/07/27 11:26:57
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -2309,7 +2340,7 @@ case $host_os in #(vi
aix[[45]]*) #(vi
CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
;;
-freebsd*) #(vi
+freebsd*|dragonfly*) #(vi
# 5.x headers associate
# _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
# _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
@@ -2475,7 +2506,7 @@ elif test "$cf_x_athena_include" != default ; then
fi
])
dnl ---------------------------------------------------------------------------
-dnl CF_X_ATHENA_LIBS version: 6 updated: 2006/11/30 17:57:11
+dnl CF_X_ATHENA_LIBS version: 7 updated: 2008/03/23 14:46:03
dnl ----------------
dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
@@ -2519,7 +2550,7 @@ do
done
if test -z "$cf_x_athena_lib" ; then
- AC_ERROR(
+ AC_MSG_ERROR(
[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
fi
@@ -2644,7 +2675,7 @@ AC_SUBST(HAVE_TYPE_FCCHAR32)
AC_SUBST(HAVE_TYPE_XFTCHARSPEC)
])
dnl ---------------------------------------------------------------------------
-dnl CF_X_TOOLKIT version: 11 updated: 2006/11/29 19:05:14
+dnl CF_X_TOOLKIT version: 12 updated: 2008/03/23 15:04:54
dnl ------------
dnl Check for X Toolkit libraries
dnl
@@ -2673,7 +2704,7 @@ AC_CHECK_LIB(Xt, XtAppInitialize,
[$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
if test $cf_have_X_LIBS = no ; then
- AC_WARN(
+ AC_MSG_WARN(
[Unable to successfully link X Toolkit library (-lXt) with
test program. You will have to check and add the proper libraries by hand
to makefile.])
diff --git a/app/xterm/button.c b/app/xterm/button.c
index 66ea199e2..3cc179860 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.285 2008/02/24 19:42:02 tom Exp $ */
+/* $XTermId: button.c,v 1.288 2008/07/27 19:36:37 tom Exp $ */
/*
* Copyright 1999-2007,2008 by Thomas E. Dickey
@@ -270,7 +270,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
}
/* get button # */
- button = event->xbutton.button - 1;
+ button = (int) event->xbutton.button - 1;
LocatorCoords(row, col, event->xbutton.x, event->xbutton.y, oor);
@@ -368,7 +368,7 @@ SendLocatorPosition(XtermWidget xw, XEvent * event)
* Button1 (left) and Button3 (right) are swapped in the mask relative to X.
*/
#define ButtonState(state, mask) \
-{ (state) = ((mask) & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; \
+{ (state) = (int) (((mask) & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8); \
/* swap Button1 & Button3 */ \
(state) = ((state) & ~(4|1)) | (((state)&1)?4:0) | (((state)&4)?1:0); \
}
@@ -632,10 +632,10 @@ isClick1_clean(TScreen * screen, XEvent * event)
delta = screen->multiClickTime + 1;
} else if (event->xbutton.time > lastButtonDownTime) {
/* most of the time */
- delta = event->xbutton.time - lastButtonDownTime;
+ delta = (int) (event->xbutton.time - lastButtonDownTime);
} else {
/* time has rolled over since lastButtonUpTime */
- delta = (((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time;
+ delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time);
}
return delta <= screen->multiClickTime;
@@ -658,10 +658,10 @@ isDoubleClick3(TScreen * screen, XEvent * event)
delta = screen->multiClickTime + 1;
} else if (event->xbutton.time > lastButton3DoubleDownTime) {
/* most of the time */
- delta = event->xbutton.time - lastButton3DoubleDownTime;
+ delta = (int) (event->xbutton.time - lastButton3DoubleDownTime);
} else {
/* time has rolled over since lastButton3DoubleDownTime */
- delta = (((Time) ~ 0) - lastButton3DoubleDownTime) + event->xbutton.time;
+ delta = (int) ((((Time) ~ 0) - lastButton3DoubleDownTime) + event->xbutton.time);
}
if (delta <= screen->multiClickTime) {
/* Double click */
@@ -697,10 +697,10 @@ CheckSecondPress3(TScreen * screen, XEvent * event)
delta = screen->multiClickTime + 1;
} else if (event->xbutton.time > lastButton3UpTime) {
/* most of the time */
- delta = event->xbutton.time - lastButton3UpTime;
+ delta = (int) (event->xbutton.time - lastButton3UpTime);
} else {
/* time has rolled over since lastButton3UpTime */
- delta = (((Time) ~ 0) - lastButton3UpTime) + event->xbutton.time;
+ delta = (int) ((((Time) ~ 0) - lastButton3UpTime) + event->xbutton.time);
}
if (delta <= screen->multiClickTime) {
CELL cell;
@@ -772,7 +772,7 @@ ReadLineMovePoint(TScreen * screen, int col, int ldelta)
line[count++] = ANSI_ESC;
line[count++] = '['; /* XXX maybe sometimes O is better? */
}
- line[count++] = (col > 0 ? 'C' : 'D');
+ line[count++] = CharOf(col > 0 ? 'C' : 'D');
if (col < 0)
col = -col;
while (col--)
@@ -813,8 +813,8 @@ DiredButton(Widget w,
Line[0] = CONTROL('X');
Line[1] = ANSI_ESC;
Line[2] = 'G';
- Line[3] = ' ' + col;
- Line[4] = ' ' + line;
+ Line[3] = CharOf(' ' + col);
+ Line[4] = CharOf(' ' + line);
v_write(screen->respond, Line, 5);
}
}
@@ -844,10 +844,10 @@ ReadLineButton(Widget w,
delta = screen->multiClickTime + 1;
} else if (event->xbutton.time > lastButtonDownTime) {
/* most of the time */
- delta = event->xbutton.time - lastButtonDownTime;
+ delta = (int) (event->xbutton.time - lastButtonDownTime);
} else {
/* time has rolled over since lastButtonUpTime */
- delta = (((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time;
+ delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time);
}
if (delta > screen->multiClickTime)
goto finish; /* All this work for this... */
@@ -876,7 +876,7 @@ ReadLineButton(Widget w,
Line[0] = ANSI_ESC;
/* XXX: sometimes it is better to send '['? */
Line[1] = 'O';
- Line[2] = (col > 0 ? 'C' : 'D');
+ Line[2] = CharOf(col > 0 ? 'C' : 'D');
if (col < 0)
col = -col;
while (col--)
@@ -1042,8 +1042,8 @@ static unsigned
DECtoASCII(unsigned ch)
{
if (xtermIsDecGraphic(ch)) {
- ch = "###########+++++##-##++++|######"[ch];
- /* 01234567890123456789012345678901 */
+ ch = CharOf("###########+++++##-##++++|######"[ch]);
+ /* 01234567890123456789012345678901 */
}
return ch;
}
@@ -1076,7 +1076,7 @@ UTF8toLatin1(Char * s, unsigned len, unsigned long *result)
if (value == UCS_REPL) {
*q++ = '#';
} else if (value < 256) {
- *q++ = value;
+ *q++ = CharOf(value);
} else {
unsigned eqv = ucs2dec(value);
if (xtermIsDecGraphic(eqv)) {
@@ -1406,11 +1406,11 @@ base64_flush(TScreen * screen)
case 0:
break;
case 2:
- x = base64_code[screen->base64_accu << 4];
+ x = CharOf(base64_code[screen->base64_accu << 4]);
tty_vwrite(screen->respond, &x, 1);
break;
case 4:
- x = base64_code[screen->base64_accu << 2];
+ x = CharOf(base64_code[screen->base64_accu << 2]);
tty_vwrite(screen->respond, &x, 1);
break;
}
@@ -1436,20 +1436,20 @@ _qWriteSelectionData(TScreen * screen, Char * lag, unsigned length)
while (length--) {
switch (screen->base64_count) {
case 0:
- buf[x++] = base64_code[*p >> 2];
+ buf[x++] = CharOf(base64_code[*p >> 2]);
screen->base64_accu = (*p & 0x3);
screen->base64_count = 2;
++p;
break;
case 2:
- buf[x++] = base64_code[(screen->base64_accu << 4) + (*p >> 4)];
+ buf[x++] = CharOf(base64_code[(screen->base64_accu << 4) + (*p >> 4)]);
screen->base64_accu = (*p & 0xF);
screen->base64_count = 4;
++p;
break;
case 4:
- buf[x++] = base64_code[(screen->base64_accu << 2) + (*p >> 6)];
- buf[x++] = base64_code[*p & 0x3F];
+ buf[x++] = CharOf(base64_code[(screen->base64_accu << 2) + (*p >> 6)]);
+ buf[x++] = CharOf(base64_code[*p & 0x3F]);
screen->base64_accu = 0;
screen->base64_count = 0;
++p;
@@ -1617,15 +1617,35 @@ SelectionReceived(Widget w,
if (text_list != NULL && text_list_count != 0) {
int i;
Char *data;
- unsigned long size;
+ char **new_text_list, *tmp;
+ unsigned long size, new_size;
+ /* XLib StringList actually uses only two
+ * pointers, one for the list itself, and one for
+ * the data. Pointer to the data is the first
+ * element of the list, the rest (if any) list
+ * elements point to the same memory block as the
+ * first element
+ */
+ new_size = 0;
for (i = 0; i < text_list_count; ++i) {
data = (Char *) text_list[i];
- size = strlen(text_list[i]);
+ size = strlen(text_list[i]) + 1;
data = UTF8toLatin1(data, size, &size);
- XFree(text_list[i]);
- text_list[i] = XtMalloc(size + 1);
- memcpy(text_list[i], data, size + 1);
+ new_size += size + 1;
}
+ new_text_list =
+ (char **) XtMalloc(sizeof(char *) * text_list_count);
+ new_text_list[0] = tmp = XtMalloc(new_size);
+ for (i = 0; i < text_list_count; ++i) {
+ data = (Char *) text_list[i];
+ size = strlen(text_list[i]) + 1;
+ data = UTF8toLatin1(data, size, &size);
+ memcpy(tmp, data, size + 1);
+ new_text_list[i] = tmp;
+ tmp += size + 1;
+ }
+ XFreeStringList(text_list);
+ text_list = new_text_list;
}
} else
#endif
@@ -1737,10 +1757,10 @@ EvalSelectUnit(TScreen * screen,
delta = screen->multiClickTime + 1;
} else if (buttonDownTime > screen->lastButtonUpTime) {
/* most of the time */
- delta = buttonDownTime - screen->lastButtonUpTime;
+ delta = (int) (buttonDownTime - screen->lastButtonUpTime);
} else {
/* time has rolled over since lastButtonUpTime */
- delta = (((Time) ~ 0) - screen->lastButtonUpTime) + buttonDownTime;
+ delta = (int) ((((Time) ~ 0) - screen->lastButtonUpTime) + buttonDownTime);
}
if (delta > screen->multiClickTime) {
@@ -1923,17 +1943,17 @@ EndExtend(XtermWidget xw,
&& isSameCELL(&cell, &(screen->endSel))) {
/* Use short-form emacs select */
line[count++] = 't';
- line[count++] = ' ' + screen->endSel.col + 1;
- line[count++] = ' ' + screen->endSel.row + 1;
+ line[count++] = CharOf(' ' + screen->endSel.col + 1);
+ line[count++] = CharOf(' ' + screen->endSel.row + 1);
} else {
/* long-form, specify everything */
line[count++] = 'T';
- line[count++] = ' ' + screen->startSel.col + 1;
- line[count++] = ' ' + screen->startSel.row + 1;
- line[count++] = ' ' + screen->endSel.col + 1;
- line[count++] = ' ' + screen->endSel.row + 1;
- line[count++] = ' ' + cell.col + 1;
- line[count++] = ' ' + cell.row + 1;
+ line[count++] = CharOf(' ' + screen->startSel.col + 1);
+ line[count++] = CharOf(' ' + screen->startSel.row + 1);
+ line[count++] = CharOf(' ' + screen->endSel.col + 1);
+ line[count++] = CharOf(' ' + screen->endSel.row + 1);
+ line[count++] = CharOf(' ' + cell.col + 1);
+ line[count++] = CharOf(' ' + cell.row + 1);
}
v_write(screen->respond, line, count);
TrackText(xw, &zeroCELL, &zeroCELL);
@@ -2361,7 +2381,7 @@ class_of(TScreen * screen, CELL * cell)
}
#endif
- value = XTERM_CELL(temp.row, temp.col);
+ value = (int) XTERM_CELL(temp.row, temp.col);
if_OPT_WIDE_CHARS(screen, {
return CharacterClass(value);
});
@@ -2442,7 +2462,7 @@ lengthOfLines(TScreen * screen, int firstRow, int lastRow)
for (n = firstRow; n <= lastRow; ++n) {
int value = LastTextCol(screen, n);
if (value >= 0)
- length += (value + 1);
+ length += (unsigned) (value + 1);
}
return length;
}
@@ -2463,7 +2483,7 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed)
* string were UTF-8.
*/
if_OPT_WIDE_CHARS(screen, {
- need *= (MAX_PTRS * 6);
+ need *= (unsigned) (MAX_PTRS * 6);
});
if ((result = TypeCallocN(Char, need + 1)) != 0) {
@@ -3086,20 +3106,20 @@ AppendToSelectionBuffer(TScreen * screen, unsigned c)
break;
case 2:
- ch = (screen->base64_accu << 6) + six;
+ ch = CharOf((screen->base64_accu << 6) + six);
screen->base64_count = 0;
AppendStrToSelectionBuffer(screen, &ch, 1);
break;
case 4:
- ch = (screen->base64_accu << 4) + (six >> 2);
+ ch = CharOf((screen->base64_accu << 4) + (six >> 2));
screen->base64_accu = (six & 0x3);
screen->base64_count = 2;
AppendStrToSelectionBuffer(screen, &ch, 1);
break;
case 6:
- ch = (screen->base64_accu << 2) + (six >> 4);
+ ch = CharOf((screen->base64_accu << 2) + (six >> 4));
screen->base64_accu = (six & 0xF);
screen->base64_count = 4;
AppendStrToSelectionBuffer(screen, &ch, 1);
@@ -3573,7 +3593,7 @@ SaveText(TScreen * screen,
} else if (c == 0x7f) {
c = 0x5f;
}
- *lp++ = A2E(c);
+ *lp++ = CharOf(A2E(c));
}
if (c != E2A(' '))
result = lp;
@@ -3601,7 +3621,7 @@ SaveText(TScreen * screen,
/* Position: 32 - 255. */
-static int
+static Char
BtnCode(XButtonEvent * event, int button)
{
int result = 32 + (KeyState(event->state) << 2);
@@ -3615,7 +3635,7 @@ BtnCode(XButtonEvent * event, int button)
result += 32;
result += button;
}
- return result;
+ return CharOf(result);
}
#define MOUSE_LIMIT (255 - 32)
@@ -3675,7 +3695,7 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
/* Add event code to key sequence */
if (screen->send_mouse_pos == X10_MOUSE) {
- line[count++] = ' ' + button;
+ line[count++] = CharOf(' ' + button);
} else {
/* Button-Motion events */
switch (event->type) {
@@ -3714,8 +3734,8 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
screen->mouse_col = col;
/* Add pointer position to key sequence */
- line[count++] = ' ' + col + 1;
- line[count++] = ' ' + row + 1;
+ line[count++] = CharOf(' ' + col + 1);
+ line[count++] = CharOf(' ' + row + 1);
TRACE(("mouse at %d,%d button+mask = %#x\n", row, col,
(screen->control_eight_bits) ? line[2] : line[3]));
@@ -3743,7 +3763,7 @@ SendFocusButton(XtermWidget xw, XFocusChangeEvent * event)
reply.a_pintro = '>';
}
#endif
- reply.a_final = (event->type == FocusIn) ? 'I' : 'O';
+ reply.a_final = CharOf((event->type == FocusIn) ? 'I' : 'O');
unparseseq(xw, &reply);
}
return;
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index 54d6dca7e..1426b14c6 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.836 2008/02/29 01:55:13 tom Exp $ */
+/* $XTermId: charproc.c,v 1.848 2008/07/27 19:00:21 tom Exp $ */
/*
@@ -614,6 +614,8 @@ static XtResource resources[] =
keyboard.modify_1st.other_keys, 0),
Ires(XtNmodifyStringKeys, XtCModifyStringKeys,
keyboard.modify_1st.string_keys, 0),
+ Ires(XtNformatOtherKeys, XtCFormatOtherKeys,
+ keyboard.format_keys, 0),
#endif
#if OPT_NUM_LOCK
@@ -1080,27 +1082,28 @@ which_table(Const PARSE_T * table)
char *result = "?";
/* *INDENT-OFF* */
WHICH_TABLE (ansi_table);
- else WHICH_TABLE (csi_table);
+ else WHICH_TABLE (cigtable);
else WHICH_TABLE (csi2_table);
else WHICH_TABLE (csi_ex_table);
else WHICH_TABLE (csi_quo_table);
-#if OPT_DEC_LOCATOR
- else WHICH_TABLE (csi_tick_table);
-#endif
-#if OPT_DEC_RECTOPS
- else WHICH_TABLE (csi_dollar_table);
- else WHICH_TABLE (csi_star_table);
-#endif
- else WHICH_TABLE (dec_table);
+ else WHICH_TABLE (csi_table);
else WHICH_TABLE (dec2_table);
else WHICH_TABLE (dec3_table);
- else WHICH_TABLE (cigtable);
+ else WHICH_TABLE (dec_table);
else WHICH_TABLE (eigtable);
- else WHICH_TABLE (esc_table);
else WHICH_TABLE (esc_sp_table);
+ else WHICH_TABLE (esc_table);
else WHICH_TABLE (scrtable);
+ else WHICH_TABLE (scs96table);
else WHICH_TABLE (scstable);
else WHICH_TABLE (sos_table);
+#if OPT_DEC_LOCATOR
+ else WHICH_TABLE (csi_tick_table);
+#endif
+#if OPT_DEC_RECTOPS
+ else WHICH_TABLE (csi_dollar_table);
+ else WHICH_TABLE (csi_star_table);
+#endif
#if OPT_WIDE_CHARS
else WHICH_TABLE (esc_pct_table);
#endif
@@ -1157,6 +1160,7 @@ struct ParseState {
Const PARSE_T *groundtable;
Const PARSE_T *parsestate;
int scstype;
+ int scssize;
Bool private_function; /* distinguish private-mode from standard */
int string_mode; /* nonzero iff we're processing a string */
int lastchar; /* positive iff we had a graphic character */
@@ -1168,6 +1172,32 @@ struct ParseState {
static struct ParseState myState;
+static void
+init_groundtable(TScreen * screen, struct ParseState *sp)
+{
+#if OPT_VT52_MODE
+ if (!(screen->vtXX_level)) {
+ sp->groundtable = vt52_table;
+ } else if (screen->terminal_id >= 100)
+#endif
+ {
+ sp->groundtable = ansi_table;
+ }
+}
+
+static void
+select_charset(struct ParseState *sp, int type, int size)
+{
+ TRACE(("select_charset %#x %d\n", type, size));
+ sp->scstype = type;
+ sp->scssize = size;
+ if (size == 94) {
+ sp->parsestate = scstable;
+ } else {
+ sp->parsestate = scs96table;
+ }
+}
+
static Boolean
doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
{
@@ -1264,14 +1294,25 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
}
#endif
- /*
- * The parsing tables all have 256 entries. If we're supporting
- * wide characters, we handle them by treating them the same as
- * printing characters.
- */
laststate = sp->nextstate;
+ if (c == ANSI_DEL
+ && sp->parsestate == sp->groundtable
+ && sp->scssize == 96
+ && sp->scstype != 0) {
+ /*
+ * Handle special case of shifts for 96-character sets by checking
+ * if we have a DEL. The other special case for SPACE will always
+ * be printable.
+ */
+ sp->nextstate = CASE_PRINT;
+ } else
#if OPT_WIDE_CHARS
if (c > 255) {
+ /*
+ * The parsing tables all have 256 entries. If we're supporting
+ * wide characters, we handle them by treating them the same as
+ * printing characters.
+ */
if (sp->parsestate == sp->groundtable) {
sp->nextstate = CASE_PRINT;
} else if (sp->parsestate == sos_table) {
@@ -1589,26 +1630,37 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_SCS0_STATE:
/* enter scs state 0 */
- sp->scstype = 0;
- sp->parsestate = scstable;
+ select_charset(sp, 0, 94);
break;
case CASE_SCS1_STATE:
/* enter scs state 1 */
- sp->scstype = 1;
- sp->parsestate = scstable;
+ select_charset(sp, 1, 94);
break;
case CASE_SCS2_STATE:
/* enter scs state 2 */
- sp->scstype = 2;
- sp->parsestate = scstable;
+ select_charset(sp, 2, 94);
break;
case CASE_SCS3_STATE:
/* enter scs state 3 */
- sp->scstype = 3;
- sp->parsestate = scstable;
+ select_charset(sp, 3, 94);
+ break;
+
+ case CASE_SCS1A_STATE:
+ /* enter scs state 1 */
+ select_charset(sp, 1, 96);
+ break;
+
+ case CASE_SCS2A_STATE:
+ /* enter scs state 2 */
+ select_charset(sp, 2, 96);
+ break;
+
+ case CASE_SCS3A_STATE:
+ /* enter scs state 3 */
+ select_charset(sp, 3, 96);
break;
case CASE_ESC_IGNORE:
@@ -2257,12 +2309,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECRST:
/* DECRST */
dpmodes(xw, bitclr);
-#if OPT_VT52_MODE
- if (screen->vtXX_level == 0)
- sp->groundtable = vt52_table;
- else if (screen->terminal_id >= 100)
- sp->groundtable = ansi_table;
-#endif
+ init_groundtable(screen, sp);
sp->parsestate = sp->groundtable;
break;
@@ -2875,19 +2922,15 @@ VTparse(XtermWidget xw)
(void) setjmp(vtjmpbuf);
screen = &xw->screen;
memset(&myState, 0, sizeof(myState));
-#if OPT_VT52_MODE
- myState.groundtable = screen->vtXX_level ? ansi_table : vt52_table;
-#else
- myState.groundtable = ansi_table;
-#endif
- myState.parsestate = myState.groundtable;
+ myState.scssize = 94; /* number of printable/nonspace ASCII */
myState.lastchar = -1; /* not a legal IChar */
myState.nextstate = -1; /* not a legal state */
- for (;;) {
- if (!doparsing(xw, doinput(), &myState))
- return;
- }
+ init_groundtable(screen, &myState);
+ myState.parsestate = myState.groundtable;
+
+ do {
+ } while (doparsing(xw, doinput(), &myState));
}
static Char *v_buffer; /* pointer to physical buffer */
@@ -3087,15 +3130,15 @@ in_put(XtermWidget xw)
if (tt_changed) {
tt_changed = False;
- stat = XtMakeResizeRequest((Widget) xw,
- ((Dimension) FontWidth(screen)
- * (tt_width)
- + 2 * screen->border
- + screen->fullVwin.sb_info.width),
- ((Dimension) FontHeight(screen)
- * (tt_length)
- + 2 * screen->border),
- &replyWidth, &replyHeight);
+ stat = REQ_RESIZE((Widget) xw,
+ ((Dimension) FontWidth(screen)
+ * (tt_width)
+ + 2 * screen->border
+ + screen->fullVwin.sb_info.width),
+ ((Dimension) FontHeight(screen)
+ * (tt_length)
+ + 2 * screen->border),
+ &replyWidth, &replyHeight);
if (stat == XtGeometryYes || stat == XtGeometryDone) {
xw->core.width = replyWidth;
@@ -3380,10 +3423,9 @@ dotext(XtermWidget xw,
* for line-drawing characters.
*/
if ((screen->utf8_mode == uFalse)
- || (screen->vt100_graphics && charset == '0'))
+ || (screen->vt100_graphics))
#endif
-
- if (!xtermCharSetOut(buf, buf + len, charset))
+ if (!xtermCharSetOut(xw, buf, buf + len, charset))
return;
if_OPT_XMC_GLITCH(screen, {
@@ -3560,7 +3602,8 @@ HandleStructNotify(Widget w GCC_UNUSED,
{
{XtNiconName, (XtArgVal) & icon_name}
};
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
switch (event->type) {
case MapNotify:
@@ -3590,14 +3633,30 @@ HandleStructNotify(Widget w GCC_UNUSED,
break;
case ConfigureNotify:
if (event->xconfigure.window == XtWindow(toplevel)) {
+ int height, width;
+
+ /*
+ * Some window managers modify the configuration during
+ * initialization. Skip notification events that we know are
+ * obsolete because there is already another in the queue.
+ */
+ do {
+ height = event->xconfigure.height;
+ width = event->xconfigure.width;
+ TRACE(("HandleStructNotify(ConfigureNotify) %d,%d %dx%d\n",
+ event->xconfigure.y, event->xconfigure.x,
+ event->xconfigure.height, event->xconfigure.width));
+
+ } while (XCheckTypedWindowEvent(XtDisplay(xw),
+ event->xconfigure.window,
+ ConfigureNotify, event));
#if OPT_TOOLBAR
- TRACE(("HandleStructNotify(ConfigureNotify)\n"));
/*
* The notification is for the top-level widget, but we care about
* vt100 (ignore the tek4014 window).
*/
- if (term->screen.Vshow) {
- VTwin *Vwin = WhichVWin(&(term->screen));
+ if (xw->screen.Vshow) {
+ VTwin *Vwin = WhichVWin(&(xw->screen));
TbInfo *info = &(Vwin->tb_info);
TbInfo save = *info;
@@ -3620,36 +3679,19 @@ HandleStructNotify(Widget w GCC_UNUSED,
* FIXME: Window manager still may be using the old
* values. Try to fool it.
*/
- XtMakeResizeRequest((Widget) term,
- screen->fullVwin.fullwidth,
- info->menu_height
- - save.menu_height
- + screen->fullVwin.fullheight,
- NULL, NULL);
+ REQ_RESIZE((Widget) xw,
+ screen->fullVwin.fullwidth,
+ info->menu_height
+ - save.menu_height
+ + screen->fullVwin.fullheight,
+ NULL, NULL);
repairSizeHints();
}
}
}
#else
- int height, width;
-
- /*
- * Some window managers modify the configuration during
- * initialization. Skip notification events that we know are
- * obsolete because there is already another in the queue.
- */
- do {
- height = event->xconfigure.height;
- width = event->xconfigure.width;
- TRACE(("HandleStructNotify(ConfigureNotify) %dx%d\n",
- event->xconfigure.height, event->xconfigure.width));
-
- } while (XCheckTypedWindowEvent(XtDisplay(term),
- event->xconfigure.window,
- ConfigureNotify, event));
-
- if (height != term->hints.height || width != term->hints.width)
- RequestResize(term, height, width, False);
+ if (height != xw->hints.height || width != xw->hints.width)
+ RequestResize(xw, height, width, False);
#endif /* OPT_TOOLBAR */
}
break;
@@ -4003,6 +4045,28 @@ dpmodes(XtermWidget xw,
set_bool_mode(screen->delete_is_del);
update_delete_del();
break;
+#if OPT_NUM_LOCK
+ case 1039:
+ set_bool_mode(screen->alt_sends_esc);
+ update_alt_esc();
+ break;
+#endif
+ case 1040:
+ set_bool_mode(screen->keepSelection);
+ update_keepSelection();
+ break;
+ case 1041:
+ set_bool_mode(screen->selectToClipboard);
+ update_selectToClipboard();
+ break;
+ case 1042:
+ set_bool_mode(screen->bellIsUrgent);
+ update_bellIsUrgent();
+ break;
+ case 1043:
+ set_bool_mode(screen->poponbell);
+ update_poponbell();
+ break;
case 1048:
if (!xw->misc.titeInhibit) {
if (IsSM())
@@ -4760,6 +4824,13 @@ SwitchBufs(XtermWidget xw)
ScrnUpdate(xw, 0, 0, rows, MaxCols(screen), False);
}
+Bool
+CheckBufPtrs(TScreen * screen)
+{
+ return (screen->visbuf != 0
+ && screen->altbuf != 0);
+}
+
/*
* Swap buffer line pointers between alternate and regular screens.
* visbuf contains pointers from allbuf or altbuf for the visible screen,
@@ -4770,11 +4841,13 @@ SwitchBufs(XtermWidget xw)
void
SwitchBufPtrs(TScreen * screen)
{
- size_t len = ScrnPointers(screen, (unsigned) MaxRows(screen));
+ if (CheckBufPtrs(screen)) {
+ size_t len = ScrnPointers(screen, (unsigned) MaxRows(screen));
- memcpy((char *) screen->save_ptr, (char *) screen->visbuf, len);
- memcpy((char *) screen->visbuf, (char *) screen->altbuf, len);
- memcpy((char *) screen->altbuf, (char *) screen->save_ptr, len);
+ memcpy((char *) screen->save_ptr, (char *) screen->visbuf, len);
+ memcpy((char *) screen->visbuf, (char *) screen->altbuf, len);
+ memcpy((char *) screen->altbuf, (char *) screen->save_ptr, len);
+ }
}
void
@@ -4808,11 +4881,13 @@ VTRun(void)
Tpushb = Tpushback;
}
#endif
+ screen->is_running = True;
if (!setjmp(VTend))
VTparse(term);
StopBlinking(screen);
HideCursor();
screen->cursor_set = OFF;
+ TRACE(("... VTRun\n"));
}
/*ARGSUSED*/
@@ -4948,13 +5023,9 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text)
getXtermSizeHints(xw);
#endif
- status = XtMakeResizeRequest((Widget) xw,
- askedWidth, askedHeight,
- &replyWidth, &replyHeight);
- TRACE(("...RequestResize XtMakeResizeRequest %dx%d -> %dx%d (status %d)\n",
- askedHeight, askedWidth,
- replyHeight, replyWidth,
- status));
+ status = REQ_RESIZE((Widget) xw,
+ askedWidth, askedHeight,
+ &replyWidth, &replyHeight);
if (status == XtGeometryYes ||
status == XtGeometryDone) {
@@ -5892,6 +5963,7 @@ VTInitialize(Widget wrequest,
init_Ires(keyboard.modify_1st.keypad_keys);
init_Ires(keyboard.modify_1st.other_keys);
init_Ires(keyboard.modify_1st.string_keys);
+ init_Ires(keyboard.format_keys);
wnew->keyboard.modify_now = wnew->keyboard.modify_1st;
#endif
@@ -5992,6 +6064,12 @@ VTDestroy(Widget w GCC_UNUSED)
#ifndef NO_ACTIVE_ICON
releaseWindowGCs(xw, &(screen->iconVwin));
#endif
+ XtUninstallTranslations((Widget)xw);
+ XtUninstallTranslations(screen->scrollWidget);
+#if OPT_TOOLBAR
+ XtUninstallTranslations((Widget)XtParent(xw));
+#endif
+ XtUninstallTranslations((Widget)SHELL_OF(xw));
if (screen->hidden_cursor)
XFreeCursor(screen->display, screen->hidden_cursor);
@@ -6189,11 +6267,9 @@ VTRealize(Widget w,
* Note that the size-hints are for the shell, while the resize-request
* is for the vt100 widget. They are not the same size.
*/
- TRACE(("make resize request %dx%d\n", height, width));
- (void) XtMakeResizeRequest((Widget) xw,
- (Dimension) width, (Dimension) height,
- &xw->core.width, &xw->core.height);
- TRACE(("...made resize request %dx%d\n", xw->core.height, xw->core.width));
+ (void) REQ_RESIZE((Widget) xw,
+ (Dimension) width, (Dimension) height,
+ &xw->core.width, &xw->core.height);
/* XXX This is bogus. We are parsing geometries too late. This
* is information that the shell widget ought to have before we get
@@ -6338,14 +6414,18 @@ VTRealize(Widget w,
screen->savedlines = 0;
- if (xw->misc.scrollbar) {
- screen->fullVwin.sb_info.width = 0;
- ScrollBarOn(xw, False, True);
- }
for (i = 0; i < 2; ++i) {
screen->alternate = !screen->alternate;
CursorSave(xw);
}
+
+ /*
+ * Do this last, since it may change the layout via a resize.
+ */
+ if (xw->misc.scrollbar) {
+ screen->fullVwin.sb_info.width = 0;
+ ScrollBarOn(xw, False, True);
+ }
return;
}
@@ -7273,11 +7353,10 @@ VTReset(XtermWidget xw, Bool full, Bool saved)
TRACE(("Making resize-request to restore 80-columns %dx%d\n",
reqHeight, reqWidth));
- XtMakeResizeRequest((Widget) xw,
- reqWidth,
- reqHeight,
- &replyWidth, &replyHeight);
- TRACE(("...result %dx%d\n", replyHeight, replyWidth));
+ REQ_RESIZE((Widget) xw,
+ reqWidth,
+ reqHeight,
+ &replyWidth, &replyHeight);
repairSizeHints();
XSync(screen->display, False); /* synchronize */
if (XtAppPending(app_con))
diff --git a/app/xterm/charsets.c b/app/xterm/charsets.c
index 70885e76c..d3bd79f07 100644
--- a/app/xterm/charsets.c
+++ b/app/xterm/charsets.c
@@ -1,12 +1,8 @@
-/* $XTermId: charsets.c,v 1.33 2006/07/02 17:28:50 tom Exp $ */
-
-/*
- * $XFree86: xc/programs/xterm/charsets.c,v 1.12 2005/01/14 01:50:02 dickey Exp $
- */
+/* $XTermId: charsets.c,v 1.40 2008/05/26 22:49:57 tom Exp $ */
/************************************************************
-Copyright 1998-2005,2006 by Thomas E. Dickey
+Copyright 1998-2007,2008 by Thomas E. Dickey
All Rights Reserved
@@ -63,399 +59,428 @@ authorization.
/*
* Translate an input keysym to the corresponding NRC keysym.
*/
-unsigned xtermCharSetIn(unsigned code, int charset)
+unsigned
+xtermCharSetIn(unsigned code, int charset)
{
- if (code >= 128 && code < 256) {
- switch (charset) {
- case 'A': /* United Kingdom set (or Latin 1) */
- if (code == XK_sterling)
- code = 0x23;
- code &= 0x7f;
- break;
+#define MAP(to, from) case from: code = to; break
+
+ if (code >= 128 && code < 256) {
+ switch (charset) {
+ case 'A': /* United Kingdom set (or Latin 1) */
+ if (code == XK_sterling)
+ code = 0x23;
+ code &= 0x7f;
+ break;
#if OPT_XMC_GLITCH
- case '?':
+ case '?':
#endif
- case '1': /* Alternate Character ROM standard characters */
- case '2': /* Alternate Character ROM special graphics */
- case 'B': /* ASCII set */
- break;
-
- case '0': /* special graphics (line drawing) */
- break;
-
- case '4': /* Dutch */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_threequarters: code = 0x40; break;
- case XK_ydiaeresis: code = 0x5b; break;
- case XK_onehalf: code = 0x5c; break;
- /* N/A case XK_bar: code = 0x5d; break; */
- case XK_diaeresis: code = 0x7b; break;
- /* N/A case XK_f: code = 0x7c; break; */
- case XK_onequarter: code = 0x7d; break;
- case XK_acute: code = 0x7e; break;
- }
- break;
-
- case 'C':
- case '5': /* Finnish */
- switch (code) {
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_eacute: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case 'R': /* French */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_agrave: code = 0x40; break;
- case XK_degree: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_section: code = 0x5d; break;
- case XK_eacute: code = 0x7b; break;
- case XK_ugrave: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_diaeresis: code = 0x7e; break;
- }
- break;
-
- case 'Q': /* French Canadian */
- switch (code) {
- case XK_agrave: code = 0x40; break;
- case XK_acircumflex: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_ecircumflex: code = 0x5d; break;
- case XK_icircumflex: code = 0x5e; break;
- case XK_ocircumflex: code = 0x60; break;
- case XK_eacute: code = 0x7b; break;
- case XK_ugrave: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_ucircumflex: code = 0x7e; break;
- }
- break;
-
- case 'K': /* German */
- switch (code) {
- case XK_section: code = 0x40; break;
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Udiaeresis: code = 0x5d; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_udiaeresis: code = 0x7d; break;
- case XK_ssharp: code = 0x7e; break;
- }
- break;
-
- case 'Y': /* Italian */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_section: code = 0x40; break;
- case XK_degree: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_eacute: code = 0x5d; break;
- case XK_ugrave: code = 0x60; break;
- case XK_agrave: code = 0x7b; break;
- case XK_ograve: code = 0x7c; break;
- case XK_egrave: code = 0x7d; break;
- case XK_igrave: code = 0x7e; break;
- }
- break;
-
- case 'E':
- case '6': /* Norwegian/Danish */
- switch (code) {
- case XK_Adiaeresis: code = 0x40; break;
- case XK_AE: code = 0x5b; break;
- case XK_Ooblique: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_adiaeresis: code = 0x60; break;
- case XK_ae: code = 0x7b; break;
- case XK_oslash: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case 'Z': /* Spanish */
- switch (code) {
- case XK_sterling: code = 0x23; break;
- case XK_section: code = 0x40; break;
- case XK_exclamdown: code = 0x5b; break;
- case XK_Ntilde: code = 0x5c; break;
- case XK_questiondown: code = 0x5d; break;
- case XK_degree: code = 0x7b; break;
- case XK_ntilde: code = 0x7c; break;
- case XK_ccedilla: code = 0x7d; break;
- }
- break;
-
- case 'H':
- case '7': /* Swedish */
- switch (code) {
- case XK_Eacute: code = 0x40; break;
- case XK_Adiaeresis: code = 0x5b; break;
- case XK_Odiaeresis: code = 0x5c; break;
- case XK_Aring: code = 0x5d; break;
- case XK_Udiaeresis: code = 0x5e; break;
- case XK_eacute: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_aring: code = 0x7d; break;
- case XK_udiaeresis: code = 0x7e; break;
- }
- break;
-
- case '=': /* Swiss */
- switch (code) {
- case XK_ugrave: code = 0x23; break;
- case XK_agrave: code = 0x40; break;
- case XK_eacute: code = 0x5b; break;
- case XK_ccedilla: code = 0x5c; break;
- case XK_ecircumflex: code = 0x5d; break;
- case XK_icircumflex: code = 0x5e; break;
- case XK_egrave: code = 0x5f; break;
- case XK_ocircumflex: code = 0x60; break;
- case XK_adiaeresis: code = 0x7b; break;
- case XK_odiaeresis: code = 0x7c; break;
- case XK_udiaeresis: code = 0x7d; break;
- case XK_ucircumflex: code = 0x7e; break;
- }
- break;
-
- default: /* any character sets we don't recognize*/
- break;
- }
- code &= 0x7f; /* NRC in any case is 7-bit */
+ case '1': /* Alternate Character ROM standard characters */
+ case '2': /* Alternate Character ROM special graphics */
+ case 'B': /* ASCII set */
+ break;
+
+ case '0': /* special graphics (line drawing) */
+ break;
+
+ case '4': /* Dutch */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_threequarters);
+ MAP(0x5b, XK_ydiaeresis);
+ MAP(0x5c, XK_onehalf);
+ MAP(0x5d, XK_bar); /* glyph is not ISO-8859-1 */
+ MAP(0x7b, XK_diaeresis);
+ MAP(0x7c, XK_f); /* glyph is not ISO-8859-1 */
+ MAP(0x7d, XK_onequarter);
+ MAP(0x7e, XK_acute);
+ }
+ break;
+
+ case 'C':
+ case '5': /* Finnish */
+ switch (code) {
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'R': /* French */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_section);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_diaeresis);
+ }
+ break;
+
+ case 'Q': /* French Canadian */
+ switch (code) {
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_acircumflex);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ case 'K': /* German */
+ switch (code) {
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Udiaeresis);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ssharp);
+ }
+ break;
+
+ case 'Y': /* Italian */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_eacute);
+ MAP(0x60, XK_ugrave);
+ MAP(0x7b, XK_agrave);
+ MAP(0x7c, XK_ograve);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_igrave);
+ }
+ break;
+
+ case 'E':
+ case '6': /* Norwegian/Danish */
+ switch (code) {
+ MAP(0x40, XK_Adiaeresis);
+ MAP(0x5b, XK_AE);
+ MAP(0x5c, XK_Ooblique);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_adiaeresis);
+ MAP(0x7b, XK_ae);
+ MAP(0x7c, XK_oslash);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'Z': /* Spanish */
+ switch (code) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_exclamdown);
+ MAP(0x5c, XK_Ntilde);
+ MAP(0x5d, XK_questiondown);
+ MAP(0x7b, XK_degree);
+ MAP(0x7c, XK_ntilde);
+ MAP(0x7d, XK_ccedilla);
+ }
+ break;
+
+ case 'H':
+ case '7': /* Swedish */
+ switch (code) {
+ MAP(0x40, XK_Eacute);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case '=': /* Swiss */
+ switch (code) {
+ MAP(0x23, XK_ugrave);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_eacute);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x5f, XK_egrave);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ default: /* any character sets we don't recognize */
+ break;
}
- return code;
+ code &= 0x7f; /* NRC in any case is 7-bit */
+ }
+ return code;
+#undef MAP
}
/*
* Translate a string to the display form. This assumes the font has the
* DEC graphic characters in cells 0-31, and otherwise is ISO-8859-1.
*/
-int xtermCharSetOut(IChar *buf, IChar *ptr, int leftset)
+int
+xtermCharSetOut(XtermWidget xw, IChar * buf, IChar * ptr, int leftset)
{
- IChar *s;
- register TScreen *screen = &term->screen;
- int count = 0;
- int rightset = screen->gsets[(int)(screen->curgr)];
-
- TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) SS%d:%s\n",
- leftset, screen->curgl,
- rightset, screen->curgr,
- screen->curss,
- visibleIChar(buf, (unsigned)(ptr - buf))));
-
- for (s = buf; s < ptr; ++s) {
- int eight = CharOf(E2A(*s));
- int seven = eight & 0x7f;
- int cs = (eight >= 128) ? rightset : leftset;
- int chr = eight;
-
- count++;
- switch (cs) {
- case 'A': /* United Kingdom set (or Latin 1) */
- if ((term->flags & NATIONAL)
- || (screen->vtXX_level <= 1)) {
- if (chr == 0x23)
- chr = XPOUND; /* UK pound sign*/
- } else {
- chr = (seven | 0x80);
- }
- break;
+ IChar *s;
+ TScreen *screen = TScreenOf(xw);
+ int count = 0;
+ int rightset = screen->gsets[(int) (screen->curgr)];
+
+#define MAP(from, to) case from: chr = to; break
+
+ TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) SS%d\n\t%s\n",
+ leftset, screen->curgl,
+ rightset, screen->curgr,
+ screen->curss,
+ visibleIChar(buf, (unsigned) (ptr - buf))));
+
+ for (s = buf; s < ptr; ++s) {
+ int eight = CharOf(E2A(*s));
+ int seven = eight & 0x7f;
+ int cs = (eight >= 128) ? rightset : leftset;
+ int chr = eight;
+
+ count++;
+#if OPT_WIDE_CHARS
+ /*
+ * This is only partly right - prevent inadvertant remapping of
+ * the replacement character and other non-8bit codes into bogus
+ * 8bit codes.
+ */
+ if (screen->utf8_mode) {
+ if (*s > 255)
+ continue;
+ }
+#endif
+ switch (cs) {
+ case 'A': /* United Kingdom set (or Latin 1) */
+ if ((xw->flags & NATIONAL)
+ || (screen->vtXX_level <= 1)) {
+ if (chr == 0x23) {
+#if OPT_WIDE_CHARS
+ chr = (screen->utf8_mode
+ ? 0xa3
+ : XTERM_POUND);
+#else
+ chr = XTERM_POUND;
+#endif
+ }
+ } else {
+ chr = (seven | 0x80);
+ }
+ break;
#if OPT_XMC_GLITCH
- case '?':
+ case '?':
#endif
- case '1': /* Alternate Character ROM standard characters */
- case '2': /* Alternate Character ROM special graphics */
- case 'B': /* ASCII set */
- break;
+ case '1': /* Alternate Character ROM standard characters */
+ case '2': /* Alternate Character ROM special graphics */
+ case 'B': /* ASCII set */
+ break;
- case '0': /* special graphics (line drawing) */
- if (seven > 0x5f && seven <= 0x7e) {
+ case '0': /* special graphics (line drawing) */
+ if (seven > 0x5f && seven <= 0x7e) {
#if OPT_WIDE_CHARS
- if (screen->utf8_mode)
- chr = dec2ucs((unsigned)(seven - 0x5f));
- else
+ if (screen->utf8_mode)
+ chr = dec2ucs((unsigned) (seven - 0x5f));
+ else
#endif
- chr = seven - 0x5f;
- } else {
- chr = seven;
- }
- break;
-
- case '4': /* Dutch */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_threequarters; break;
- case 0x5b: chr = XK_ydiaeresis; break;
- case 0x5c: chr = XK_onehalf; break;
- case 0x5d: chr = XK_bar; break;
- case 0x7b: chr = XK_diaeresis; break;
- case 0x7c: chr = XK_f; break;
- case 0x7d: chr = XK_onequarter; break;
- case 0x7e: chr = XK_acute; break;
- }
- break;
-
- case 'C':
- case '5': /* Finnish */
- switch (chr = seven) {
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_eacute; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case 'R': /* French */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_degree; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_section; break;
- case 0x7b: chr = XK_eacute; break;
- case 0x7c: chr = XK_ugrave; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_diaeresis; break;
- }
- break;
-
- case 'Q': /* French Canadian */
- switch (chr = seven) {
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_acircumflex; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_ecircumflex; break;
- case 0x5e: chr = XK_icircumflex; break;
- case 0x60: chr = XK_ocircumflex; break;
- case 0x7b: chr = XK_eacute; break;
- case 0x7c: chr = XK_ugrave; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_ucircumflex; break;
- }
- break;
-
- case 'K': /* German */
- switch (chr = seven) {
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Udiaeresis; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_udiaeresis; break;
- case 0x7e: chr = XK_ssharp; break;
- }
- break;
-
- case 'Y': /* Italian */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_degree; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_eacute; break;
- case 0x60: chr = XK_ugrave; break;
- case 0x7b: chr = XK_agrave; break;
- case 0x7c: chr = XK_ograve; break;
- case 0x7d: chr = XK_egrave; break;
- case 0x7e: chr = XK_igrave; break;
- }
- break;
-
- case 'E':
- case '6': /* Norwegian/Danish */
- switch (chr = seven) {
- case 0x40: chr = XK_Adiaeresis; break;
- case 0x5b: chr = XK_AE; break;
- case 0x5c: chr = XK_Ooblique; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_adiaeresis; break;
- case 0x7b: chr = XK_ae; break;
- case 0x7c: chr = XK_oslash; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case 'Z': /* Spanish */
- switch (chr = seven) {
- case 0x23: chr = XK_sterling; break;
- case 0x40: chr = XK_section; break;
- case 0x5b: chr = XK_exclamdown; break;
- case 0x5c: chr = XK_Ntilde; break;
- case 0x5d: chr = XK_questiondown; break;
- case 0x7b: chr = XK_degree; break;
- case 0x7c: chr = XK_ntilde; break;
- case 0x7d: chr = XK_ccedilla; break;
- }
- break;
-
- case 'H':
- case '7': /* Swedish */
- switch (chr = seven) {
- case 0x40: chr = XK_Eacute; break;
- case 0x5b: chr = XK_Adiaeresis; break;
- case 0x5c: chr = XK_Odiaeresis; break;
- case 0x5d: chr = XK_Aring; break;
- case 0x5e: chr = XK_Udiaeresis; break;
- case 0x60: chr = XK_eacute; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_aring; break;
- case 0x7e: chr = XK_udiaeresis; break;
- }
- break;
-
- case '=': /* Swiss */
- switch (chr = seven) {
- case 0x23: chr = XK_ugrave; break;
- case 0x40: chr = XK_agrave; break;
- case 0x5b: chr = XK_eacute; break;
- case 0x5c: chr = XK_ccedilla; break;
- case 0x5d: chr = XK_ecircumflex; break;
- case 0x5e: chr = XK_icircumflex; break;
- case 0x5f: chr = XK_egrave; break;
- case 0x60: chr = XK_ocircumflex; break;
- case 0x7b: chr = XK_adiaeresis; break;
- case 0x7c: chr = XK_odiaeresis; break;
- case 0x7d: chr = XK_udiaeresis; break;
- case 0x7e: chr = XK_ucircumflex; break;
- }
- break;
-
- default: /* any character sets we don't recognize*/
- count --;
- break;
- }
- /*
- * The state machine already treated DEL as a nonprinting and
- * nonspacing character. If we have DEL now, simply render
- * it as a blank.
- */
- if (chr == DEL)
- chr = ' ';
- *s = A2E(chr);
+ chr = seven - 0x5f;
+ } else {
+ chr = seven;
+ }
+ break;
+
+ case '4': /* Dutch */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_threequarters);
+ MAP(0x5b, XK_ydiaeresis);
+ MAP(0x5c, XK_onehalf);
+ MAP(0x5d, XK_bar);
+ MAP(0x7b, XK_diaeresis);
+ MAP(0x7c, XK_f);
+ MAP(0x7d, XK_onequarter);
+ MAP(0x7e, XK_acute);
+ }
+ break;
+
+ case 'C':
+ case '5': /* Finnish */
+ switch (chr = seven) {
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'R': /* French */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_section);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_diaeresis);
+ }
+ break;
+
+ case 'Q': /* French Canadian */
+ switch (chr = seven) {
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_acircumflex);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_eacute);
+ MAP(0x7c, XK_ugrave);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ case 'K': /* German */
+ switch (chr = seven) {
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Udiaeresis);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ssharp);
+ }
+ break;
+
+ case 'Y': /* Italian */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_degree);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_eacute);
+ MAP(0x60, XK_ugrave);
+ MAP(0x7b, XK_agrave);
+ MAP(0x7c, XK_ograve);
+ MAP(0x7d, XK_egrave);
+ MAP(0x7e, XK_igrave);
+ }
+ break;
+
+ case 'E':
+ case '6': /* Norwegian/Danish */
+ switch (chr = seven) {
+ MAP(0x40, XK_Adiaeresis);
+ MAP(0x5b, XK_AE);
+ MAP(0x5c, XK_Ooblique);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_adiaeresis);
+ MAP(0x7b, XK_ae);
+ MAP(0x7c, XK_oslash);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case 'Z': /* Spanish */
+ switch (chr = seven) {
+ MAP(0x23, XK_sterling);
+ MAP(0x40, XK_section);
+ MAP(0x5b, XK_exclamdown);
+ MAP(0x5c, XK_Ntilde);
+ MAP(0x5d, XK_questiondown);
+ MAP(0x7b, XK_degree);
+ MAP(0x7c, XK_ntilde);
+ MAP(0x7d, XK_ccedilla);
+ }
+ break;
+
+ case 'H':
+ case '7': /* Swedish */
+ switch (chr = seven) {
+ MAP(0x40, XK_Eacute);
+ MAP(0x5b, XK_Adiaeresis);
+ MAP(0x5c, XK_Odiaeresis);
+ MAP(0x5d, XK_Aring);
+ MAP(0x5e, XK_Udiaeresis);
+ MAP(0x60, XK_eacute);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_aring);
+ MAP(0x7e, XK_udiaeresis);
+ }
+ break;
+
+ case '=': /* Swiss */
+ switch (chr = seven) {
+ MAP(0x23, XK_ugrave);
+ MAP(0x40, XK_agrave);
+ MAP(0x5b, XK_eacute);
+ MAP(0x5c, XK_ccedilla);
+ MAP(0x5d, XK_ecircumflex);
+ MAP(0x5e, XK_icircumflex);
+ MAP(0x5f, XK_egrave);
+ MAP(0x60, XK_ocircumflex);
+ MAP(0x7b, XK_adiaeresis);
+ MAP(0x7c, XK_odiaeresis);
+ MAP(0x7d, XK_udiaeresis);
+ MAP(0x7e, XK_ucircumflex);
+ }
+ break;
+
+ default: /* any character sets we don't recognize */
+ count--;
+ break;
}
- return count;
+ /*
+ * The state machine already treated DEL as a nonprinting and
+ * nonspacing character. If we have DEL now, simply render
+ * it as a blank.
+ */
+ if (chr == ANSI_DEL)
+ chr = ' ';
+ *s = A2E(chr);
+ }
+ TRACE(("%d\t%s\n",
+ count,
+ visibleIChar(buf, (unsigned) (ptr - buf))));
+ return count;
+#undef MAP
}
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index f7bdb901d..620820b89 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.241 2008/02/24 21:46:37 tom Exp $
+dnl $XTermId: configure.in,v 1.245 2008/07/27 15:03:56 tom Exp $
dnl
dnl ---------------------------------------------------------------------------
dnl
@@ -46,7 +46,7 @@ esac
AC_PROG_CC
AC_PROG_CPP
-AC_GCC_TRADITIONAL
+AC_PROG_GCC_TRADITIONAL
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
@@ -59,7 +59,7 @@ AC_ISC_POSIX
### checks for compiler characteristics
CF_ANSI_CC_CHECK
-AC_CONST
+AC_C_CONST
CF_PROG_EXT
CF_XOPEN_SOURCE
CF_SIGWINCH
@@ -277,7 +277,7 @@ AC_CHECK_HEADERS( \
)
CF_X_ATHENA
-CF_TYPE_FD_SET
+CF_TYPE_FD_MASK
CF_TERMIO_C_ISPEED
LIBS="$LIBS $X_EXTRA_LIBS"
@@ -884,6 +884,11 @@ fi
dnl FIXME - extra test needed to make tcap-fkeys work on HPUX
AC_CHECK_FUNCS(tigetstr)
+dnl only check for ncurses' use_extended_names if really not using termcap
+if test -n "$cf_cv_lib_part_tgetent"; then
+ AC_CHECK_FUNCS(use_extended_names)
+fi
+
if test -n "$GCC" ; then
AC_MSG_CHECKING(if you want to turn on gcc warnings)
CF_ARG_ENABLE(warnings,
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index 1cdce692d..8520cefdc 100644
--- a/app/xterm/ctlseqs.ms
+++ b/app/xterm/ctlseqs.ms
@@ -1,12 +1,9 @@
.\"#! troff -ms $1 -*- Nroff -*-
.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.172 2006/08/02 21:46:34 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.190 2008/05/26 22:24:56 tom Exp $
.\"
.\"
-.\" $XFree86: xc/doc/specs/xterm/ctlseqs.ms,v 3.60 2006/03/13 01:27:53 dickey Exp $
-.\"
-.\"
-.\" Copyright 1996-2005,2006 by Thomas E. Dickey
+.\" Copyright 1996-2007,2008 by Thomas E. Dickey
.\"
.\" All Rights Reserved
.\"
@@ -75,7 +72,7 @@
.de St
.sp
.nr PD 0
-.nr PI 1.5i
+.nr PI 1.0i
.nr VS 16
..
.de Ed
@@ -291,6 +288,7 @@ X Consortium (1994)
Thomas Dickey
.AI
XFree86 Project (1996-2006)
+invisible-island.net (2006-2008)
.AU
.
.am BT \" add page numbers after first page
@@ -470,7 +468,7 @@ Designate G2 Character Set (ISO 2022)
.IP \\*(Es\\*+\\*(Cc
Designate G3 Character Set (ISO 2022)
.br
-Final character \*(Cc for designating character sets
+Final character \*(Cc for designating 94-character sets
(\*0, \*A and \*(cB apply to VT100 and up, the remainder to VT220 and up):
\*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
\*(Cc = \*A \(-> United Kingdom (UK)
@@ -485,6 +483,24 @@ Final character \*(Cc for designating character sets
\*(Cc = \*Z \(-> Spanish
\*(Cc = \*H or \*7 \(-> Swedish
\*(Cc = \*= \(-> Swiss
+.\" VT3xx and VT5xx (see vttest) add more selections, not implemented here.
+.
+.IP \\*(Es\\*-\\*(Cc
+Designate G1 Character Set (VT300)
+.
+.IP \\*(Es\\*.\\*(Cc
+Designate G2 Character Set (VT300)
+.
+.IP \\*(Es\\*/\\*(Cc
+Designate G3 Character Set (VT300)
+.br
+These work for 96-character sets only.
+ \*(Cc = \*A \(-> ISO Latin-1 Supplemental
+.\" VT5xx would implement these:
+.\" \*(Cc = \*F \(-> ISO Greek Supplemental
+.\" \*(Cc = \*H \(-> ISO Hebrew Supplemental
+.\" \*(Cc = \*M \(-> ISO Latin-5 Supplemental
+.\" \*(Cc = \*L \(-> ISO Latin-Cyrillic
.
.IP \\*(Es\\*7
Save Cursor (DECSC)
@@ -709,8 +725,8 @@ where \*(Pp denotes the terminal type
\(-> \*0 (``VT100'')
\(-> \*1 (``VT220'')
.br
-and \*(Pv is the firmware version (for \fIxterm\fP, this is the XFree86
-patch number, starting with 95).
+and \*(Pv is the firmware version (for \fIxterm\fP, this was originally
+the XFree86 patch number, starting with 95).
In a DEC terminal, \*(Pc indicates the ROM cartridge
registration number and is always zero.
.
@@ -769,14 +785,26 @@ See the section \fBMouse Tracking\fP.
\*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking.
\*(Ps = \*1\*0\*0\*2 \(-> Use Cell Motion Mouse Tracking.
\*(Ps = \*1\*0\*0\*3 \(-> Use All Motion Mouse Tracking.
+ \*(Ps = \*1\*0\*0\*4 \(-> Send FocusIn/FocusOut events.
\*(Ps = \*1\*0\*1\*0 \(-> Scroll to bottom on tty output (rxvt).
\*(Ps = \*1\*0\*1\*1 \(-> Scroll to bottom on key press (rxvt).
\*(Ps = \*1\*0\*3\*4 \(-> Interpret "meta" key, sets eighth bit.
(enables the \fBeightBitInput\fP resource).
- \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys.
+ \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys
+(enables the \fBnumLock\fP resource).
\*(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\*3\*9 \(-> Send ESC when Alt modifies a key
+(enables the \fBaltSendsEscape\fP resource).
+ \*(Ps = \*1\*0\*4\*0 \(-> Keep selection even if not highlighted
+(enables the \fBkeepSelection\fP resource).
+ \*(Ps = \*1\*0\*4\*1 \(-> Use the CLIPBOARD selection
+(enables the \fBselectToClipboard\fP resource).
+ \*(Ps = \*1\*0\*4\*2 \(-> Enable Urgency window manager hint when Control-G is received
+(enables the \fBbellIsUrgent\fP resource).
+ \*(Ps = \*1\*0\*4\*3 \(-> Enable raising of the window when Control-G is received
+(enables the \fBpopOnBell\fP resource).
\*(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
@@ -786,6 +814,7 @@ and use Alternate Screen Buffer, clearing it first (unless
disabled by the \fBtiteInhibit\fP resource).
This combines the effects of the \*1\*0\*4\*7 and \*1\*0\*4\*8 modes.
Use this with terminfo-based applications rather than the \*4\*7 mode.
+ \*(Ps = \*1\*0\*5\*0 \(-> Set terminfo/termcap function-key mode.
\*(Ps = \*1\*0\*5\*1 \(-> Set Sun function-key mode.
\*(Ps = \*1\*0\*5\*2 \(-> Set HP function-key mode.
\*(Ps = \*1\*0\*5\*3 \(-> Set SCO function-key mode.
@@ -824,7 +853,7 @@ DEC Private Mode Reset (DECRST)
\*(Ps = \*6 \(-> Normal Cursor Mode (DECOM)
\*(Ps = \*7 \(-> No Wraparound Mode (DECAWM)
\*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM)
- \*(Ps = \*9 \(-> Don't Send Mouse X & Y on button press
+ \*(Ps = \*9 \(-> Don't send Mouse X & Y on button press
\*(Ps = \*1\*0 \(-> Hide toolbar (rxvt)
\*(Ps = \*1\*2 \(-> Stop Blinking Cursor (att610)
\*(Ps = \*1\*8 \(-> Don't print form feed (DECPFF)
@@ -842,20 +871,32 @@ DEC Private Mode Reset (DECRST)
\*(Ps = \*4\*7 \(-> Use Normal Screen Buffer
\*(Ps = \*6\*6 \(-> Numeric keypad (DECNKM)
\*(Ps = \*6\*7 \(-> Backarrow key sends delete (DECBKM)
- \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse X & Y on button press and
+ \*(Ps = \*1\*0\*0\*0 \(-> Don't send Mouse X & Y on button press and
release.
See the section \fBMouse Tracking\fP.
- \*(Ps = \*1\*0\*0\*1 \(-> Don't Use Hilite Mouse Tracking
- \*(Ps = \*1\*0\*0\*2 \(-> Don't Use Cell Motion Mouse Tracking
- \*(Ps = \*1\*0\*0\*3 \(-> Don't Use All Motion Mouse Tracking
+ \*(Ps = \*1\*0\*0\*1 \(-> Don't use Hilite Mouse Tracking.
+ \*(Ps = \*1\*0\*0\*2 \(-> Don't use Cell Motion Mouse Tracking.
+ \*(Ps = \*1\*0\*0\*3 \(-> Don't use All Motion Mouse Tracking.
+ \*(Ps = \*1\*0\*0\*4 \(-> Don't send FocusIn/FocusOut events.
\*(Ps = \*1\*0\*1\*0 \(-> Don't scroll to bottom on tty output (rxvt).
\*(Ps = \*1\*0\*1\*1 \(-> Don't scroll to bottom on key press (rxvt).
\*(Ps = \*1\*0\*3\*4 \(-> Don't interpret "meta" key
(disables the \fBeightBitInput\fP resource).
- \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for Alt and NumLock keys.
+ \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for Alt and NumLock keys
+(disables the \fBnumLock\fP resource).
\*(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\*3\*9 \(-> Don't send ESC when Alt modifies a key
+(disables the \fBaltSendsEscape\fP resource).
+ \*(Ps = \*1\*0\*4\*0 \(-> Do not keep selection when not highlighted
+(disables the \fBkeepSelection\fP resource).
+ \*(Ps = \*1\*0\*4\*1 \(-> Use the PRIMARY selection.
+(disables the \fBselectToClipboard\fP resource).
+ \*(Ps = \*1\*0\*4\*2 \(-> Disable Urgency window manager hint when Control-G is received
+(disables the \fBbellIsUrgent\fP resource).
+ \*(Ps = \*1\*0\*4\*3 \(-> Disable raising of the window when Control-G is received
+(disables the \fBpopOnBell\fP resource).
\*(Ps = \*1\*0\*4\*7 \(-> Use Normal Screen Buffer, clearing screen
first if in the Alternate Screen (unless
disabled by the \fBtiteInhibit\fP resource)
@@ -866,6 +907,7 @@ as in DECRC (unless
disabled by the \fBtiteInhibit\fP resource).
This combines the effects of the \*1\*0\*4\*7 and \*1\*0\*4\*8 modes.
Use this with terminfo-based applications rather than the \*4\*7 mode.
+ \*(Ps = \*1\*0\*5\*0 \(-> Reset terminfo/termcap function-key mode.
\*(Ps = \*1\*0\*5\*1 \(-> Reset Sun function-key mode.
\*(Ps = \*1\*0\*5\*2 \(-> Reset HP function-key mode.
\*(Ps = \*1\*0\*5\*3 \(-> Reset SCO function-key mode.
@@ -955,10 +997,20 @@ Device Status Report (DSR)
.br
\*(Cs\*(Ir\*s\*;\*(Ic\*s\*R
.
-.IP \\*(Cs\\*>\\*n
-Set resource-value \fBmodifyFunctionKeys\fP used by \fIxterm\fP to
-allow user to construct extended-numbering function keys using
-shift- and control-modifiers.
+.IP \\*(Cs\\*>\\*(Ps\\*s\\*n
+Disable modifiers which may be enabled via the
+\*(Cs\*>\*(Ps\*;\*(Ps\*s\*m
+sequence.
+This corresponds to a resource value of "-1", which cannot be set with
+the other sequence.
+The parameter identifies the resource to be disabled:
+ \(-> \*1 modifyCursorKeys
+ \(-> \*2 modifyFunctionKeys
+ \(-> \*4 modifyOtherKeys
+If the parameter is omitted, \fBmodifyFunctionKeys\fP is disabled.
+When \fBmodifyFunctionKeys\fP is disabled, \fIxterm\fP uses the
+modifier keys to make an extended sequence of functions rather
+than adding a parameter to each function key to denote the modifiers.
.
.IP \\*(Cs\\*?\\*(Ps\\*s\\*n
Device Status Report (DSR, DEC-specific)
@@ -984,6 +1036,17 @@ The last two parameters apply to VT400 & up, and denote keyboard ready and LK01
.br
\*(Cs\*?\*5\*0\*s\*n No Locator, if not.
.
+.IP \\*(Cs\\*>\\*(Ps\\*s\\*p
+Set resource value \fIpointerMode\fP,
+used by \fIxterm\fP to decide whether to
+hide the pointer cursor as the user types.
+Valid values for the parameter:
+ \*(Ps = \*0 \(-> never hide the pointer
+ \*(Ps = \*1 \(-> hide if the mouse tracking mode is not enabled
+ \*(Ps = \*2 \(-> always hide the pointer
+If no parameter is given, \fIxterm\fP uses the default,
+which is \*1.
+.
.IP \\*(Cs\\*!\\*p
Soft terminal reset (DECSTR)
.
@@ -1291,6 +1354,65 @@ Privacy Message
.Ed
.
.SH
+Alt and Meta Keys
+.LP
+Many keyboards have keys labeled "Alt".
+Few have keys labeled "Meta".
+However, \fIxterm\fP's default translations use the \fIMeta\fP modifier.
+Common keyboard configurations assign the \fIMeta\fP modifier to an "Alt" key.
+By using \fIxmodmap\fP one may have the modifier assigned to a different key,
+and have "real" alt and meta keys.
+Here is an example:
+.DS B
+! put meta on mod3 to distinguish it from alt
+keycode 64 = Alt_L
+clear mod1
+add mod1 = Alt_L
+keycode 115 = Meta_L
+clear mod3
+add mod3 = Meta_L
+.DE
+.LP
+The \fBmetaSendsEscape\fP resource
+(and \fBaltSendsEscape\fP if \fBaltIsNotMeta\fP is set)
+can be used to control the way the \fIMeta\fP modifier applies to ordinary
+keys unless the \fBmodifyOtherKeys\fP resource is set:
+.IP
+-
+prefix a key with the \*(Es character.
+.IP
+-
+shift the key from codes 0-127 to 128-255 by adding 128.
+.LP
+The table shows the result for a given character "x" with modifiers
+according to the default translations with the resources set on or off.
+This assumes \fBaltIsNotMeta\fP is set:
+.TS
+center;
+lf3 lf3 lf3 lf3
+lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) .
+_
+key altSendsEscape metaSendsEscape result
+_
+x off off x
+Meta-x off off shift
+Alt-x off off shift
+Alt+Meta-x off off shift
+x ON off x
+Meta-x ON off shift
+Alt-x ON off \*(Es x
+Alt+Meta-x ON off \*(Es shift
+x off ON x
+Meta-x off ON \*(Es x
+Alt-x off ON shift
+Alt+Meta-x off ON \*(Es shift
+x ON ON x
+Meta-x ON ON \*(Es x
+Alt-x ON ON \*(Es x
+Alt+Meta-x ON ON \*(Es x
+_
+.TE
+.SH
PC-Style Function Keys
.ds RH Function Keys
.LP
@@ -1653,6 +1775,8 @@ are defined in \fBxcharmouse.h\fP as follows:
#define SET_VT200_HIGHLIGHT_MOUSE 1001
#define SET_BTN_EVENT_MOUSE 1002
#define SET_ANY_EVENT_MOUSE 1003
+
+#define SET_FOCUS_EVENT_MOUSE 1004
.DE
.LP
The motion reporting modes are strictly \fIxterm\fP extensions, and are not
@@ -1748,6 +1872,12 @@ down is reported as \*(Cs\*M\*(cB\*(Cx\*(Cy.
Any-event mode is the same as button-event mode, except that all motion
events are reported, even if no mouse button is down.
It is enabled by specifying 1003 to DECSET.
+
+FocusIn/FocusOut can be combined with any of the mouse events since
+it uses a different protocol.
+When set, it causes \fIxterm\fP to send
+\*(Cs\*I when the terminal gains focus, and
+\*(Cs\*O when it loses focus.
.
.br
.ds RH Tektronix 4014 Mode
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index c9bfa59f6..b4e763668 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -19,6 +19,7 @@
Thomas Dickey
XFree86 Project (1996-2006)
+ invisible-island.net (2006-2008)
@@ -94,702 +95,784 @@ character sets are specified by ISO 2022; see that document for a dis-
cussion of character sets.
Single-character functions
-BEL Bell (Ctrl-G)
-BS Backspace (Ctrl-H)
-CR Carriage Return (Ctrl-M)
-ENQ Return Terminal Status (Ctrl-E). Default response is an
- empty string, but may be overridden by a resource answer-
- backString.
-FF Form Feed or New Page (NP) (Ctrl-L) same as LF
-LF Line Feed or New Line (NL) (Ctrl-J)
-SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
- invokes the G1 character set.
-SP Space.
-TAB Horizontal Tab (HT) (Ctrl-I)
-VT Vertical Tab (Ctrl-K) same as LF
-SI Shift In (Ctrl-O) -> Switch to Standard Character Set:
- invokes the G0 character set (the default).
+BEL Bell (Ctrl-G)
+BS Backspace (Ctrl-H)
+CR Carriage Return (Ctrl-M)
+ENQ Return Terminal Status (Ctrl-E). Default response is an empty
+ string, but may be overridden by a resource answerbackString.
+FF Form Feed or New Page (NP) (Ctrl-L) same as LF
+LF Line Feed or New Line (NL) (Ctrl-J)
+SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
+ invokes the G1 character set.
+SP Space.
+TAB Horizontal Tab (HT) (Ctrl-I)
+VT Vertical Tab (Ctrl-K) same as LF
+SI Shift In (Ctrl-O) -> Switch to Standard Character Set: invokes
+ the G0 character set (the default).
Controls beginning with ESC (other than those where ESC is part of a
7-bit equivalent to 8-bit C1 controls), ordered by the final charac-
ter(s).
-ESC SP F 7-bit controls (S7C1T).
-ESC SP G 8-bit controls (S8C1T).
-ESC SP L Set ANSI conformance level 1 (dpANS X3.134.1).
-ESC SP M Set ANSI conformance level 2 (dpANS X3.134.1).
-ESC SP N Set ANSI conformance level 3 (dpANS X3.134.1).
-ESC # 3 DEC double-height line, top half (DECDHL)
-ESC # 4 DEC double-height line, bottom half (DECDHL)
-ESC # 5 DEC single-width line (DECSWL)
-ESC # 6 DEC double-width line (DECDWL)
-ESC # 8 DEC Screen Alignment Test (DECALN)
-ESC % @ Select default character set, ISO 8859-1 (ISO 2022)
-ESC % G Select UTF-8 character set (ISO 2022)
-ESC ( C Designate G0 Character Set (ISO 2022)
-ESC ) C Designate G1 Character Set (ISO 2022)
-ESC * C Designate G2 Character Set (ISO 2022)
-ESC + C Designate G3 Character Set (ISO 2022)
- Final character C for designating character sets (0 , A
- and B apply to VT100 and up, the remainder to VT220 and
- up):
- C = 0 -> DEC Special Character and Line Drawing Set
- C = A -> United Kingdom (UK)
- C = B -> United States (USASCII)
- C = 4 -> Dutch
- C = C or 5 -> Finnish
- C = R -> French
- C = Q -> French Canadian
- C = K -> German
- C = Y -> Italian
- C = E or 6 -> Norwegian/Danish
- C = Z -> Spanish
- C = H or 7 -> Swedish
- C = = -> Swiss
-ESC 7 Save Cursor (DECSC)
-ESC 8 Restore Cursor (DECRC)
-ESC = Application Keypad (DECPAM)
-ESC > Normal Keypad (DECPNM)
-ESC F Cursor to lower left corner of screen (if enabled by the
- hpLowerleftBugCompat resource).
-ESC c Full Reset (RIS)
-ESC l Memory Lock (per HP terminals). Locks memory above the
- cursor.
-ESC m Memory Unlock (per HP terminals)
-ESC n Invoke the G2 Character Set as GL (LS2).
-ESC o Invoke the G3 Character Set as GL (LS3).
-ESC | Invoke the G3 Character Set as GR (LS3R).
-ESC } Invoke the G2 Character Set as GR (LS2R).
-ESC ~ Invoke the G1 Character Set as GR (LS1R).
+ESC SP F 7-bit controls (S7C1T).
+ESC SP G 8-bit controls (S8C1T).
+ESC SP L Set ANSI conformance level 1 (dpANS X3.134.1).
+ESC SP M Set ANSI conformance level 2 (dpANS X3.134.1).
+ESC SP N Set ANSI conformance level 3 (dpANS X3.134.1).
+ESC # 3 DEC double-height line, top half (DECDHL)
+ESC # 4 DEC double-height line, bottom half (DECDHL)
+ESC # 5 DEC single-width line (DECSWL)
+ESC # 6 DEC double-width line (DECDWL)
+ESC # 8 DEC Screen Alignment Test (DECALN)
+ESC % @ Select default character set, ISO 8859-1 (ISO 2022)
+ESC % G Select UTF-8 character set (ISO 2022)
+ESC ( C Designate G0 Character Set (ISO 2022)
+ESC ) C Designate G1 Character Set (ISO 2022)
+ESC * C Designate G2 Character Set (ISO 2022)
+ESC + C Designate G3 Character Set (ISO 2022)
+ Final character C for designating 94-character sets (0 , A
+ and B apply to VT100 and up, the remainder to VT220 and up):
+ C = 0 -> DEC Special Character and Line Drawing Set
+ C = A -> United Kingdom (UK)
+ C = B -> United States (USASCII)
+ C = 4 -> Dutch
+ C = C or 5 -> Finnish
+ C = R -> French
+ C = Q -> French Canadian
+ C = K -> German
+ C = Y -> Italian
+ C = E or 6 -> Norwegian/Danish
+ C = Z -> Spanish
+ C = H or 7 -> Swedish
+ C = = -> Swiss
+ESC - C Designate G1 Character Set (VT300)
+ESC . C Designate G2 Character Set (VT300)
+ESC / C Designate G3 Character Set (VT300)
+ These work for 96-character sets only.
+ C = A -> ISO Latin-1 Supplemental
+ESC 7 Save Cursor (DECSC)
+ESC 8 Restore Cursor (DECRC)
+ESC = Application Keypad (DECPAM)
+ESC > Normal Keypad (DECPNM)
+ESC F Cursor to lower left corner of screen (if enabled by the
+ hpLowerleftBugCompat resource).
+ESC c Full Reset (RIS)
+ESC l Memory Lock (per HP terminals). Locks memory above the cur-
+ sor.
+ESC m Memory Unlock (per HP terminals)
+ESC n Invoke the G2 Character Set as GL (LS2).
+ESC o Invoke the G3 Character Set as GL (LS3).
+ESC | Invoke the G3 Character Set as GR (LS3R).
+ESC } Invoke the G2 Character Set as GR (LS2R).
+ESC ~ Invoke the G1 Character Set as GR (LS1R).
Application Program-Control functions
-APC Pt ST xterm implements no APC functions; Pt is ignored. Pt
- need not be printable characters.
+APC Pt ST xterm implements no APC functions; Pt is ignored. Pt need
+ not be printable characters.
Device-Control functions
DCS Ps; Ps| Pt ST
- User-Defined Keys (DECUDK). The first parameter:
- Ps = 0 -> Clear all UDK definitions before starting
- (default)
- Ps = 1 -> Erase Below (default)
- The second parameter:
- Ps = 0 -> Lock the keys (default)
- Ps = 1 -> Do not lock.
- The third parameter is a ';'-separated list of strings
- denoting the key-code separated by a '/' from the hex-
- encoded key value. The key codes correspond to the DEC
- function-key codes (e.g., F6=17).
-DCS $ q Pt ST Request Status String (DECRQSS). The string following
- the "q" is one of the following:
- " q -> DECSCA
- " p -> DECSCL
- r -> DECSTBM
- m -> SGR
- 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.
-DCS + q Pt ST Request Termcap/Terminfo String (xterm, experimental).
- The string following the "q" is a list of names encoded
- in hexadecimal (2 digits per character) separated by ;
- which correspond to termcap or terminfo key names.
- xterm responds with 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. The strings are encoded in hexadecimal
- (2 digits per character).
+ User-Defined Keys (DECUDK). The first parameter:
+ Ps = 0 -> Clear all UDK definitions before starting
+ (default)
+ Ps = 1 -> Erase Below (default)
+ The second parameter:
+ Ps = 0 -> Lock the keys (default)
+ Ps = 1 -> Do not lock.
+ The third parameter is a ';'-separated list of strings denot-
+ ing the key-code separated by a '/' from the hex-encoded key
+ value. The key codes correspond to the DEC function-key codes
+ (e.g., F6=17).
+DCS $ q Pt ST
+ Request Status String (DECRQSS). The string following the "q"
+ is one of the following:
+ " q -> DECSCA
+ " p -> DECSCL
+ r -> DECSTBM
+ m -> SGR
+ 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.
+DCS + q Pt ST
+ Request Termcap/Terminfo String (xterm, experimental). The
+ string following the "q" is a list of names encoded in hex-
+ adecimal (2 digits per character) separated by ; which corre-
+ spond to termcap or terminfo key names.
+ xterm responds with 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.
+ The strings are encoded in hexadecimal (2 digits per charac-
+ ter).
Functions using CSI , ordered by the final character(s)
-CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH)
-CSI Ps A Cursor Up Ps Times (default = 1) (CUU)
-CSI Ps B Cursor Down Ps Times (default = 1) (CUD)
-CSI Ps C Cursor Forward Ps Times (default = 1) (CUF)
-CSI Ps D Cursor Backward Ps Times (default = 1) (CUB)
-CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL)
-CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL)
-CSI Ps G Cursor Character Absolute [column] (default = [row,1])
- (CHA)
-CSI Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP)
-CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1)
- (CHT)
-CSI Ps J Erase in Display (ED)
- Ps = 0 -> Erase Below (default)
- Ps = 1 -> Erase Above
- Ps = 2 -> Erase All
- Ps = 3 -> Erase Saved Lines (xterm)
-CSI ? Ps J Erase in Display (DECSED)
- Ps = 0 -> Selective Erase Below (default)
- Ps = 1 -> Selective Erase Above
- Ps = 2 -> Selective Erase All
-CSI Ps K Erase in Line (EL)
- Ps = 0 -> Erase to Right (default)
- Ps = 1 -> Erase to Left
- Ps = 2 -> Erase All
-CSI ? Ps K Erase in Line (DECSEL)
- Ps = 0 -> Selective Erase to Right (default)
- Ps = 1 -> Selective Erase to Left
- Ps = 2 -> Selective Erase All
-CSI Ps L Insert Ps Line(s) (default = 1) (IL)
-CSI Ps M Delete Ps Line(s) (default = 1) (DL)
-CSI Ps P Delete Ps Character(s) (default = 1) (DCH)
-CSI Ps S Scroll up Ps lines (default = 1) (SU)
-CSI Ps T Scroll down Ps lines (default = 1) (SD)
+CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH)
+CSI Ps A Cursor Up Ps Times (default = 1) (CUU)
+CSI Ps B Cursor Down Ps Times (default = 1) (CUD)
+CSI Ps C Cursor Forward Ps Times (default = 1) (CUF)
+CSI Ps D Cursor Backward Ps Times (default = 1) (CUB)
+CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL)
+CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL)
+CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA)
+CSI Ps ; Ps H
+ Cursor Position [row;column] (default = [1,1]) (CUP)
+CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT)
+CSI Ps J Erase in Display (ED)
+ Ps = 0 -> Erase Below (default)
+ Ps = 1 -> Erase Above
+ Ps = 2 -> Erase All
+ Ps = 3 -> Erase Saved Lines (xterm)
+CSI ? Ps J
+ Erase in Display (DECSED)
+ Ps = 0 -> Selective Erase Below (default)
+ Ps = 1 -> Selective Erase Above
+ Ps = 2 -> Selective Erase All
+CSI Ps K Erase in Line (EL)
+ Ps = 0 -> Erase to Right (default)
+ Ps = 1 -> Erase to Left
+ Ps = 2 -> Erase All
+CSI ? Ps K
+ Erase in Line (DECSEL)
+ Ps = 0 -> Selective Erase to Right (default)
+ Ps = 1 -> Selective Erase to Left
+ Ps = 2 -> Selective Erase All
+CSI Ps L Insert Ps Line(s) (default = 1) (IL)
+CSI Ps M Delete Ps Line(s) (default = 1) (DL)
+CSI Ps P Delete Ps Character(s) (default = 1) (DCH)
+CSI Ps S Scroll up Ps lines (default = 1) (SU)
+CSI Ps T Scroll down Ps lines (default = 1) (SD)
CSI Ps ; Ps ; Ps ; Ps ; Ps T
- Initiate highlight mouse tracking. Parameters are
- [func;startx;starty;firstrow;lastrow]. See the section
- Mouse Tracking.
-CSI Ps X Erase Ps Character(s) (default = 1) (ECH)
-CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1)
- (CBT)
-CSI Pm ` Character Position Absolute [column] (default = [row,1])
- (HPA)
-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 set-
- ting.
- -> CSI ? 1 ; 2 c (``VT100 with Advanced Video
- Option'')
- -> CSI ? 1 ; 0 c (``VT101 with No Options'')
- -> CSI ? 6 c (``VT102'')
- -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')
- The VT100-style response parameters do not mean anything
- by themselves. VT220 parameters do, telling the host
- what features the terminal supports:
- -> 1 132-columns
- -> 2 Printer
- -> 6 Selective erase
- -> 8 User-defined keys
- -> 9 National replacement character sets
- -> 1 5 Technical characters
- -> 2 2 ANSI color, e.g., VT525
- -> 2 9 ANSI text locator (i.e., DEC Locator mode)
-CSI > Ps c Send Device Attributes (Secondary DA)
- Ps = 0 or omitted -> request the terminal's identifi-
- cation code. The response depends on the decTerminalID
- resource setting. It should apply only to VT220 and up,
- but xterm extends this to VT100.
- -> CSI > Pp ; Pv ; Pc c
- where Pp denotes the terminal type
- -> 0 (``VT100'')
- -> 1 (``VT220'')
- and Pv is the firmware version (for xterm, this is the
- XFree86 patch number, starting with 95). In a DEC termi-
- nal, Pc indicates the ROM cartridge registration number
- and is always zero.
-CSI Pm d Line Position Absolute [row] (default = [1,column])
- (VPA)
-CSI Ps ; Ps f Horizontal and Vertical Position [row;column] (default =
- [1,1]) (HVP)
-CSI Ps g Tab Clear (TBC)
- Ps = 0 -> Clear Current Column (default)
- Ps = 3 -> Clear All
-CSI Pm h Set Mode (SM)
- Ps = 2 -> Keyboard Action Mode (AM)
- Ps = 4 -> Insert Mode (IRM)
- Ps = 1 2 -> Send/receive (SRM)
- Ps = 2 0 -> Automatic Newline (LNM)
-CSI ? Pm h DEC Private Mode Set (DECSET)
- Ps = 1 -> Application Cursor Keys (DECCKM)
- Ps = 2 -> Designate USASCII for character sets G0-G3
- (DECANM), and set VT100 mode.
- Ps = 3 -> 132 Column Mode (DECCOLM)
- Ps = 4 -> Smooth (Slow) Scroll (DECSCLM)
- Ps = 5 -> Reverse Video (DECSCNM)
- Ps = 6 -> Origin Mode (DECOM)
- Ps = 7 -> Wraparound Mode (DECAWM)
- Ps = 8 -> Auto-repeat Keys (DECARM)
- Ps = 9 -> Send Mouse X & Y on button press. See the
- section Mouse Tracking.
- Ps = 1 0 -> Show toolbar (rxvt)
- Ps = 1 2 -> Start Blinking Cursor (att610)
- Ps = 1 8 -> Print form feed (DECPFF)
- Ps = 1 9 -> Set print extent to full screen (DECPEX)
- Ps = 2 5 -> Show Cursor (DECTCEM)
- Ps = 3 0 -> Show scrollbar (rxvt).
- Ps = 3 5 -> Enable font-shifting functions (rxvt).
- Ps = 3 8 -> Enter Tektronix Mode (DECTEK)
- Ps = 4 0 -> Allow 80 -> 132 Mode
- Ps = 4 1 -> more(1) fix (see curses resource)
- Ps = 4 2 -> Enable Nation Replacement Character sets
- (DECNRCM)
- Ps = 4 4 -> Turn On Margin Bell
- Ps = 4 5 -> Reverse-wraparound Mode
- Ps = 4 6 -> Start Logging (normally disabled by a com-
- pile-time option)
- Ps = 4 7 -> Use Alternate Screen Buffer (unless dis-
- abled by the titeInhibit resource)
- Ps = 6 6 -> Application keypad (DECNKM)
- Ps = 6 7 -> Backarrow key sends backspace (DECBKM)
- Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
- release. See the section Mouse Tracking.
- Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
- Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
- Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
- Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
- Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
- Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
- (enables the eightBitInput resource).
- 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 metaSendsEscape 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 titeInhibit resource)
- Ps = 1 0 4 8 -> Save cursor as in DECSC (unless dis-
- abled by the titeInhibit resource)
- Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alter-
- nate Screen Buffer, clearing it first (unless disabled by
- the titeInhibit resource). This combines the effects of
- the 1 0 4 7 and 1 0 4 8 modes. Use this with terminfo-
- based applications rather than the 4 7 mode.
- Ps = 1 0 5 1 -> Set Sun function-key mode.
- Ps = 1 0 5 2 -> Set HP function-key mode.
- Ps = 1 0 5 3 -> Set SCO function-key mode.
- Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
- Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
- Ps = 2 0 0 4 -> Set bracketed paste mode.
-CSI Pm i Media Copy (MC)
- Ps = 0 -> Print screen (default)
- Ps = 4 -> Turn off printer controller mode
- Ps = 5 -> Turn on printer controller mode
-CSI ? Pm i Media Copy (MC, DEC-specific)
- Ps = 1 -> Print line containing cursor
- Ps = 4 -> Turn off autoprint mode
- Ps = 5 -> Turn on autoprint mode
- Ps = 1 0 -> Print composed display, ignores DECPEX
- Ps = 1 1 -> Print all pages
-CSI Pm l Reset Mode (RM)
- Ps = 2 -> Keyboard Action Mode (AM)
- Ps = 4 -> Replace Mode (IRM)
- Ps = 1 2 -> Send/receive (SRM)
- Ps = 2 0 -> Normal Linefeed (LNM)
-CSI ? Pm l DEC Private Mode Reset (DECRST)
- Ps = 1 -> Normal Cursor Keys (DECCKM)
- Ps = 2 -> Designate VT52 mode (DECANM).
- Ps = 3 -> 80 Column Mode (DECCOLM)
- Ps = 4 -> Jump (Fast) Scroll (DECSCLM)
- Ps = 5 -> Normal Video (DECSCNM)
- Ps = 6 -> Normal Cursor Mode (DECOM)
- Ps = 7 -> No Wraparound Mode (DECAWM)
- Ps = 8 -> No Auto-repeat Keys (DECARM)
- Ps = 9 -> Don't Send Mouse X & Y on button press
- Ps = 1 0 -> Hide toolbar (rxvt)
- Ps = 1 2 -> Stop Blinking Cursor (att610)
- Ps = 1 8 -> Don't print form feed (DECPFF)
- Ps = 1 9 -> Limit print to scrolling region (DECPEX)
- Ps = 2 5 -> Hide Cursor (DECTCEM)
- Ps = 3 0 -> Don't show scrollbar (rxvt).
- Ps = 3 5 -> Disable font-shifting functions (rxvt).
- Ps = 4 0 -> Disallow 80 -> 132 Mode
- Ps = 4 1 -> No more(1) fix (see curses resource)
- Ps = 4 2 -> Disable Nation Replacement Character sets
- (DECNRCM)
- Ps = 4 4 -> Turn Off Margin Bell
- Ps = 4 5 -> No Reverse-wraparound Mode
- Ps = 4 6 -> Stop Logging (normally disabled by a com-
- pile-time option)
- Ps = 4 7 -> Use Normal Screen Buffer
- Ps = 6 6 -> Numeric keypad (DECNKM)
- Ps = 6 7 -> Backarrow key sends delete (DECBKM)
- Ps = 1 0 0 0 -> Don't Send Mouse X & Y on button press
- and release. See the section Mouse Tracking.
- Ps = 1 0 0 1 -> Don't Use Hilite Mouse Tracking
- Ps = 1 0 0 2 -> Don't Use Cell Motion Mouse Tracking
- Ps = 1 0 0 3 -> Don't Use All Motion Mouse Tracking
- Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
- (rxvt).
- Ps = 1 0 1 1 -> Don't scroll to bottom on key press
- (rxvt).
- Ps = 1 0 3 4 -> Don't interpret "meta" key (disables
- the eightBitInput resource).
- 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 metaSendsEscape 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 titeInhibit resource)
- Ps = 1 0 4 8 -> Restore cursor as in DECRC (unless
- disabled by the titeInhibit resource)
- Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore
- cursor as in DECRC (unless disabled by the titeInhibit
- resource). This combines the effects of the 1 0 4 7 and
- 1 0 4 8 modes. Use this with terminfo-based applica-
- tions rather than the 4 7 mode.
- Ps = 1 0 5 1 -> Reset Sun function-key mode.
- Ps = 1 0 5 2 -> Reset HP function-key mode.
- Ps = 1 0 5 3 -> Reset SCO function-key mode.
- Ps = 1 0 6 0 -> Reset legacy keyboard emulation
- (X11R6).
- Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC
- style.
- Ps = 2 0 0 4 -> Reset bracketed paste mode.
-CSI Pm m Character Attributes (SGR)
- Ps = 0 -> Normal (default)
- Ps = 1 -> Bold
- Ps = 4 -> Underlined
- Ps = 5 -> Blink (appears as Bold)
- Ps = 7 -> Inverse
- Ps = 8 -> Invisible, i.e., hidden (VT300)
- Ps = 2 2 -> Normal (neither bold nor faint)
- Ps = 2 4 -> Not underlined
- Ps = 2 5 -> Steady (not blinking)
- Ps = 2 7 -> Positive (not inverse)
- Ps = 2 8 -> Visible, i.e., not hidden (VT300)
- Ps = 3 0 -> Set foreground color to Black
- Ps = 3 1 -> Set foreground color to Red
- Ps = 3 2 -> Set foreground color to Green
- Ps = 3 3 -> Set foreground color to Yellow
- Ps = 3 4 -> Set foreground color to Blue
- Ps = 3 5 -> Set foreground color to Magenta
- Ps = 3 6 -> Set foreground color to Cyan
- Ps = 3 7 -> Set foreground color to White
- Ps = 3 9 -> Set foreground color to default (original)
- Ps = 4 0 -> Set background color to Black
- Ps = 4 1 -> Set background color to Red
- Ps = 4 2 -> Set background color to Green
- Ps = 4 3 -> Set background color to Yellow
- Ps = 4 4 -> Set background color to Blue
- Ps = 4 5 -> Set background color to Magenta
- Ps = 4 6 -> Set background color to Cyan
- Ps = 4 7 -> Set background color to White
- Ps = 4 9 -> Set background color to default (origi-
- nal).
-
- If 16-color support is compiled, the following apply.
- Assume that xterm's resources are set so that the ISO
- color codes are the first 8 of a set of 16. Then the
- aixterm colors are the bright versions of the ISO colors:
- Ps = 9 0 -> Set foreground color to Black
- Ps = 9 1 -> Set foreground color to Red
- Ps = 9 2 -> Set foreground color to Green
- 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 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
- Ps = 1 0 2 -> Set background color to Green
- Ps = 1 0 3 -> Set background color to Yellow
- Ps = 1 0 4 -> Set background color to Blue
- Ps = 1 0 5 -> Set background color to Magenta
- Ps = 1 0 6 -> Set background color to Cyan
- Ps = 1 0 7 -> Set background color to White
-
- If xterm is compiled with the 16-color support disabled,
- it supports the following, from rxvt:
- Ps = 1 0 0 -> Set foreground and background color to
- default
-
- If 88- or 256-color support is compiled, the following
- apply.
- Ps = 3 8 ; 5 ; Ps -> Set foreground color to the sec-
- ond Ps
- Ps = 4 8 ; 5 ; Ps -> Set background color to the sec-
- ond Ps
-
-CSI > Ps; Ps m Set or reset resource-values used by xterm to decide
- whether to construct escape sequences holding information
- about the modifiers pressed with a given key. The first
- parameter identifies the resource to set/reset. The sec-
- ond parameter is the value to assign to the resource. If
- the second parameter is omitted, the resource is reset to
- its initial value.
- -> 1 modifyCursorKeys
- -> 2 modifyFunctionKeys
- -> 4 modifyOtherKeys
- If no parameters are given, all resources are reset to
- their initial values.
-CSI Ps n Device Status Report (DSR)
- Ps = 5 -> Status Report CSI 0 n (``OK'')
- Ps = 6 -> Report Cursor Position (CPR) [row;column] as
- CSI r ; c R
-CSI > n Set resource-value modifyFunctionKeys used by xterm to
- allow user to construct extended-numbering function keys
- using shift- and control-modifiers.
-CSI ? Ps n Device Status Report (DSR, DEC-specific)
- Ps = 6 -> Report Cursor Position (CPR) [row;column] as
- CSI ? r ; c R (assumes page is zero).
- Ps = 1 5 -> Report Printer status as CSI ? 1 0 n
- (ready) or CSI ? 1 1 n (not ready)
- Ps = 2 5 -> Report UDK status as CSI ? 2 0 n
- (unlocked) or CSI ? 2 1 n (locked)
- Ps = 2 6 -> Report Keyboard status as
- CSI ? 2 7 ; 1 ; 0 ; 0 n (North American)
- The last two parameters apply to VT400 & up, and denote
- keyboard ready and LK01 respectively.
- Ps = 5 3 -> Report Locator status as
- CSI ? 5 3 n Locator available, if compiled-in, or
- CSI ? 5 0 n No Locator, if not.
-CSI ! p Soft terminal reset (DECSTR)
+ Initiate highlight mouse tracking. Parameters are
+ [func;startx;starty;firstrow;lastrow]. See the section Mouse
+ Tracking.
+CSI Ps X Erase Ps Character(s) (default = 1) (ECH)
+CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT)
+CSI Pm ` Character Position Absolute [column] (default = [row,1])
+ (HPA)
+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 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'')
+ The VT100-style response parameters do not mean anything by
+ themselves. VT220 parameters do, telling the host what fea-
+ tures the terminal supports:
+ -> 1 132-columns
+ -> 2 Printer
+ -> 6 Selective erase
+ -> 8 User-defined keys
+ -> 9 National replacement character sets
+ -> 1 5 Technical characters
+ -> 2 2 ANSI color, e.g., VT525
+ -> 2 9 ANSI text locator (i.e., DEC Locator mode)
+CSI > Ps c
+ Send Device Attributes (Secondary DA)
+ Ps = 0 or omitted -> request the terminal's identification
+ code. The response depends on the decTerminalID resource set-
+ ting. It should apply only to VT220 and up, but xterm extends
+ this to VT100.
+ -> CSI > Pp ; Pv ; Pc c
+ where Pp denotes the terminal type
+ -> 0 (``VT100'')
+ -> 1 (``VT220'')
+ 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
+ always zero.
+CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA)
+CSI Ps ; Ps f
+ Horizontal and Vertical Position [row;column] (default =
+ [1,1]) (HVP)
+CSI Ps g Tab Clear (TBC)
+ Ps = 0 -> Clear Current Column (default)
+ Ps = 3 -> Clear All
+CSI Pm h Set Mode (SM)
+ Ps = 2 -> Keyboard Action Mode (AM)
+ Ps = 4 -> Insert Mode (IRM)
+ Ps = 1 2 -> Send/receive (SRM)
+ Ps = 2 0 -> Automatic Newline (LNM)
+CSI ? Pm h
+ DEC Private Mode Set (DECSET)
+ Ps = 1 -> Application Cursor Keys (DECCKM)
+ Ps = 2 -> Designate USASCII for character sets G0-G3
+ (DECANM), and set VT100 mode.
+ Ps = 3 -> 132 Column Mode (DECCOLM)
+ Ps = 4 -> Smooth (Slow) Scroll (DECSCLM)
+ Ps = 5 -> Reverse Video (DECSCNM)
+ Ps = 6 -> Origin Mode (DECOM)
+ Ps = 7 -> Wraparound Mode (DECAWM)
+ Ps = 8 -> Auto-repeat Keys (DECARM)
+ Ps = 9 -> Send Mouse X & Y on button press. See the sec-
+ tion Mouse Tracking.
+ Ps = 1 0 -> Show toolbar (rxvt)
+ Ps = 1 2 -> Start Blinking Cursor (att610)
+ Ps = 1 8 -> Print form feed (DECPFF)
+ Ps = 1 9 -> Set print extent to full screen (DECPEX)
+ Ps = 2 5 -> Show Cursor (DECTCEM)
+ Ps = 3 0 -> Show scrollbar (rxvt).
+ Ps = 3 5 -> Enable font-shifting functions (rxvt).
+ Ps = 3 8 -> Enter Tektronix Mode (DECTEK)
+ Ps = 4 0 -> Allow 80 -> 132 Mode
+ Ps = 4 1 -> more(1) fix (see curses resource)
+ Ps = 4 2 -> Enable Nation Replacement Character sets (DECN-
+ RCM)
+ Ps = 4 4 -> Turn On Margin Bell
+ Ps = 4 5 -> Reverse-wraparound Mode
+ Ps = 4 6 -> Start Logging (normally disabled by a compile-
+ time option)
+ Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled by
+ the titeInhibit resource)
+ Ps = 6 6 -> Application keypad (DECNKM)
+ Ps = 6 7 -> Backarrow key sends backspace (DECBKM)
+ Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
+ release. See the section Mouse Tracking.
+ Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
+ Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
+ Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
+ Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
+ Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
+ Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
+ Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
+ (enables the eightBitInput resource).
+ Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
+ Lock keys (enables the numLock resource).
+ Ps = 1 0 3 6 -> Send ESC when Meta modifies a key (enables
+ the metaSendsEscape resource).
+ Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete key
+ Ps = 1 0 3 9 -> Send ESC when Alt modifies a key (enables
+ the altSendsEscape resource).
+ Ps = 1 0 4 0 -> Keep selection even if not highlighted
+ (enables the keepSelection resource).
+ Ps = 1 0 4 1 -> Use the CLIPBOARD selection (enables the
+ selectToClipboard resource).
+ Ps = 1 0 4 2 -> Enable Urgency window manager hint when
+ Control-G is received (enables the bellIsUrgent resource).
+ Ps = 1 0 4 3 -> Enable raising of the window when Control-G
+ is received (enables the popOnBell resource).
+ Ps = 1 0 4 7 -> Use Alternate Screen Buffer (unless dis-
+ abled by the titeInhibit resource)
+ Ps = 1 0 4 8 -> Save cursor as in DECSC (unless disabled by
+ the titeInhibit resource)
+ Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate
+ Screen Buffer, clearing it first (unless disabled by the
+ titeInhibit resource). This combines the effects of the 1 0 4
+ 7 and 1 0 4 8 modes. Use this with terminfo-based applica-
+ tions rather than the 4 7 mode.
+ Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode.
+ Ps = 1 0 5 1 -> Set Sun function-key mode.
+ Ps = 1 0 5 2 -> Set HP function-key mode.
+ Ps = 1 0 5 3 -> Set SCO function-key mode.
+ Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6).
+ Ps = 1 0 6 1 -> Set VT220 keyboard emulation.
+ Ps = 2 0 0 4 -> Set bracketed paste mode.
+CSI Pm i Media Copy (MC)
+ Ps = 0 -> Print screen (default)
+ Ps = 4 -> Turn off printer controller mode
+ Ps = 5 -> Turn on printer controller mode
+CSI ? Pm i
+ Media Copy (MC, DEC-specific)
+ Ps = 1 -> Print line containing cursor
+ Ps = 4 -> Turn off autoprint mode
+ Ps = 5 -> Turn on autoprint mode
+ Ps = 1 0 -> Print composed display, ignores DECPEX
+ Ps = 1 1 -> Print all pages
+CSI Pm l Reset Mode (RM)
+ Ps = 2 -> Keyboard Action Mode (AM)
+ Ps = 4 -> Replace Mode (IRM)
+ Ps = 1 2 -> Send/receive (SRM)
+ Ps = 2 0 -> Normal Linefeed (LNM)
+CSI ? Pm l
+ DEC Private Mode Reset (DECRST)
+ Ps = 1 -> Normal Cursor Keys (DECCKM)
+ Ps = 2 -> Designate VT52 mode (DECANM).
+ Ps = 3 -> 80 Column Mode (DECCOLM)
+ Ps = 4 -> Jump (Fast) Scroll (DECSCLM)
+ Ps = 5 -> Normal Video (DECSCNM)
+ Ps = 6 -> Normal Cursor Mode (DECOM)
+ Ps = 7 -> No Wraparound Mode (DECAWM)
+ Ps = 8 -> No Auto-repeat Keys (DECARM)
+ Ps = 9 -> Don't send Mouse X & Y on button press
+ Ps = 1 0 -> Hide toolbar (rxvt)
+ Ps = 1 2 -> Stop Blinking Cursor (att610)
+ Ps = 1 8 -> Don't print form feed (DECPFF)
+ Ps = 1 9 -> Limit print to scrolling region (DECPEX)
+ Ps = 2 5 -> Hide Cursor (DECTCEM)
+ Ps = 3 0 -> Don't show scrollbar (rxvt).
+ Ps = 3 5 -> Disable font-shifting functions (rxvt).
+ Ps = 4 0 -> Disallow 80 -> 132 Mode
+ Ps = 4 1 -> No more(1) fix (see curses resource)
+ Ps = 4 2 -> Disable Nation Replacement Character sets (DEC-
+ NRCM)
+ Ps = 4 4 -> Turn Off Margin Bell
+ Ps = 4 5 -> No Reverse-wraparound Mode
+ Ps = 4 6 -> Stop Logging (normally disabled by a compile-
+ time option)
+ Ps = 4 7 -> Use Normal Screen Buffer
+ Ps = 6 6 -> Numeric keypad (DECNKM)
+ Ps = 6 7 -> Backarrow key sends delete (DECBKM)
+ Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and
+ release. See the section Mouse Tracking.
+ Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.
+ Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.
+ Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.
+ Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.
+ Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
+ (rxvt).
+ Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).
+ Ps = 1 0 3 4 -> Don't interpret "meta" key (disables the
+ eightBitInput resource).
+ Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-
+ Lock keys (disables the numLock resource).
+ Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key
+ (disables the metaSendsEscape resource).
+ Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad
+ Delete key
+ Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key
+ (disables the altSendsEscape resource).
+ Ps = 1 0 4 0 -> Do not keep selection when not highlighted
+ (disables the keepSelection resource).
+ Ps = 1 0 4 1 -> Use the PRIMARY selection. (disables the
+ selectToClipboard resource).
+ Ps = 1 0 4 2 -> Disable Urgency window manager hint when
+ Control-G is received (disables the bellIsUrgent resource).
+ Ps = 1 0 4 3 -> Disable raising of the window when Control-
+ G is received (disables the popOnBell resource).
+ Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen
+ first if in the Alternate Screen (unless disabled by the
+ titeInhibit resource)
+ Ps = 1 0 4 8 -> Restore cursor as in DECRC (unless disabled
+ by the titeInhibit resource)
+ Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor
+ as in DECRC (unless disabled by the titeInhibit resource).
+ This combines the effects of the 1 0 4 7 and 1 0 4 8 modes.
+ Use this with terminfo-based applications rather than the 4 7
+ mode.
+ Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode.
+ Ps = 1 0 5 1 -> Reset Sun function-key mode.
+ Ps = 1 0 5 2 -> Reset HP function-key mode.
+ Ps = 1 0 5 3 -> Reset SCO function-key mode.
+ Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6).
+ Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style.
+ Ps = 2 0 0 4 -> Reset bracketed paste mode.
+CSI Pm m Character Attributes (SGR)
+ Ps = 0 -> Normal (default)
+ Ps = 1 -> Bold
+ Ps = 4 -> Underlined
+ Ps = 5 -> Blink (appears as Bold)
+ Ps = 7 -> Inverse
+ Ps = 8 -> Invisible, i.e., hidden (VT300)
+ Ps = 2 2 -> Normal (neither bold nor faint)
+ Ps = 2 4 -> Not underlined
+ Ps = 2 5 -> Steady (not blinking)
+ Ps = 2 7 -> Positive (not inverse)
+ Ps = 2 8 -> Visible, i.e., not hidden (VT300)
+ Ps = 3 0 -> Set foreground color to Black
+ Ps = 3 1 -> Set foreground color to Red
+ Ps = 3 2 -> Set foreground color to Green
+ Ps = 3 3 -> Set foreground color to Yellow
+ Ps = 3 4 -> Set foreground color to Blue
+ Ps = 3 5 -> Set foreground color to Magenta
+ Ps = 3 6 -> Set foreground color to Cyan
+ Ps = 3 7 -> Set foreground color to White
+ Ps = 3 9 -> Set foreground color to default (original)
+ Ps = 4 0 -> Set background color to Black
+ Ps = 4 1 -> Set background color to Red
+ Ps = 4 2 -> Set background color to Green
+ Ps = 4 3 -> Set background color to Yellow
+ Ps = 4 4 -> Set background color to Blue
+ Ps = 4 5 -> Set background color to Magenta
+ Ps = 4 6 -> Set background color to Cyan
+ Ps = 4 7 -> Set background color to White
+ Ps = 4 9 -> Set background color to default (original).
+
+ If 16-color support is compiled, the following apply. Assume
+ that xterm's resources are set so that the ISO color codes are
+ the first 8 of a set of 16. Then the aixterm colors are the
+ bright versions of the ISO colors:
+ Ps = 9 0 -> Set foreground color to Black
+ Ps = 9 1 -> Set foreground color to Red
+ Ps = 9 2 -> Set foreground color to Green
+ 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 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
+ Ps = 1 0 2 -> Set background color to Green
+ Ps = 1 0 3 -> Set background color to Yellow
+ Ps = 1 0 4 -> Set background color to Blue
+ Ps = 1 0 5 -> Set background color to Magenta
+ Ps = 1 0 6 -> Set background color to Cyan
+ Ps = 1 0 7 -> Set background color to White
+
+ If xterm is compiled with the 16-color support disabled, it
+ supports the following, from rxvt:
+ Ps = 1 0 0 -> Set foreground and background color to
+ default
+
+ If 88- or 256-color support is compiled, the following apply.
+ Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second Ps
+ Ps = 4 8 ; 5 ; Ps -> Set background color to the second Ps
+
+CSI > Ps; Ps m
+ Set or reset resource-values used by xterm to decide whether
+ to construct escape sequences holding information about the
+ modifiers pressed with a given key. The first parameter iden-
+ tifies the resource to set/reset. The second parameter is the
+ value to assign to the resource. If the second parameter is
+ omitted, the resource is reset to its initial value.
+ -> 1 modifyCursorKeys
+ -> 2 modifyFunctionKeys
+ -> 4 modifyOtherKeys
+ If no parameters are given, all resources are reset to their
+ initial values.
+CSI Ps n Device Status Report (DSR)
+ Ps = 5 -> Status Report CSI 0 n (``OK'')
+ Ps = 6 -> Report Cursor Position (CPR) [row;column] as
+ CSI r ; c R
+CSI > Ps n
+ Disable modifiers which may be enabled via the CSI > Ps; Ps m
+ sequence. This corresponds to a resource value of "-1", which
+ cannot be set with the other sequence. The parameter identi-
+ fies the resource to be disabled:
+ -> 1 modifyCursorKeys
+ -> 2 modifyFunctionKeys
+ -> 4 modifyOtherKeys If the parameter is omitted, modify-
+ FunctionKeys is disabled. When modifyFunctionKeys is dis-
+ abled, xterm uses the modifier keys to make an extended
+ sequence of functions rather than adding a parameter to each
+ function key to denote the modifiers.
+CSI ? Ps n
+ Device Status Report (DSR, DEC-specific)
+ Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI
+ ? r ; c R (assumes page is zero).
+ Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready)
+ or CSI ? 1 1 n (not ready)
+ Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)
+ or CSI ? 2 1 n (locked)
+ Ps = 2 6 -> Report Keyboard status as
+ CSI ? 2 7 ; 1 ; 0 ; 0 n (North American)
+ The last two parameters apply to VT400 & up, and denote key-
+ board ready and LK01 respectively.
+ Ps = 5 3 -> Report Locator status as
+ CSI ? 5 3 n Locator available, if compiled-in, or
+ CSI ? 5 0 n No Locator, if not.
+CSI > Ps p
+ Set resource value pointerMode, used by xterm to decide
+ whether to hide the pointer cursor as the user types. Valid
+ values for the parameter:
+ Ps = 0 -> never hide the pointer
+ Ps = 1 -> hide if the mouse tracking mode is not enabled
+ Ps = 2 -> always hide the pointer If no parameter is given,
+ xterm uses the default, which is 1 .
+CSI ! p Soft terminal reset (DECSTR)
CSI Ps ; Ps " p
- Set conformance level (DECSCL) Valid values for the first
- parameter:
- Ps = 6 1 -> VT100
- Ps = 6 2 -> VT200
- Ps = 6 3 -> VT300
- Valid values for the second parameter:
- Ps = 0 -> 8-bit controls
- Ps = 1 -> 7-bit controls (always set for VT100)
- Ps = 2 -> 8-bit controls
-CSI Ps " q Select character protection attribute (DECSCA). Valid
- values for the parameter:
- Ps = 0 -> DECSED and DECSEL can erase (default)
- Ps = 1 -> DECSED and DECSEL cannot erase
- Ps = 2 -> DECSED and DECSEL can erase
-CSI Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size of
- window) (DECSTBM)
-CSI ? Pm r Restore DEC Private Mode Values. The value of Ps previ-
- ously saved is restored. Ps values are the same as for
- DECSET.
+ Set conformance level (DECSCL) Valid values for the first
+ parameter:
+ Ps = 6 1 -> VT100
+ Ps = 6 2 -> VT200
+ Ps = 6 3 -> VT300
+ Valid values for the second parameter:
+ Ps = 0 -> 8-bit controls
+ Ps = 1 -> 7-bit controls (always set for VT100)
+ Ps = 2 -> 8-bit controls
+CSI Ps " q
+ Select character protection attribute (DECSCA). Valid values
+ for the parameter:
+ Ps = 0 -> DECSED and DECSEL can erase (default)
+ Ps = 1 -> DECSED and DECSEL cannot erase
+ Ps = 2 -> DECSED and DECSEL can erase
+CSI Ps ; Ps r
+ Set Scrolling Region [top;bottom] (default = full size of win-
+ dow) (DECSTBM)
+CSI ? Pm r
+ Restore DEC Private Mode Values. The value of Ps previously
+ saved is restored. Ps values are the same as for DECSET.
CSI Pt; Pl; Pb; Pr; Ps$ r
- Change Attributes in Rectangular Area (DECCARA).
- Pt; Pl; Pb; Pr denotes the rectangle.
- Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7
-CSI s Save cursor (ANSI.SYS)
-CSI ? Pm s Save DEC Private Mode Values. Ps values are the same as
- for DECSET.
+ Change Attributes in Rectangular Area (DECCARA).
+ Pt; Pl; Pb; Pr denotes the rectangle.
+ Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7
+CSI s Save cursor (ANSI.SYS)
+CSI ? Pm s
+ Save DEC Private Mode Values. Ps values are the same as for
+ DECSET.
CSI Ps ; Ps ; Ps t
- Window manipulation (from dtterm, as well as extensions).
- These controls may be disabled using the allowWindowOps
- resource. Valid values for the first (and any additional
- parameters) are:
- Ps = 1 -> De-iconify window.
- Ps = 2 -> Iconify window.
- Ps = 3 ; x ; y -> Move window to [x, y].
- Ps = 4 ; height ; width -> Resize the xterm window to
- height and width in pixels.
- Ps = 5 -> Raise the xterm window to the front of the
- stacking order.
- Ps = 6 -> Lower the xterm window to the bottom of the
- stacking order.
- Ps = 7 -> Refresh the xterm window.
- Ps = 8 ; height ; width -> Resize the text area to
- [height;width] in characters.
- Ps = 9 ; 0 -> Restore maximized window.
- Ps = 9 ; 1 -> Maximize window (i.e., resize to screen
- size).
- Ps = 1 1 -> Report xterm window state. If the xterm
- window is open (non-iconified), it returns CSI 1 t . If
- the xterm window is iconified, it returns CSI 2 t .
- Ps = 1 3 -> Report xterm window position as CSI 3 ; x;
- yt
- Ps = 1 4 -> Report xterm window in pixels as CSI 4 ;
- height ; width t
- Ps = 1 8 -> Report the size of the text area in char-
- acters as CSI 8 ; height ; width t
- Ps = 1 9 -> Report the size of the screen in charac-
- ters as CSI 9 ; height ; width t
- Ps = 2 0 -> Report xterm window's icon label as OSC L
- label ST
- Ps = 2 1 -> Report xterm window's title as OSC l
- title ST
- Ps >= 2 4 -> Resize to Ps lines (DECSLPP)
+ Window manipulation (from dtterm, as well as extensions).
+ These controls may be disabled using the allowWindowOps
+ resource. Valid values for the first (and any additional
+ parameters) are:
+ Ps = 1 -> De-iconify window.
+ Ps = 2 -> Iconify window.
+ Ps = 3 ; x ; y -> Move window to [x, y].
+ Ps = 4 ; height ; width -> Resize the xterm window to
+ height and width in pixels.
+ Ps = 5 -> Raise the xterm window to the front of the stack-
+ ing order.
+ Ps = 6 -> Lower the xterm window to the bottom of the
+ stacking order.
+ Ps = 7 -> Refresh the xterm window.
+ Ps = 8 ; height ; width -> Resize the text area to
+ [height;width] in characters.
+ Ps = 9 ; 0 -> Restore maximized window.
+ Ps = 9 ; 1 -> Maximize window (i.e., resize to screen
+ size).
+ Ps = 1 1 -> Report xterm window state. If the xterm window
+ is open (non-iconified), it returns CSI 1 t . If the xterm
+ window is iconified, it returns CSI 2 t .
+ Ps = 1 3 -> Report xterm window position as CSI 3 ; x; yt
+ Ps = 1 4 -> Report xterm window in pixels as CSI 4 ;
+ height ; width t
+ Ps = 1 8 -> Report the size of the text area in characters
+ as CSI 8 ; height ; width t
+ Ps = 1 9 -> Report the size of the screen in characters as
+ CSI 9 ; height ; width t
+ Ps = 2 0 -> Report xterm window's icon label as OSC L
+ label ST
+ Ps = 2 1 -> Report xterm window's title as OSC l title ST
+ Ps >= 2 4 -> Resize to Ps lines (DECSLPP)
CSI Pt; Pl; Pb; Pr; Ps$ t
- Reverse Attributes in Rectangular Area (DECRARA).
- Pt; Pl; Pb; Pr denotes the rectangle.
- Ps denotes the attributes to reverse. 1, 4, 5, 7
-CSI u Save cursor (ANSI.SYS)
+ Reverse Attributes in Rectangular Area (DECRARA).
+ Pt; Pl; Pb; Pr denotes the rectangle.
+ Ps denotes the attributes to reverse. 1, 4, 5, 7
+CSI u Save cursor (ANSI.SYS)
CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v
- Copy Rectangular Area (DECCRA)
- Pt; Pl; Pb; Pr denotes the rectangle.
- Pp denotes the source page.
- Pt; Pl denotes the target location.
- Pp denotes the target page.
+ Copy Rectangular Area (DECCRA)
+ Pt; Pl; Pb; Pr denotes the rectangle.
+ Pp denotes the source page.
+ Pt; Pl denotes the target location.
+ Pp denotes the target page.
CSI Pt ; Pl ; Pb ; Pr ' w
- Enable Filter Rectangle (DECEFR)
- Parameters are [top;left;bottom;right].
- Defines the coordinates of a filter rectangle and acti-
- vates it. Anytime the locator is detected outside of the
- filter rectangle, an outside rectangle event is generated
- and the rectangle is disabled. Filter rectangles are
- always treated as "one-shot" events. Any parameters that
- are omitted default to the current locator position. If
- all parameters are omitted, any locator motion will be
- reported. DECELR always cancels any prevous rectangle
- definition.
-CSI Ps x Request Terminal Parameters (DECREQTPARM)
- if Ps is a "0" (default) or "1", and xterm is emulating
- VT100, the control sequence elicits a response of the
- same form whose parameters describe the terminal:
- Ps -> the given Ps incremented by 2.
- 1 -> no parity
- 1 -> eight bits
- 1 2 8 -> transmit 38.4k baud
- 1 2 8 -> receive 38.4k baud
- 1 -> clock multiplier
- 0 -> STP flags
-CSI Ps x Select Attribute Change Extent (DECSACE).
- Ps = 0 -> from start to end position, wrapped
- Ps = 1 -> from start to end position, wrapped
- Ps = 2 -> rectangle (exact).
+ Enable Filter Rectangle (DECEFR)
+ Parameters are [top;left;bottom;right].
+ Defines the coordinates of a filter rectangle and activates
+ it. Anytime the locator is detected outside of the filter
+ rectangle, an outside rectangle event is generated and the
+ rectangle is disabled. Filter rectangles are always treated
+ as "one-shot" events. Any parameters that are omitted default
+ to the current locator position. If all parameters are omit-
+ ted, any locator motion will be reported. DECELR always can-
+ cels any prevous rectangle definition.
+CSI Ps x Request Terminal Parameters (DECREQTPARM)
+ if Ps is a "0" (default) or "1", and xterm is emulating VT100,
+ the control sequence elicits a response of the same form whose
+ parameters describe the terminal:
+ Ps -> the given Ps incremented by 2.
+ 1 -> no parity
+ 1 -> eight bits
+ 1 2 8 -> transmit 38.4k baud
+ 1 2 8 -> receive 38.4k baud
+ 1 -> clock multiplier
+ 0 -> STP flags
+CSI Ps x Select Attribute Change Extent (DECSACE).
+ Ps = 0 -> from start to end position, wrapped
+ Ps = 1 -> from start to end position, wrapped
+ Ps = 2 -> rectangle (exact).
CSI Pc; Pt; Pl; Pb; Pr$ x
- Fill Rectangular Area (DECFRA).
- Pc is the character to use.
- Pt; Pl; Pb; Pr denotes the rectangle.
+ Fill Rectangular Area (DECFRA).
+ Pc is the character to use.
+ Pt; Pl; Pb; Pr denotes the rectangle.
CSI Ps ; Pu ' z
- Enable Locator Reporting (DECELR)
- Valid values for the first parameter:
- Ps = 0 -> Locator disabled (default)
- Ps = 1 -> Locator enabled
- Ps = 2 -> Locator enabled for one report, then dis-
- abled
- The second parameter specifies the coordinate unit for
- locator reports.
- Valid values for the second parameter:
- Pu = 0 or omitted -> default to character cells
- Pu = 1 -> device physical pixels
- Pu = 2 -> character cells
+ Enable Locator Reporting (DECELR)
+ Valid values for the first parameter:
+ Ps = 0 -> Locator disabled (default)
+ Ps = 1 -> Locator enabled
+ Ps = 2 -> Locator enabled for one report, then disabled
+ The second parameter specifies the coordinate unit for locator
+ reports.
+ Valid values for the second parameter:
+ Pu = 0 or omitted -> default to character cells
+ Pu = 1 -> device physical pixels
+ Pu = 2 -> character cells
CSI Pt; Pl; Pb; Pr$ z
- Erase Rectangular Area (DECERA).
- Pt; Pl; Pb; Pr denotes the rectangle.
-CSI Pm ' { Select Locator Events (DECSLE)
- Valid values for the first (and any additional parame-
- ters) are:
- Ps = 0 -> only respond to explicit host requests
- (DECRQLP)
- (default) also cancels any filter rectangle
- Ps = 1 -> report button down transitions
- Ps = 2 -> do not report button down transitions
- Ps = 3 -> report button up transitions
- Ps = 4 -> do not report button up transitions
+ Erase Rectangular Area (DECERA).
+ Pt; Pl; Pb; Pr denotes the rectangle.
+CSI Pm ' {
+ Select Locator Events (DECSLE)
+ Valid values for the first (and any additional parameters)
+ are:
+ Ps = 0 -> only respond to explicit host requests (DECRQLP)
+ (default) also cancels any filter rectangle
+ Ps = 1 -> report button down transitions
+ Ps = 2 -> do not report button down transitions
+ Ps = 3 -> report button up transitions
+ Ps = 4 -> do not report button up transitions
CSI Pt; Pl; Pb; Pr$ {
- Selective Erase Rectangular Area (DECSERA).
- Pt; Pl; Pb; Pr denotes the rectangle.
-CSI Ps ' | Request Locator Position (DECRQLP)
- Valid values for the parameter are:
- Ps = 0 , 1 or omitted -> transmit a single DECLRP loca-
- tor report
-
- If Locator Reporting has been enabled by a DECELR, xterm
- will respond with a DECLRP Locator Report. This report
- is also generated on button up and down events if they
- have been enabled with a DECSLE, or when the locator is
- detected outside of a filter rectangle, if filter rectan-
- gles have been enabled with a DECEFR.
-
- -> CSI Pe ; Pb ; Pr ; Pc ; Pp & w
-
- Parameters are [event;button;row;column;page].
- Valid values for the event:
- Pe = 0 -> locator unavailable - no other parameters
- sent
- Pe = 1 -> request - xterm received a DECRQLP
- Pe = 2 -> left button down
- Pe = 3 -> left button up
- Pe = 4 -> middle button down
- Pe = 5 -> middle button up
- Pe = 6 -> right button down
- Pe = 7 -> right button up
- Pe = 8 -> M4 button down
- Pe = 9 -> M4 button up
- Pe = 1 0 -> locator outside filter rectangle
- ``button'' parameter is a bitmask indicating which but-
- tons 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
- ``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, and will be
- omitted.
+ Selective Erase Rectangular Area (DECSERA).
+ Pt; Pl; Pb; Pr denotes the rectangle.
+CSI Ps ' |
+ Request Locator Position (DECRQLP)
+ Valid values for the parameter are:
+ Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
+ report
+
+ If Locator Reporting has been enabled by a DECELR, xterm will
+ respond with a DECLRP Locator Report. This report is also
+ generated on button up and down events if they have been
+ enabled with a DECSLE, or when the locator is detected outside
+ of a filter rectangle, if filter rectangles have been enabled
+ with a DECEFR.
+
+ -> CSI Pe ; Pb ; Pr ; Pc ; Pp & w
+
+ Parameters are [event;button;row;column;page].
+ Valid values for the event:
+ Pe = 0 -> locator unavailable - no other parameters sent
+ Pe = 1 -> request - xterm received a DECRQLP
+ Pe = 2 -> left button down
+ Pe = 3 -> left button up
+ Pe = 4 -> middle button down
+ Pe = 5 -> middle button up
+ Pe = 6 -> right button down
+ Pe = 7 -> right button up
+ Pe = 8 -> M4 button down
+ Pe = 9 -> M4 button up
+ Pe = 1 0 -> locator outside filter rectangle
+ ``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
+ ``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, and will be omit-
+ ted.
Operating System Controls
OSC Ps ; Pt ST
OSC Ps ; Pt BEL
- Set Text Parameters. For colors and font, if Pt is a
- "?", the control sequence elicits a response which con-
- sists of the control sequence which would set the corre-
- sponding value. The dtterm control sequences allow you
- to determine the icon name and window title.
- Ps = 0 -> Change Icon Name and Window Title to Pt
- Ps = 1 -> Change Icon Name to Pt
- Ps = 2 -> Change Window Title to Pt
- Ps = 3 -> Set X property on top-level window. Pt
- should be in the form "prop=value", or just "prop" to
- delete the property
- Ps = 4 ; c ; spec -> Change Color Number c to the
- color specified by spec, i.e., a name or RGB specifica-
- tion as per XParseColor. Any number of c name pairs may
- be given. The color numbers correspond to the ANSI col-
- ors 0-7, their bright versions 8-15, and if supported,
- the remainder of the 88-color or 256-color table.
-
- If a "?" is given rather than a name or RGB specifica-
- tion, xterm replies with a control sequence of the same
- form which can be used to set the corresponding color.
- Because more than one pair of color number and specifica-
- tion can be given in one control sequence, xterm can make
- more than one reply.
-
- The 8 colors which may be set using 1 0 through 1 7 are
- denoted dynamic colors, since the corresponding control
- sequences were the first means for setting xterm's colors
- dynamically, i.e., after it was started. They are not
- the same as the ANSI colors. One or more parameters is
- expected for Pt. Each successive parameter changes the
- next color in the list. The value of Ps tells the start-
- ing point in the list. The colors are specified by name
- or RGB specification as per XParseColor.
-
- If a "?" is given rather than a name or RGB specifica-
- tion, xterm replies with a control sequence of the same
- form which can be used to set the corresponding dynamic
- color. Because more than one pair of color number and
- specification can be given in one control sequence, xterm
- can make more than one reply.
-
- Ps = 1 0 -> Change VT100 text foreground color to Pt
- Ps = 1 1 -> Change VT100 text background color to Pt
- Ps = 1 2 -> Change text cursor color to Pt
- Ps = 1 3 -> Change mouse foreground color to Pt
- Ps = 1 4 -> Change mouse background color to Pt
- Ps = 1 5 -> Change Tektronix foreground color to Pt
- Ps = 1 6 -> Change Tektronix background color to Pt
- Ps = 1 7 -> Change highlight color to Pt
- Ps = 1 8 -> Change Tektronix cursor color to Pt
-
- Ps = 4 6 -> Change Log File to Pt (normally disabled
- by a compile-time option)
-
- Ps = 5 0 -> Set Font to Pt If Pt begins with a "#",
- index in the font menu, relative (if the next character
- is a plus or minus sign) or absolute. A number is
- expected but not required after the sign (the default is
- the current entry for relative, zero for absolute index-
- ing).
-
- Ps = 5 1 (reserved for Emacs shell)
-
- Ps = 5 2 -> Manipulate Selection Data. These controls
- may be disabled using the allowWindowOps resource. The
- parameter Pt is parsed as
- Pc; Pd
- The first, Pc, may contain any character from the set c
- p s 0 1 2 3 4 5 6 7 . It is used to construct a
- list of selection parameters for clipboard, primary,
- select, or cut buffers 0 through 8 respectively, in the
- order given. If the parameter is empty, xterm uses s 0 ,
- to specify the configurable primary/clipboard selection
- and cut buffer 0.
- The second parameter, Pd, gives the selection data. Nor-
- mally this is a string encoded in base64. The data
- becomes the new selection, which is then available for
- pasting by other applications.
- If the second parameter is a ? , xterm replies to the
- host with the selection data encoded using the same pro-
- tocol.
+ Set Text Parameters. For colors and font, if Pt is a "?", the
+ control sequence elicits a response which consists of the con-
+ trol sequence which would set the corresponding value. The
+ dtterm control sequences allow you to determine the icon name
+ and window title.
+ Ps = 0 -> Change Icon Name and Window Title to Pt
+ Ps = 1 -> Change Icon Name to Pt
+ Ps = 2 -> Change Window Title to Pt
+ Ps = 3 -> Set X property on top-level window. Pt should be
+ in the form "prop=value", or just "prop" to delete the prop-
+ erty
+ Ps = 4 ; c ; spec -> Change Color Number c to the color
+ specified by spec, i.e., a name or RGB specification as per
+ XParseColor. Any number of c name pairs may be given. The
+ color numbers correspond to the ANSI colors 0-7, their bright
+ versions 8-15, and if supported, the remainder of the 88-color
+ or 256-color table.
+
+ If a "?" is given rather than a name or RGB specification,
+ xterm replies with a control sequence of the same form which
+ can be used to set the corresponding color. Because more than
+ one pair of color number and specification can be given in one
+ control sequence, xterm can make more than one reply.
+
+ The 8 colors which may be set using 1 0 through 1 7 are
+ denoted dynamic colors, since the corresponding control
+ sequences were the first means for setting xterm's colors
+ dynamically, i.e., after it was started. They are not the
+ same as the ANSI colors. One or more parameters is expected
+ for Pt. Each successive parameter changes the next color in
+ the list. The value of Ps tells the starting point in the
+ list. The colors are specified by name or RGB specification
+ as per XParseColor.
+
+ If a "?" is given rather than a name or RGB specification,
+ xterm replies with a control sequence of the same form which
+ can be used to set the corresponding dynamic color. Because
+ more than one pair of color number and specification can be
+ given in one control sequence, xterm can make more than one
+ reply.
+
+ Ps = 1 0 -> Change VT100 text foreground color to Pt
+ Ps = 1 1 -> Change VT100 text background color to Pt
+ Ps = 1 2 -> Change text cursor color to Pt
+ Ps = 1 3 -> Change mouse foreground color to Pt
+ Ps = 1 4 -> Change mouse background color to Pt
+ Ps = 1 5 -> Change Tektronix foreground color to Pt
+ Ps = 1 6 -> Change Tektronix background color to Pt
+ Ps = 1 7 -> Change highlight color to Pt
+ Ps = 1 8 -> Change Tektronix cursor color to Pt
+
+ Ps = 4 6 -> Change Log File to Pt (normally disabled by a
+ compile-time option)
+
+ Ps = 5 0 -> Set Font to Pt If Pt begins with a "#", index
+ in the font menu, relative (if the next character is a plus or
+ minus sign) or absolute. A number is expected but not
+ required after the sign (the default is the current entry for
+ relative, zero for absolute indexing).
+
+ Ps = 5 1 (reserved for Emacs shell)
+
+ Ps = 5 2 -> Manipulate Selection Data. These controls may
+ be disabled using the allowWindowOps resource. The parameter
+ Pt is parsed as
+ Pc; Pd
+ The first, Pc, may contain any character from the set c p s
+ 0 1 2 3 4 5 6 7 . It is used to construct a list of
+ selection parameters for clipboard, primary, select, or cut
+ buffers 0 through 8 respectively, in the order given. If the
+ parameter is empty, xterm uses s 0 , to specify the config-
+ urable primary/clipboard selection and cut buffer 0.
+ The second parameter, Pd, gives the selection data. Normally
+ this is a string encoded in base64. The data becomes the new
+ selection, which is then available for pasting by other appli-
+ cations.
+ If the second parameter is a ? , xterm replies to the host
+ with the selection data encoded using the same protocol.
Privacy Message
-PM Pt ST xterm implements no PM functions; Pt is ignored. Pt
- need not be printable characters.
+PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not
+ be printable characters.
+
+Alt and Meta Keys
+Many keyboards have keys labeled "Alt". Few have keys labeled "Meta".
+However, xterm's default translations use the Meta modifier. Common
+keyboard configurations assign the Meta modifier to an "Alt" key. By
+using xmodmap one may have the modifier assigned to a different key, and
+have "real" alt and meta keys. Here is an example:
+
+ ! put meta on mod3 to distinguish it from alt
+ keycode 64 = Alt_L
+ clear mod1
+ add mod1 = Alt_L
+ keycode 115 = Meta_L
+ clear mod3
+ add mod3 = Meta_L
+
+The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set)
+can be used to control the way the Meta modifier applies to ordinary
+keys unless the modifyOtherKeys resource is set:
+ - prefix a key with the ESC character.
+ - shift the key from codes 0-127 to 128-255 by adding 128.
+The table shows the result for a given character "x" with modifiers
+according to the default translations with the resources set on or off.
+This assumes altIsNotMeta is set:
+
+ -----------------------------------------------------------
+ key altSendsEscape metaSendsEscape result
+ -----------------------------------------------------------
+ x off off x
+ Meta-x off off shift
+ Alt-x off off shift
+ Alt+Meta-x off off shift
+ x ON off x
+ Meta-x ON off shift
+ Alt-x ON off ESC x
+ Alt+Meta-x ON off ESC shift
+ x off ON x
+ Meta-x off ON ESC x
+ Alt-x off ON shift
+ Alt+Meta-x off ON ESC shift
+ x ON ON x
+ Meta-x ON ON ESC x
+ Alt-x ON ON ESC x
+ Alt+Meta-x ON ON ESC x
+ -----------------------------------------------------------
+
PC-Style Function Keys
If xterm does minimal translation of the function keys, it usually does
@@ -1082,6 +1165,8 @@ as follows:
#define SET_BTN_EVENT_MOUSE 1002
#define SET_ANY_EVENT_MOUSE 1003
+ #define SET_FOCUS_EVENT_MOUSE 1004
+
The motion reporting modes are strictly xterm extensions, and are not
part of any standard, though they are analogous to the DEC VT200 DECELR
locator reports.
@@ -1156,6 +1241,10 @@ Any-event mode is the same as button-event mode, except that all motion
events are reported, even if no mouse button is down. It is enabled by
specifying 1003 to DECSET.
+FocusIn/FocusOut can be combined with any of the mouse events since it
+uses a different protocol. When set, it causes xterm to send CSI I
+when the terminal gains focus, and CSI O when it loses focus.
+
Tektronix 4014 Mode
Most of these sequences are standard Tektronix 4014 control sequences.
Graph mode supports the 12-bit addressing of the Tektronix 4014. The
@@ -1163,72 +1252,73 @@ major features missing are the write-through and defocused modes. This
document does not describe the commands used in the various Tektronix
plotting modes but does describe the commands to switch modes.
-BEL Bell (Ctrl-G)
-BS Backspace (Ctrl-H)
-TAB Horizontal Tab (Ctrl-I)
-LF Line Feed or New Line (Ctrl-J)
-VT Cursor up (Ctrl-K)
-FF Form Feed or New Page (Ctrl-L)
-CR Carriage Return (Ctrl-M)
-ESC ETX Switch to VT100 Mode (ESC Ctrl-C)
-ESC ENQ Return Terminal Status (ESC Ctrl-E)
-ESC FF PAGE (Clear Screen) (ESC Ctrl-L)
-ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N)
-ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O)
-ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-
- dd.hh:mm:ss) (ESC Ctrl-W)
-ESC CAN Bypass Condition (ESC Ctrl-X)
-ESC SUB GIN mode (ESC Ctrl-Z)
-ESC FS Special Point Plot Mode (ESC Ctrl-\)
-ESC 8 Select Large Character Set
-ESC 9 Select #2 Character Set
-ESC : Select #3 Character Set
-ESC ; Select Small Character Set
+BEL Bell (Ctrl-G)
+BS Backspace (Ctrl-H)
+TAB Horizontal Tab (Ctrl-I)
+LF Line Feed or New Line (Ctrl-J)
+VT Cursor up (Ctrl-K)
+FF Form Feed or New Page (Ctrl-L)
+CR Carriage Return (Ctrl-M)
+ESC ETX Switch to VT100 Mode (ESC Ctrl-C)
+ESC ENQ Return Terminal Status (ESC Ctrl-E)
+ESC FF PAGE (Clear Screen) (ESC Ctrl-L)
+ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N)
+ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O)
+ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss)
+ (ESC Ctrl-W)
+ESC CAN Bypass Condition (ESC Ctrl-X)
+ESC SUB GIN mode (ESC Ctrl-Z)
+ESC FS Special Point Plot Mode (ESC Ctrl-\)
+ESC 8 Select Large Character Set
+ESC 9 Select #2 Character Set
+ESC : Select #3 Character Set
+ESC ; Select Small Character Set
OSC Ps ; Pt BEL
- Set Text Parameters of VT window
- Ps = 0 -> Change Icon Name and Window Title to Pt
- Ps = 1 -> Change Icon Name to Pt
- Ps = 2 -> Change Window Title to Pt
- Ps = 4 6 -> Change Log File to Pt (normally disabled
- by a compile-time option)
-ESC ` Normal Z Axis and Normal (solid) Vectors
-ESC a Normal Z Axis and Dotted Line Vectors
-ESC b Normal Z Axis and Dot-Dashed Vectors
-ESC c Normal Z Axis and Short-Dashed Vectors
-ESC d Normal Z Axis and Long-Dashed Vectors
-ESC h Defocused Z Axis and Normal (solid) Vectors
-ESC i Defocused Z Axis and Dotted Line Vectors
-ESC j Defocused Z Axis and Dot-Dashed Vectors
-ESC k Defocused Z Axis and Short-Dashed Vectors
-ESC l Defocused Z Axis and Long-Dashed Vectors
-ESC p Write-Thru Mode and Normal (solid) Vectors
-ESC q Write-Thru Mode and Dotted Line Vectors
-ESC r Write-Thru Mode and Dot-Dashed Vectors
-ESC s Write-Thru Mode and Short-Dashed Vectors
-ESC t Write-Thru Mode and Long-Dashed Vectors
-FS Point Plot Mode (Ctrl-\)
-GS Graph Mode (Ctrl-])
-RS Incremental Plot Mode (Ctrl-^)
-US Alpha Mode (Ctrl-_)
+ Set Text Parameters of VT window
+ Ps = 0 -> Change Icon Name and Window Title to Pt
+ Ps = 1 -> Change Icon Name to Pt
+ Ps = 2 -> Change Window Title to Pt
+ Ps = 4 6 -> Change Log File to Pt (normally disabled by a
+ compile-time option)
+ESC ` Normal Z Axis and Normal (solid) Vectors
+ESC a Normal Z Axis and Dotted Line Vectors
+ESC b Normal Z Axis and Dot-Dashed Vectors
+ESC c Normal Z Axis and Short-Dashed Vectors
+ESC d Normal Z Axis and Long-Dashed Vectors
+ESC h Defocused Z Axis and Normal (solid) Vectors
+ESC i Defocused Z Axis and Dotted Line Vectors
+ESC j Defocused Z Axis and Dot-Dashed Vectors
+ESC k Defocused Z Axis and Short-Dashed Vectors
+ESC l Defocused Z Axis and Long-Dashed Vectors
+ESC p Write-Thru Mode and Normal (solid) Vectors
+ESC q Write-Thru Mode and Dotted Line Vectors
+ESC r Write-Thru Mode and Dot-Dashed Vectors
+ESC s Write-Thru Mode and Short-Dashed Vectors
+ESC t Write-Thru Mode and Long-Dashed Vectors
+FS Point Plot Mode (Ctrl-\)
+GS Graph Mode (Ctrl-])
+RS Incremental Plot Mode (Ctrl-^)
+US Alpha Mode (Ctrl-_)
VT52 Mode
Parameters for cursor movement are at the end of the ESC Y escape
sequence. Each ordinate is encoded in a single character as value+32.
For example, ! is 1. The screen coordinate system is 0-based.
-ESC A Cursor up.
-ESC B Cursor down.
-ESC C Cursor right.
-ESC D Cursor left.
-ESC F Enter graphics mode.
-ESC G Exit graphics mode.
-ESC H Move the cursor to the home position.
-ESC I Reverse line feed.
-ESC J Erase from the cursor to the end of the screen.
-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 = Enter alternate keypad mode.
-ESC > Exit alternate keypad mode.
-ESC < Exit VT52 mode (Enter VT100 mode).
+ESC A Cursor up.
+ESC B Cursor down.
+ESC C Cursor right.
+ESC D Cursor left.
+ESC F Enter graphics mode.
+ESC G Exit graphics mode.
+ESC H Move the cursor to the home position.
+ESC I Reverse line feed.
+ESC J Erase from the cursor to the end of the screen.
+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 = Enter alternate keypad mode.
+ESC > Exit alternate keypad mode.
+ESC < Exit VT52 mode (Enter VT100 mode).
diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c
index 6694fe3eb..3a7ddb875 100644
--- a/app/xterm/cursor.c
+++ b/app/xterm/cursor.c
@@ -1,9 +1,9 @@
-/* $XTermId: cursor.c,v 1.42 2006/07/23 20:23:52 tom Exp $ */
+/* $XTermId: cursor.c,v 1.45 2008/04/20 21:06:22 tom Exp $ */
/* $XFree86: xc/programs/xterm/cursor.c,v 3.20 2006/02/13 01:14:58 dickey Exp $ */
/*
- * Copyright 2002-2005,2006 by Thomas E. Dickey
+ * Copyright 2002-2007,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -114,8 +114,10 @@ CursorBack(XtermWidget xw, int n)
}
set_cur_row(screen, i / j);
set_cur_col(screen, i % j);
- } else
+ do_xevents();
+ } else {
set_cur_col(screen, 0);
+ }
}
screen->do_wrap = 0;
}
@@ -235,6 +237,27 @@ CarriageReturn(TScreen * screen)
{
set_cur_col(screen, 0);
screen->do_wrap = 0;
+ do_xevents();
+}
+
+/*
+ * When resizing the window, if we're showing the alternate screen, we still
+ * have to adjust the saved cursor from the normal screen to account for
+ * shifting of the saved-line region in/out of the viewable window.
+ */
+void
+AdjustSavedCursor(XtermWidget xw, int adjust)
+{
+ TScreen *screen = &xw->screen;
+
+ if (screen->alternate) {
+ SavedCursor *sc = &screen->sc[screen->alternate == False];
+
+ if (adjust > 0) {
+ TRACE(("AdjustSavedCursor %d -> %d\n", sc->row, sc->row - adjust));
+ sc->row += adjust;
+ }
+ }
}
/*
diff --git a/app/xterm/data.h b/app/xterm/data.h
index 3421dbb60..2a87e90f9 100644
--- a/app/xterm/data.h
+++ b/app/xterm/data.h
@@ -111,7 +111,6 @@ extern int ice_fd;
extern XtermWidget term;
-
extern SIG_ATOMIC_T need_cleanup;
#if defined(HAVE_XKB_BELL_EXT)
diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c
index d66933b8e..d7dec3a47 100644
--- a/app/xterm/fontutils.c
+++ b/app/xterm/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.270 2008/02/29 00:25:16 Andrea.Odetti Exp $ */
+/* $XTermId: fontutils.c,v 1.272 2008/04/17 23:23:37 tom Exp $ */
/************************************************************
@@ -1204,6 +1204,11 @@ xtermLoadVTFonts(XtermWidget w, char *myName, char *myClass)
w->misc.default_font = subresourceRec.default_font;
COPY_MENU_FONTS(subresourceRec, w->screen);
w->screen.MenuFontName(fontMenu_default) = w->misc.default_font.f_n;
+ w->screen.menu_font_names[0][fBold] = w->misc.default_font.f_b;
+#if OPT_WIDE_CHARS
+ w->screen.menu_font_names[0][fWide] = w->misc.default_font.f_w;
+ w->screen.menu_font_names[0][fWBold] = w->misc.default_font.f_wb;
+#endif
} else {
TRACE(("...no resources found\n"));
status = False;
@@ -1740,8 +1745,7 @@ xtermUpdateFontInfo(XtermWidget xw, Bool doresize)
}
TRACE(("xtermUpdateFontInfo {{\n"));
DoResizeScreen(xw); /* set to the new natural size */
- if (screen->scrollWidget)
- ResizeScrollBar(xw);
+ ResizeScrollBar(xw);
Redraw();
TRACE(("... }} xtermUpdateFontInfo\n"));
#ifdef SCROLLBAR_RIGHT
diff --git a/app/xterm/input.c b/app/xterm/input.c
index a9f687bda..c039ec378 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,9 +1,7 @@
-/* $XTermId: input.c,v 1.262 2006/08/03 00:08:35 tom Exp $ */
-
-/* $XFree86: xc/programs/xterm/input.c,v 3.76 2006/06/19 00:36:51 dickey Exp $ */
+/* $XTermId: input.c,v 1.299 2008/04/20 20:27:18 tom Exp $ */
/*
- * Copyright 1999-2005,2006 by Thomas E. Dickey
+ * Copyright 1999-2007,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -72,13 +70,19 @@
#include <X11/Sunkeysym.h>
#endif
+#if HAVE_X11_XF86KEYSYM_H
+#include <X11/XF86keysym.h>
+#endif
+
#include <X11/Xutil.h>
+#include <stdio.h>
#include <ctype.h>
#include <xutf8.h>
#include <data.h>
#include <fontutils.h>
+#include <xtermcap.h>
/*
* Xutil.h has no macro to check for the complete set of function- and
@@ -100,17 +104,18 @@
#define IsPrivateKeypadKey(k) (0)
#endif
-#define XK_Fn(n) (XK_F1 + (n) - 1)
-
#define IsBackarrowToggle(keyboard, keysym, state) \
((((keyboard->flags & MODE_DECBKM) == 0) \
^ ((state & ControlMask) != 0)) \
&& (keysym == XK_BackSpace))
#define MAP(from, to) case from: result = to; break
+#define Masked(value,mask) ((value) & (unsigned) (~(mask)))
#define KEYSYM_FMT "0x%04lX" /* simplify matching <X11/keysymdef.h> */
+#define TEK4014_GIN(tw) (tw != 0 && tw->screen.TekGIN)
+
typedef struct {
KeySym keysym;
Bool is_fkey;
@@ -169,10 +174,12 @@ ModifierName(unsigned modifier)
#endif
static void
-AdjustAfterInput(TScreen * screen)
+AdjustAfterInput(XtermWidget xw)
{
+ TScreen *screen = &(xw->screen);
+
if (screen->scrollkey && screen->topline != 0)
- WindowScroll(screen, 0);
+ WindowScroll(xw, 0);
if (screen->marginbell) {
int col = screen->max_col - screen->nmarginbell;
if (screen->bellarmed >= 0) {
@@ -220,7 +227,7 @@ IsEditFunctionKey(KeySym keysym)
}
#if OPT_MOD_FKEYS
-#define IS_CTRL(n) ((n) < 0x20 || ((n) >= 0x7f && (n) <= 0x9f))
+#define IS_CTRL(n) ((n) < ANSI_SPA || ((n) >= 0x7f && (n) <= 0x9f))
/*
* Return true if the keysym corresponds to one of the control characters,
@@ -301,19 +308,13 @@ allowModifierParm(XtermWidget xw, KEY_DATA * kd)
Bool result = False;
(void) screen;
- if (1
-#if OPT_SUNPC_KBD || OPT_VT52
- && !(((IsKeypadKey(kd->keysym) && keypad_mode)
- || kd->is_fkey)
- && (0
+ if (!(IsKeypadKey(kd->keysym) && keypad_mode)
#if OPT_SUNPC_KBD
- || (keyboard->type == keyboardIsVT220)
+ && keyboard->type != keyboardIsVT220
#endif
#if OPT_VT52_MODE
- || (screen->vtXX_level == 0)
+ && screen->vtXX_level != 0
#endif
- ))
-#endif /* OPT_SUNPC_KBD || OPT_VT52 */
) {
result = True;
}
@@ -339,16 +340,55 @@ allowModifierParm(XtermWidget xw, KEY_DATA * kd)
* Meta+Ctrl+Alt 15 = 1(None)+8(Meta)+2(Alt)+4(Ctrl)
* Meta+Ctrl+Alt+Shift 16 = 1(None)+8(Meta)+1(Shift)+2(Alt)+4(Ctrl)
*/
+
+#undef CTRL
+
+/* FIXME - make these used in xtermcap.c */
#define UNMOD 1
#define SHIFT 1
#define ALT 2
#define CTRL 4
#define META 8
-#define MODIFIER_NAME(parm, name) (((parm - UNMOD) & name) ? " "#name : "")
-static short
-computeModifierParm(XtermWidget xw, int state)
+
+#define MODIFIER_NAME(parm, name) \
+ (((parm > UNMOD) && ((parm - UNMOD) & name)) ? " "#name : "")
+
+int
+xtermParamToState(XtermWidget xw, unsigned param)
{
- short modify_parm = UNMOD;
+ int result = 0;
+#if OPT_NUM_LOCK
+ if (param > UNMOD
+ && ((ShiftMask
+ | ControlMask
+ | xw->misc.alt_mods
+ | xw->misc.meta_mods) & xw->misc.other_mods) == 0) {
+ if ((param - UNMOD) & SHIFT)
+ result |= ShiftMask;
+ if ((param - UNMOD) & CTRL)
+ result |= ControlMask;
+ if ((param - UNMOD) & ALT)
+ result |= xw->misc.alt_mods;
+ if ((param - UNMOD) & META)
+ result |= xw->misc.meta_mods;
+ }
+#else
+ (void) xw;
+ (void) param;
+#endif
+ TRACE(("xtermParamToState(%d) %s%s%s%s -> %#x\n", param,
+ MODIFIER_NAME(param, SHIFT),
+ MODIFIER_NAME(param, ALT),
+ MODIFIER_NAME(param, CTRL),
+ MODIFIER_NAME(param, META),
+ result));
+ return result;
+}
+
+int
+xtermStateToParam(XtermWidget xw, unsigned state)
+{
+ int modify_parm = UNMOD;
#if OPT_NUM_LOCK
if ((state & xw->misc.other_mods) == 0) {
@@ -373,7 +413,7 @@ computeModifierParm(XtermWidget xw, int state)
(void) xw;
(void) state;
#endif
- TRACE(("...computeModifierParm %d%s%s%s%s\n", modify_parm,
+ TRACE(("...xtermStateToParam %d%s%s%s%s\n", modify_parm,
MODIFIER_NAME(modify_parm, SHIFT),
MODIFIER_NAME(modify_parm, ALT),
MODIFIER_NAME(modify_parm, CTRL),
@@ -381,6 +421,45 @@ computeModifierParm(XtermWidget xw, int state)
return modify_parm;
}
+#define computeMaskedModifier(xw, state, mask) \
+ xtermStateToParam(xw, Masked(state, mask))
+
+#if OPT_NUM_LOCK
+static unsigned
+filterAltMeta(unsigned result, unsigned mask, Bool enable, KEY_DATA * kd)
+{
+ if ((result & mask) != 0) {
+ /*
+ * metaSendsEscape makes the meta key independent of
+ * modifyOtherKeys.
+ */
+ if (enable) {
+ result &= ~mask;
+ }
+ /*
+ * A bare meta-modifier is independent of modifyOtherKeys. If it
+ * is combined with other modifiers, make it depend.
+ */
+ if ((result & ~(mask)) == 0) {
+ result &= ~mask;
+ }
+ /*
+ * Check for special cases of control+meta which are used by some
+ * applications, e.g., emacs.
+ */
+ if ((IsControlInput(kd)
+ || IsControlOutput(kd))
+ && (result & ControlMask) != 0) {
+ result &= ~(mask | ControlMask);
+ }
+ if (kd->keysym == XK_Return || kd->keysym == XK_Tab) {
+ result &= ~(mask | ControlMask);
+ }
+ }
+ return result;
+}
+#endif /* OPT_NUM_LOCK */
+
/*
* Single characters (not function-keys) are allowed fewer modifiers when
* interpreting modifyOtherKeys due to pre-existing associations with some
@@ -407,7 +486,7 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd)
*/
if (xw->keyboard.modify_now.other_keys <= 1) {
if (IsControlInput(kd)
- && (result & ~ControlMask) == 0) {
+ && Masked(result, ControlMask) == 0) {
/* These keys are already associated with the control-key */
if (xw->keyboard.modify_now.other_keys == 0) {
result &= ~ControlMask;
@@ -416,7 +495,7 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd)
;
} else if (IsControlAlias(kd)) {
/* Things like "^_" work here... */
- if ((result & ~(ControlMask | ShiftMask)) == 0) {
+ if (Masked(result, (ControlMask | ShiftMask)) == 0) {
result = 0;
}
} else if (!IsControlOutput(kd) && !IsPredefinedKey(kd->keysym)) {
@@ -426,33 +505,13 @@ allowedCharModifiers(XtermWidget xw, unsigned state, KEY_DATA * kd)
}
}
#if OPT_NUM_LOCK
- if ((result & xw->misc.meta_mods) != 0) {
- /*
- * metaSendsEscape makes the meta key independent of
- * modifyOtherKeys.
- */
- if (xw->screen.meta_sends_esc) {
- result &= ~xw->misc.meta_mods;
- }
- /*
- * A bare meta-modifier is independent of modifyOtherKeys. If it
- * is combined with other modifiers, make it depend.
- */
- if ((result & ~(xw->misc.meta_mods)) == 0) {
- result &= ~xw->misc.meta_mods;
- }
- /*
- * Check for special cases of control+meta which are used by some
- * applications, e.g., emacs.
- */
- if ((IsControlInput(kd)
- || IsControlOutput(kd))
- && (result & ControlMask) != 0) {
- result &= ~(xw->misc.meta_mods | ControlMask);
- }
- if (kd->keysym == XK_Return || kd->keysym == XK_Tab) {
- result &= ~(xw->misc.meta_mods | ControlMask);
- }
+ result = filterAltMeta(result,
+ xw->misc.meta_mods,
+ xw->screen.meta_sends_esc, kd);
+ if (xw->screen.alt_is_not_meta) {
+ result = filterAltMeta(result,
+ xw->misc.alt_mods,
+ xw->screen.alt_sends_esc, kd);
}
#endif
}
@@ -512,7 +571,7 @@ ModifyOtherKeys(XtermWidget xw,
break;
#ifdef XK_ISO_Left_Tab
case XK_ISO_Left_Tab:
- if (computeModifierParm(xw, state & ~ShiftMask) > 1)
+ if (computeMaskedModifier(xw, state, ShiftMask) > 1)
result = True;
break;
#endif
@@ -530,8 +589,7 @@ ModifyOtherKeys(XtermWidget xw,
} else if (IsControlAlias(kd)) {
if (state == ShiftMask)
result = False;
- else if (computeModifierParm(xw,
- (state & ~ControlMask))
+ else if (computeMaskedModifier(xw, state, ControlMask)
> 1) {
result = True;
}
@@ -545,15 +603,15 @@ ModifyOtherKeys(XtermWidget xw,
switch (kd->keysym) {
case XK_BackSpace:
/* strip ControlMask as per IsBackarrowToggle() */
- if (computeModifierParm(xw, state & ~ControlMask) > 1)
+ if (computeMaskedModifier(xw, state, ControlMask) > 1)
result = True;
break;
case XK_Delete:
- result = (computeModifierParm(xw, state) > 1);
+ result = (xtermStateToParam(xw, state) > 1);
break;
#ifdef XK_ISO_Left_Tab
case XK_ISO_Left_Tab:
- if (computeModifierParm(xw, state & ~ShiftMask) > 1)
+ if (computeMaskedModifier(xw, state, ShiftMask) > 1)
result = True;
break;
#endif
@@ -566,7 +624,7 @@ ModifyOtherKeys(XtermWidget xw,
result = True;
} else if (state == ShiftMask) {
result = (kd->keysym == ' ' || kd->keysym == XK_Return);
- } else if (computeModifierParm(xw, state & ~ShiftMask) > 1) {
+ } else if (computeMaskedModifier(xw, state, ShiftMask) > 1) {
result = True;
}
break;
@@ -593,16 +651,22 @@ ModifyOtherKeys(XtermWidget xw,
* for more information.
*/
static Bool
-modifyOtherKey(ANSI * reply, int input_char, int modify_parm)
+modifyOtherKey(ANSI * reply, int input_char, int modify_parm, int format_keys)
{
Bool result = False;
if (input_char >= 0) {
- reply->a_type = CSI;
- APPEND_PARM(27);
- APPEND_PARM(modify_parm);
- APPEND_PARM(input_char);
- reply->a_final = '~';
+ reply->a_type = ANSI_CSI;
+ if (format_keys) {
+ APPEND_PARM(input_char);
+ APPEND_PARM(modify_parm);
+ reply->a_final = 'u';
+ } else {
+ APPEND_PARM(27);
+ APPEND_PARM(modify_parm);
+ APPEND_PARM(input_char);
+ reply->a_final = '~';
+ }
result = True;
}
@@ -610,11 +674,14 @@ modifyOtherKey(ANSI * reply, int input_char, int modify_parm)
}
static void
-modifyCursorKey(ANSI * reply, int modify, int modify_parm)
+modifyCursorKey(ANSI * reply, int modify, int *modify_parm)
{
- if (modify_parm > 1) {
- if (modify) {
- reply->a_type = CSI; /* SS3 should not have params */
+ if (*modify_parm > 1) {
+ if (modify < 0) {
+ *modify_parm = 0;
+ }
+ if (modify > 0) {
+ reply->a_type = ANSI_CSI; /* SS3 should not have params */
}
if (modify > 1 && reply->a_nparam == 0) {
APPEND_PARM(1); /* force modifier to 2nd param */
@@ -679,13 +746,13 @@ TranslateFromSUNPC(KeySym keysym)
#define VT52_KEYPAD \
if_OPT_VT52_MODE(screen,{ \
- reply.a_type = ESC; \
+ reply.a_type = ANSI_ESC; \
reply.a_pintro = '?'; \
})
#define VT52_CURSOR_KEYS \
if_OPT_VT52_MODE(screen,{ \
- reply.a_type = ESC; \
+ reply.a_type = ANSI_ESC; \
})
#undef APPEND_PARM
@@ -744,7 +811,7 @@ Input(XtermWidget xw,
int key = False;
ANSI reply;
int dec_code;
- short modify_parm = 0;
+ int modify_parm = 0;
int keypad_mode = ((keyboard->flags & MODE_DECKPAM) != 0);
unsigned evt_state = event->state;
unsigned mod_state;
@@ -816,7 +883,10 @@ Input(XtermWidget xw,
", %d:'%s'%s" FMT_MODIFIER_NAMES "%s%s%s%s%s%s\n",
kd.keysym,
kd.nbytes,
- visibleChars(PAIRED_CHARS((Char *) kd.strbuf, 0), kd.nbytes),
+ visibleChars(PAIRED_CHARS((Char *) kd.strbuf, 0),
+ ((kd.nbytes > 0)
+ ? (unsigned) kd.nbytes
+ : 0)),
ARG_MODIFIER_NAMES(evt_state),
eightbit ? " 8bit" : " 7bit",
IsKeypadKey(kd.keysym) ? " KeypadKey" : "",
@@ -879,7 +949,7 @@ Input(XtermWidget xw,
#if OPT_MOD_FKEYS
if (evt_state != 0
&& allowModifierParm(xw, &kd)) {
- modify_parm = computeModifierParm(xw, evt_state);
+ modify_parm = xtermStateToParam(xw, evt_state);
}
/*
@@ -899,7 +969,7 @@ Input(XtermWidget xw,
/* VT300 & up: backarrow toggle */
if ((kd.nbytes == 1)
&& IsBackarrowToggle(keyboard, kd.keysym, evt_state)) {
- kd.strbuf[0] = DEL;
+ kd.strbuf[0] = ANSI_DEL;
TRACE(("...Input backarrow changed to %d\n", kd.strbuf[0]));
}
#if OPT_SUNPC_KBD
@@ -984,7 +1054,7 @@ Input(XtermWidget xw,
* that we just used.
*/
if (modify_parm)
- modify_parm = computeModifierParm(xw, evt_state);
+ modify_parm = xtermStateToParam(xw, evt_state);
#endif /* OPT_MOD_FKEYS */
}
@@ -1001,6 +1071,12 @@ Input(XtermWidget xw,
case keyboardIsSun:
sunfuncvalue(&reply, &kd);
break;
+ case keyboardIsTermcap:
+#if OPT_TCAP_FKEYS
+ if (xtermcapString(xw, (int) kd.keysym, evt_state))
+ return;
+#endif
+ break;
case keyboardIsDefault:
case keyboardIsLegacy:
case keyboardIsVT220:
@@ -1018,7 +1094,7 @@ Input(XtermWidget xw,
|| IsEditFunctionKey(kd.keysym))
? keyboard->modify_now.function_keys
: keyboard->modify_now.cursor_keys),
- modify_parm);
+ &modify_parm);
MODIFIER_PARM;
unparseseq(xw, &reply);
} else if (((kd.is_fkey
@@ -1046,18 +1122,18 @@ Input(XtermWidget xw,
*/
else if (keyboard->type != keyboardIsLegacy
&& (dec_code >= 11 && dec_code <= 14)) {
- reply.a_type = SS3;
+ reply.a_type = ANSI_SS3;
VT52_CURSOR_KEYS;
reply.a_final = A2E(dec_code - 11 + E2A('P'));
modifyCursorKey(&reply,
keyboard->modify_now.function_keys,
- modify_parm);
+ &modify_parm);
MODIFIER_PARM;
unparseseq(xw, &reply);
}
#endif
else {
- reply.a_type = CSI;
+ reply.a_type = ANSI_CSI;
reply.a_final = 0;
#ifdef XK_ISO_Left_Tab
@@ -1066,8 +1142,8 @@ Input(XtermWidget xw,
reply.a_final = 'Z';
#if OPT_MOD_FKEYS
if (keyboard->modify_now.other_keys > 1
- && computeModifierParm(xw, evt_state & ~ShiftMask) > 1)
- modifyOtherKey(&reply, '\t', modify_parm);
+ && computeMaskedModifier(xw, evt_state, ShiftMask) > 1)
+ modifyOtherKey(&reply, '\t', modify_parm, keyboard->format_keys);
#endif
} else
#endif /* XK_ISO_Left_Tab */
@@ -1077,7 +1153,7 @@ Input(XtermWidget xw,
if (kd.is_fkey) {
modifyCursorKey(&reply,
keyboard->modify_now.function_keys,
- modify_parm);
+ &modify_parm);
}
MODIFIER_PARM;
#endif
@@ -1090,7 +1166,7 @@ Input(XtermWidget xw,
}
key = True;
} else if (IsPFKey(kd.keysym)) {
- reply.a_type = SS3;
+ reply.a_type = ANSI_SS3;
reply.a_final = kd.keysym - XK_KP_F1 + 'P';
VT52_CURSOR_KEYS;
MODIFIER_PARM;
@@ -1098,7 +1174,7 @@ Input(XtermWidget xw,
key = True;
} else if (IsKeypadKey(kd.keysym)) {
if (keypad_mode) {
- reply.a_type = SS3;
+ reply.a_type = ANSI_SS3;
reply.a_final = kypd_apl[kd.keysym - XK_KP_Space];
VT52_KEYPAD;
MODIFIER_PARM;
@@ -1109,11 +1185,11 @@ Input(XtermWidget xw,
key = True;
} else if (IsCursorKey(kd.keysym)) {
if (keyboard->flags & MODE_DECCKM) {
- reply.a_type = SS3;
+ reply.a_type = ANSI_SS3;
} else {
- reply.a_type = CSI;
+ reply.a_type = ANSI_CSI;
}
- modifyCursorKey(&reply, keyboard->modify_now.cursor_keys, modify_parm);
+ modifyCursorKey(&reply, keyboard->modify_now.cursor_keys, &modify_parm);
reply.a_final = curfinal[kd.keysym - XK_Home];
VT52_CURSOR_KEYS;
MODIFIER_PARM;
@@ -1123,9 +1199,9 @@ Input(XtermWidget xw,
int prefix = 0;
#if OPT_TEK4014
- if (screen->TekGIN) {
- TekEnqMouse(kd.strbuf[0]);
- TekGINoff();
+ if (TEK4014_GIN(tekWidget)) {
+ TekEnqMouse(tekWidget, kd.strbuf[0]);
+ TekGINoff(tekWidget);
kd.nbytes--;
for (j = 0; j < kd.nbytes; ++j) {
kd.strbuf[j] = kd.strbuf[j + 1];
@@ -1140,7 +1216,7 @@ Input(XtermWidget xw,
evt_state = mod_state;
- modify_parm = computeModifierParm(xw, evt_state);
+ modify_parm = xtermStateToParam(xw, evt_state);
/*
* We want to show a keycode that corresponds to the 8-bit value
@@ -1156,7 +1232,7 @@ Input(XtermWidget xw,
: -1));
TRACE(("...modifyOtherKeys %d;%d\n", modify_parm, input_char));
- if (modifyOtherKey(&reply, input_char, modify_parm)) {
+ if (modifyOtherKey(&reply, input_char, modify_parm, keyboard->format_keys)) {
unparseseq(xw, &reply);
} else {
Bell(XkbBI_MinorError, 0);
@@ -1170,19 +1246,28 @@ Input(XtermWidget xw,
* Like eightBitInput, except that it is not associated with
* terminal settings.
*/
- if (kd.nbytes != 0
- && screen->meta_sends_esc
- && (evt_state & xw->misc.meta_mods) != 0) {
- TRACE(("...input-char is modified by META\n"));
- /*
- * If we cannot distinguish between the Alt/Meta keys, disallow
- * the corresponding shift for eightBitInput that would happen
- * in the next chunk of code.
- */
- if ((evt_state & xw->misc.alt_mods & xw->misc.meta_mods) != 0)
+ if (kd.nbytes != 0) {
+ if (screen->meta_sends_esc
+ && (evt_state & xw->misc.meta_mods) != 0) {
+ TRACE(("...input-char is modified by META\n"));
+ evt_state &= ~xw->misc.meta_mods;
eightbit = False;
- prefix = ESC;
- evt_state &= ~xw->misc.meta_mods;
+ prefix = ANSI_ESC;
+ } else if (eightbit) {
+ /* it might be overridden, but this helps for debugging */
+ TRACE(("...input-char is shifted by META\n"));
+ }
+ if (screen->alt_is_not_meta
+ && (evt_state & xw->misc.alt_mods) != 0) {
+ evt_state &= ~xw->misc.alt_mods;
+ if (screen->alt_sends_esc) {
+ TRACE(("...input-char is modified by ALT\n"));
+ prefix = ANSI_ESC;
+ } else if (!eightbit) {
+ TRACE(("...input-char is shifted by ALT\n"));
+ eightbit = True;
+ }
+ }
}
#endif
/*
@@ -1238,10 +1323,10 @@ Input(XtermWidget xw,
CharOf(cmp)));
kd.strbuf[0] = cmp;
} else if (eightbit) {
- prefix = ESC;
+ prefix = ANSI_ESC;
} else if (kd.strbuf[0] == '?'
&& (evt_state & ControlMask) != 0) {
- kd.strbuf[0] = DEL;
+ kd.strbuf[0] = ANSI_DEL;
evt_state &= ~ControlMask;
}
}
@@ -1254,31 +1339,30 @@ Input(XtermWidget xw,
}
unparse_end(xw);
- if (key && !TEK4014_ACTIVE(screen))
- AdjustAfterInput(screen);
+ if (key && !TEK4014_ACTIVE(xw))
+ AdjustAfterInput(xw);
+ xtermShowPointer(xw, False);
return;
}
void
StringInput(XtermWidget xw, Char * string, size_t nbytes)
{
- TScreen *screen = &(xw->screen);
-
TRACE(("InputString (%s,%d)\n",
visibleChars(PAIRED_CHARS(string, 0), nbytes),
nbytes));
#if OPT_TEK4014
- if (nbytes && screen->TekGIN) {
- TekEnqMouse(*string++);
- TekGINoff();
+ if (nbytes && TEK4014_GIN(tekWidget)) {
+ TekEnqMouse(tekWidget, *string++);
+ TekGINoff(tekWidget);
nbytes--;
}
#endif
while (nbytes-- != 0)
unparseputc(xw, *string++);
- if (!TEK4014_ACTIVE(screen))
- AdjustAfterInput(screen);
+ if (!TEK4014_ACTIVE(xw))
+ AdjustAfterInput(xw);
unparse_end(xw);
}
@@ -1393,7 +1477,7 @@ hpfuncvalue(ANSI * reply, KEY_DATA * kd)
}
}
if (result > 0) {
- reply->a_type = ESC;
+ reply->a_type = ANSI_ESC;
reply->a_final = result;
}
#else
@@ -1483,7 +1567,7 @@ scofuncvalue(ANSI * reply, KEY_DATA * kd)
}
}
if (result > 0) {
- reply->a_type = CSI;
+ reply->a_type = ANSI_CSI;
reply->a_final = result;
}
#else
@@ -1495,7 +1579,7 @@ scofuncvalue(ANSI * reply, KEY_DATA * kd)
static void
sunfuncvalue(ANSI * reply, KEY_DATA * kd)
{
-#ifdef OPT_SUN_FUNC_KEYS
+#if OPT_SUN_FUNC_KEYS
int result;
if (kd->is_fkey) {
@@ -1575,12 +1659,12 @@ sunfuncvalue(ANSI * reply, KEY_DATA * kd)
}
}
if (result > 0) {
- reply->a_type = CSI;
+ reply->a_type = ANSI_CSI;
reply->a_nparam = 1;
reply->a_param[0] = result;
reply->a_final = 'z';
} else if (IsCursorKey(kd->keysym)) {
- reply->a_type = SS3;
+ reply->a_type = ANSI_SS3;
reply->a_final = curfinal[kd->keysym - XK_Home];
}
#else
@@ -1590,17 +1674,73 @@ sunfuncvalue(ANSI * reply, KEY_DATA * kd)
}
#if OPT_NUM_LOCK
+#define isName(c) ((c) == '_' || isalnum(CharOf(c)))
+
/*
- * Note that this can only retrieve translations that are given as resource
- * values; the default translations in charproc.c for example are not
- * retrievable by any interface to X.
+ * Strip unneeded whitespace from a translations resource, lowercasing and
+ * returning a malloc'd copy of the result.
+ */
+static char *
+stripTranslations(const char *s)
+{
+ char *dst = 0;
+
+ if (s != 0) {
+ dst = TypeMallocN(char, strlen(s) + 1);
+
+ if (dst != 0) {
+ int state = 0;
+ int ch = 0;
+ int prv = 0;
+ char *d = dst;
+
+ TRACE(("stripping:\n%s\n", s));
+ while (*s != '\0') {
+ ch = *s++;
+ if (ch == '\n') {
+ if (d != dst)
+ *d++ = ch;
+ state = 0;
+ } else if (strchr(":!#", ch) != 0) {
+ while (d != dst && isspace(CharOf(d[-1])))
+ --d;
+ state = -1;
+ } else if (state >= 0) {
+ if (isspace(CharOf(ch))) {
+ if (state == 0 || strchr("<>~ \t", prv))
+ continue;
+ } else if (strchr("<>~", ch)) {
+ while (d != dst && isspace(CharOf(d[-1])))
+ --d;
+ }
+ *d++ = char2lower(ch);
+ ++state;
+ }
+ prv = ch;
+ }
+ *d = '\0';
+ TRACE(("...result:\n%s\n", dst));
+ }
+ }
+ return dst;
+}
+
+/*
+ * Make a simple check to see if a given translations keyword appears in
+ * xterm's translations resource. It does not attempt to parse the strings,
+ * just makes a case-independent check and ensures that the ends of the match
+ * are on token-boundaries.
+ *
+ * That this can only retrieve translations that are given as resource values;
+ * the default translations in charproc.c for example are not retrievable by
+ * any interface to X.
*
* Also: We can retrieve only the most-specified translation resource. For
* example, if the resource file specifies both "*translations" and
* "XTerm*translations", we see only the latter.
*/
static Bool
-TranslationsUseKeyword(Widget w, const char *keyword)
+TranslationsUseKeyword(Widget w, char **cache, const char *keyword)
{
static String data;
static XtResource key_resources[] =
@@ -1609,49 +1749,96 @@ TranslationsUseKeyword(Widget w, const char *keyword)
sizeof(data), 0, XtRString, (XtPointer) NULL}
};
Bool result = False;
+ char *copy;
+ char *test;
+
+ if ((test = stripTranslations(keyword)) != 0) {
+ if (*cache == 0) {
+ XtGetSubresources(w,
+ (XtPointer) &data,
+ "vt100",
+ "VT100",
+ key_resources,
+ XtNumber(key_resources),
+ NULL,
+ (Cardinal) 0);
+ if (data != 0 && (copy = stripTranslations(data)) != 0) {
+ *cache = copy;
+ }
+ }
- XtGetSubresources(w,
- (XtPointer) &data,
- "vt100",
- "VT100",
- key_resources,
- XtNumber(key_resources),
- NULL,
- (Cardinal) 0);
-
- if (data != 0) {
- char *p = data;
- int state = 0;
- int now = ' ', prv;
- TRACE(("TranslationsUseKeyword(%p):%s\n", w, p));
- while (*p != 0) {
- prv = now;
- now = char2lower(*p++);
- if (now == ':'
- || now == '!') {
- state = -1;
- } else if (now == '\n') {
- state = 0;
- } else if (state >= 0) {
- if (isgraph(now)
- && now == keyword[state]) {
- if ((state != 0
- || !isalnum(prv))
- && ((keyword[++state] == 0)
- && !isalnum(CharOf(*p)))) {
- result = True;
- break;
- }
- } else {
+ if (*cache != 0) {
+ char *p = *cache;
+ int state = 0;
+ int now = ' ', prv;
+
+ while (*p != 0) {
+ prv = now;
+ now = *p++;
+ if (now == ':'
+ || now == '!') {
+ state = -1;
+ } else if (now == '\n') {
state = 0;
+ } else if (state >= 0) {
+ if (now == test[state]) {
+ if ((state != 0
+ || !isName(prv))
+ && ((test[++state] == 0)
+ && !isName(*p))) {
+ result = True;
+ break;
+ }
+ } else {
+ state = 0;
+ }
}
}
}
+ free(test);
}
TRACE(("TranslationsUseKeyword(%p, %s) = %d\n", w, keyword, result));
return result;
}
+static Bool
+xtermHasTranslation(XtermWidget xw, const char *keyword)
+{
+ return (TranslationsUseKeyword(SHELL_OF(xw),
+ &(xw->keyboard.shell_translations),
+ keyword)
+ || TranslationsUseKeyword((Widget) xw,
+ &(xw->keyboard.xterm_translations),
+ keyword));
+}
+
+#if OPT_EXTRA_PASTE
+static void
+addTranslation(XtermWidget xw, char *fromString, char *toString)
+{
+ unsigned have = (xw->keyboard.extra_translations
+ ? strlen(xw->keyboard.extra_translations)
+ : 0);
+ unsigned need = (((have != 0) ? (have + 4) : 0)
+ + strlen(fromString)
+ + strlen(toString)
+ + 6);
+
+ if (!xtermHasTranslation(xw, fromString)) {
+ xw->keyboard.extra_translations
+ = TypeRealloc(char, need, xw->keyboard.extra_translations);
+ if ((xw->keyboard.extra_translations) != 0) {
+ TRACE(("adding %s: %s\n", fromString, toString));
+ if (have)
+ strcat(xw->keyboard.extra_translations, " \\n\\");
+ sprintf(xw->keyboard.extra_translations, "%s: %s",
+ fromString, toString);
+ TRACE(("...{%s}\n", xw->keyboard.extra_translations));
+ }
+ }
+}
+#endif
+
#define SaveMask(name) xw->misc.name |= mask;\
TRACE(("SaveMask(%s) %#lx (%#lx is%s modifier)\n", \
#name, \
@@ -1668,9 +1855,10 @@ TranslationsUseKeyword(Widget w, const char *keyword)
void
VTInitModifiers(XtermWidget xw)
{
- int i, j, k;
Display *dpy = XtDisplay(xw);
XModifierKeymap *keymap = XGetModifierMapping(dpy);
+ int i, j, k, l;
+ KeySym keysym;
unsigned long mask;
int min_keycode, max_keycode, keysyms_per_keycode = 0;
@@ -1688,17 +1876,45 @@ VTInitModifiers(XtermWidget xw)
&keysyms_per_keycode);
if (theMap != 0) {
+
+#if OPT_EXTRA_PASTE
+ /*
+ * Assume that if we can find the paste keysym in the X keyboard
+ * mapping that the server allows the corresponding translations
+ * resource.
+ */
+ int limit = (max_keycode - min_keycode) * keysyms_per_keycode;
+ for (i = 0; i < limit; ++i) {
+#ifdef XF86XK_Paste
+ if (theMap[i] == XF86XK_Paste) {
+ TRACE(("keyboard has XF86XK_Paste\n"));
+ addTranslation(xw,
+ "<KeyPress> XF86Paste",
+ "insert-selection(SELECT, CUT_BUFFER0)");
+ }
+#endif
+#ifdef SunXK_Paste
+ if (theMap[i] == SunXK_Paste) {
+ TRACE(("keyboard has SunXK_Paste\n"));
+ addTranslation(xw,
+ "<KeyPress> SunPaste",
+ "insert-selection(SELECT, CUT_BUFFER0)");
+ }
+#endif
+ }
+#endif /* OPT_EXTRA_PASTE */
+
for (i = k = 0, mask = 1; i < 8; i++, mask <<= 1) {
for (j = 0; j < keymap->max_keypermod; j++) {
- KeyCode code = keymap->modifiermap[k];
- if (code != 0) {
- KeySym keysym;
- int l = 0;
- do {
- keysym = XKeycodeToKeysym(dpy, code, l);
- l++;
- } while (!keysym && l < keysyms_per_keycode);
- if (keysym == XK_Num_Lock) {
+ KeyCode code = keymap->modifiermap[k++];
+ if (code == 0)
+ continue;
+
+ for (l = 0; l < keysyms_per_keycode; ++l) {
+ keysym = XKeycodeToKeysym(dpy, code, l);
+ if (keysym == NoSymbol) {
+ ;
+ } else if (keysym == XK_Num_Lock) {
SaveMask(num_lock);
} else if (keysym == XK_Alt_L || keysym == XK_Alt_R) {
SaveMask(alt_mods);
@@ -1715,11 +1931,14 @@ VTInitModifiers(XtermWidget xw)
} else if (mask == LockMask
&& (keysym == XK_Caps_Lock)) {
; /* ignore */
- } else {
+ } else if (keysym == XK_Mode_switch
+#ifdef XK_ISO_Level3_Shift
+ || keysym == XK_ISO_Level3_Shift
+#endif
+ ) {
SaveMask(other_mods);
}
}
- k++;
}
}
XFree(theMap);
@@ -1732,8 +1951,7 @@ VTInitModifiers(XtermWidget xw)
* use it to modify function-keys when NumLock is active.
*/
if ((xw->misc.alt_mods != 0)
- && (TranslationsUseKeyword(toplevel, "alt")
- || TranslationsUseKeyword((Widget) xw, "alt"))) {
+ && xtermHasTranslation(xw, "alt")) {
TRACE(("ALT is used as a modifier in translations (ignore mask)\n"));
xw->misc.alt_mods = 0;
}
@@ -1743,8 +1961,7 @@ VTInitModifiers(XtermWidget xw)
* use it to modify function-keys.
*/
if ((xw->misc.meta_mods != 0)
- && (TranslationsUseKeyword(toplevel, "meta")
- || TranslationsUseKeyword((Widget) xw, "meta"))) {
+ && xtermHasTranslation(xw, "meta")) {
TRACE(("META is used as a modifier in translations\n"));
xw->misc.meta_mods = 0;
}
@@ -1754,210 +1971,3 @@ VTInitModifiers(XtermWidget xw)
}
}
#endif /* OPT_NUM_LOCK */
-
-#if OPT_TCAP_QUERY
-static int
-hex2int(int c)
-{
- if (c >= '0' && c <= '9')
- return c - '0';
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
- if (c >= 'A' && c <= 'F')
- return c - 'A' + 10;
- return -1;
-}
-
-/*
- * Parse the termcap/terminfo name from the string, returning a positive number
- * (the keysym) if found, otherwise -1. Update the string pointer.
- * Returns the (shift, control) state in *state.
- *
- * This does not attempt to construct control/shift modifiers to construct
- * function-key values. Instead, it sets the *fkey flag to pass to Input()
- * and bypass the lookup of keysym altogether.
- */
-int
-xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey)
-{
- /* *INDENT-OFF* */
-#define DATA(tc,ti,x,y) { tc, ti, x, y }
- static struct {
- char *tc;
- char *ti;
- int code;
- unsigned state;
- } table[] = {
- /* tcap terminfo keycode masks */
- DATA( "%1", "khlp", XK_Help, 0 ),
- DATA( "#1", "kHLP", XK_Help, ShiftMask ),
- DATA( "@0", "kfnd", XK_Find, 0 ),
- DATA( "*0", "kFND", XK_Find, ShiftMask ),
- DATA( "*6", "kslt", XK_Select, 0 ),
- DATA( "#6", "kSLT", XK_Select, ShiftMask ),
-
- DATA( "kh", "khome", XK_Home, 0 ),
- DATA( "#2", "kHOM", XK_Home, ShiftMask ),
- DATA( "@7", "kend", XK_End, 0 ),
- DATA( "*7", "kEND", XK_End, ShiftMask ),
-
- DATA( "kl", "kcub1", XK_Left, 0 ),
- DATA( "kr", "kcuf1", XK_Right, 0 ),
- DATA( "ku", "kcuu1", XK_Up, 0 ),
- DATA( "kd", "kcud1", XK_Down, 0 ),
-
- DATA( "#4", "kLFT", XK_Left, ShiftMask ),
- DATA( "%i", "kRIT", XK_Right, ShiftMask ),
- DATA( "%e", "kPRV", XK_Up, ShiftMask ),
- DATA( "%c", "kNXT", XK_Down, ShiftMask ),
-
- DATA( "k1", "kf1", XK_Fn(1), 0 ),
- DATA( "k2", "kf2", XK_Fn(2), 0 ),
- DATA( "k3", "kf3", XK_Fn(3), 0 ),
- DATA( "k4", "kf4", XK_Fn(4), 0 ),
- DATA( "k5", "kf5", XK_Fn(5), 0 ),
- DATA( "k6", "kf6", XK_Fn(6), 0 ),
- DATA( "k7", "kf7", XK_Fn(7), 0 ),
- DATA( "k8", "kf8", XK_Fn(8), 0 ),
- DATA( "k9", "kf9", XK_Fn(9), 0 ),
- DATA( "k;", "kf10", XK_Fn(10), 0 ),
-
- DATA( "F1", "kf11", XK_Fn(11), 0 ),
- DATA( "F2", "kf12", XK_Fn(12), 0 ),
- DATA( "F3", "kf13", XK_Fn(13), 0 ),
- DATA( "F4", "kf14", XK_Fn(14), 0 ),
- DATA( "F5", "kf15", XK_Fn(15), 0 ),
- DATA( "F6", "kf16", XK_Fn(16), 0 ),
- DATA( "F7", "kf17", XK_Fn(17), 0 ),
- DATA( "F8", "kf18", XK_Fn(18), 0 ),
- DATA( "F9", "kf19", XK_Fn(19), 0 ),
- DATA( "FA", "kf20", XK_Fn(20), 0 ),
- DATA( "FB", "kf21", XK_Fn(21), 0 ),
- DATA( "FC", "kf22", XK_Fn(22), 0 ),
- DATA( "FD", "kf23", XK_Fn(23), 0 ),
- DATA( "FE", "kf24", XK_Fn(24), 0 ),
- DATA( "FF", "kf25", XK_Fn(25), 0 ),
- DATA( "FG", "kf26", XK_Fn(26), 0 ),
- DATA( "FH", "kf27", XK_Fn(27), 0 ),
- DATA( "FI", "kf28", XK_Fn(28), 0 ),
- DATA( "FJ", "kf29", XK_Fn(29), 0 ),
- DATA( "FK", "kf30", XK_Fn(30), 0 ),
- DATA( "FL", "kf31", XK_Fn(31), 0 ),
- DATA( "FM", "kf32", XK_Fn(32), 0 ),
- DATA( "FN", "kf33", XK_Fn(33), 0 ),
- DATA( "FO", "kf34", XK_Fn(34), 0 ),
- DATA( "FP", "kf35", XK_Fn(35), 0 ),
-
- DATA( "FQ", "kf36", -36, 0 ),
- DATA( "FR", "kf37", -37, 0 ),
- DATA( "FS", "kf38", -38, 0 ),
- DATA( "FT", "kf39", -39, 0 ),
- DATA( "FU", "kf40", -40, 0 ),
- DATA( "FV", "kf41", -41, 0 ),
- DATA( "FW", "kf42", -42, 0 ),
- DATA( "FX", "kf43", -43, 0 ),
- DATA( "FY", "kf44", -44, 0 ),
- DATA( "FZ", "kf45", -45, 0 ),
- DATA( "Fa", "kf46", -46, 0 ),
- DATA( "Fb", "kf47", -47, 0 ),
- DATA( "Fc", "kf48", -48, 0 ),
- DATA( "Fd", "kf49", -49, 0 ),
- DATA( "Fe", "kf50", -50, 0 ),
- DATA( "Ff", "kf51", -51, 0 ),
- DATA( "Fg", "kf52", -52, 0 ),
- DATA( "Fh", "kf53", -53, 0 ),
- DATA( "Fi", "kf54", -54, 0 ),
- DATA( "Fj", "kf55", -55, 0 ),
- DATA( "Fk", "kf56", -56, 0 ),
- DATA( "Fl", "kf57", -57, 0 ),
- DATA( "Fm", "kf58", -58, 0 ),
- DATA( "Fn", "kf59", -59, 0 ),
- DATA( "Fo", "kf60", -60, 0 ),
- DATA( "Fp", "kf61", -61, 0 ),
- DATA( "Fq", "kf62", -62, 0 ),
- DATA( "Fr", "kf63", -63, 0 ),
-
- DATA( "K1", "ka1", XK_KP_Home, 0 ),
- DATA( "K4", "kc1", XK_KP_End, 0 ),
-
-#ifdef XK_ISO_Left_Tab
- DATA( "kB", "kcbt", XK_ISO_Left_Tab, 0 ),
-#endif
- DATA( "kC", "kclr", XK_Clear, 0 ),
- DATA( "kD", "kdch1", XK_Delete, 0 ),
- DATA( "kI", "kich1", XK_Insert, 0 ),
- DATA( "kN", "knp", XK_Next, 0 ),
- DATA( "kP", "kpp", XK_Prior, 0 ),
- DATA( "kb", "kbs", XK_BackSpace, 0 ),
-# if OPT_ISO_COLORS
- /* XK_COLORS is a fake code. */
- DATA( "Co", "colors", XK_COLORS, 0 ),
-# endif
- };
- /* *INDENT-ON* */
-
- Cardinal n;
- unsigned len = 0;
- int code = -1;
-#define MAX_TNAME_LEN 6
- char name[MAX_TNAME_LEN + 1];
- char *p;
-
- TRACE(("xtermcapKeycode(%s)\n", *params));
-
- /* Convert hex encoded name to ascii */
- for (p = *params; hex2int(p[0]) >= 0 && hex2int(p[1]) >= 0; p += 2) {
- if (len >= MAX_TNAME_LEN)
- break;
- name[len++] = (hex2int(p[0]) << 4) + hex2int(p[1]);
- }
- name[len] = 0;
- *params = p;
-
- *state = 0;
- *fkey = False;
-
- if (*p == 0 || *p == ';') {
- for (n = 0; n < XtNumber(table); n++) {
- if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) {
- code = table[n].code;
- *state = table[n].state;
- if (IsFunctionKey(code)) {
- *fkey = True;
- } else if (code < 0) {
- *fkey = True;
- code = XK_Fn((-code));
- }
-#ifdef OPT_SUN_FUNC_KEYS
- if (*fkey && xw->keyboard.type == keyboardIsSun) {
- int num = code - XK_Fn(0);
-
- /* match function-key case in sunfuncvalue() */
- if (num > 20) {
- if (num <= 30 || num > 47) {
- code = -1;
- } else {
- code -= 10;
- switch (num) {
- case 37: /* khome */
- case 39: /* kpp */
- case 41: /* kb2 */
- case 43: /* kend */
- case 45: /* knp */
- code = -1;
- break;
- }
- }
- }
- }
-#endif
- break;
- }
- }
- }
-
- TRACE(("... xtermcapKeycode(%s, %u, %d) -> %#06x\n",
- name, *state, *fkey, code));
- return code;
-}
-#endif
diff --git a/app/xterm/main.c b/app/xterm/main.c
index 80e08a74f..4f801b4d9 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.586 2008/02/28 00:28:00 Matthieu.Herrb Exp $ */
+/* $XTermId: main.c,v 1.587 2008/05/26 18:25:54 Marius.Tolzmann Exp $ */
/*
* W A R N I N G
@@ -2241,7 +2241,7 @@ main(int argc, char *argv[]ENVP_ARG)
c[1 + u] = "--";
command_to_exec_with_luit = c;
} else {
- static char *luit[4];
+ static char *luit[6];
luit[0] = term->misc.localefilter;
if (u) {
luit[1] = "-encoding";
@@ -4326,7 +4326,7 @@ spawnXTerm(XtermWidget xw)
* there, or refuses to run. In that case we will fall-through to
* to command that the user gave anyway.
*/
- if (command_to_exec_with_luit) {
+ if (command_to_exec_with_luit && command_to_exec) {
xtermSetenv("XTERM_SHELL",
xtermFindShell(*command_to_exec_with_luit, False));
TRACE(("spawning command \"%s\"\n", *command_to_exec_with_luit));
@@ -4367,6 +4367,22 @@ spawnXTerm(XtermWidget xw)
if (xw->misc.login_shell && pw && added_utmp_entry)
execl(bin_login, "login", "-p", "-f", login_name, (void *) 0);
#endif
+
+#if OPT_LUIT_PROG
+ if (command_to_exec_with_luit) {
+ if (xw->misc.login_shell) {
+ int u;
+ u = (term->misc.use_encoding ? 2 : 0);
+ command_to_exec_with_luit[u + 1] = "-argv0";
+ command_to_exec_with_luit[u + 2] = shname_minus;
+ command_to_exec_with_luit[u + 3] = NULL;
+ }
+ execvp(*command_to_exec_with_luit, command_to_exec_with_luit);
+ /* Exec failed. */
+ fprintf(stderr, "%s: Can't execvp %s: %s\n", ProgramName,
+ *command_to_exec_with_luit, strerror(errno));
+ }
+#endif
execlp(ptr,
(xw->misc.login_shell ? shname_minus : shname),
(void *) 0);
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index 2bb682769..257d8df5a 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,8 +1,8 @@
-/* $XTermId: menu.c,v 1.217 2006/07/23 20:13:22 tom Exp $ */
+/* $XTermId: menu.c,v 1.241 2008/06/03 20:05:49 tom Exp $ */
/*
-Copyright 1999-2005,2006 by Thomas E. Dickey
+Copyright 1999-2007,2008 by Thomas E. Dickey
All Rights Reserved
@@ -46,12 +46,14 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-/* $XFree86: xc/programs/xterm/menu.c,v 3.68 2006/04/10 00:34:36 dickey Exp $ */
#include <xterm.h>
#include <data.h>
#include <menu.h>
#include <fontutils.h>
+#include <xstrings.h>
+
+#include <locale.h>
#include <X11/Xmu/CharSet.h>
@@ -121,6 +123,7 @@ static void do_appkeypad PROTO_XT_CALLBACK_ARGS;
static void do_autolinefeed PROTO_XT_CALLBACK_ARGS;
static void do_autowrap PROTO_XT_CALLBACK_ARGS;
static void do_backarrow PROTO_XT_CALLBACK_ARGS;
+static void do_bellIsUrgent PROTO_XT_CALLBACK_ARGS;
static void do_clearsavedlines PROTO_XT_CALLBACK_ARGS;
static void do_continue PROTO_XT_CALLBACK_ARGS;
static void do_delete_del PROTO_XT_CALLBACK_ARGS;
@@ -128,8 +131,8 @@ static void do_hardreset PROTO_XT_CALLBACK_ARGS;
static void do_interrupt PROTO_XT_CALLBACK_ARGS;
static void do_jumpscroll PROTO_XT_CALLBACK_ARGS;
static void do_kill PROTO_XT_CALLBACK_ARGS;
-static void do_marginbell PROTO_XT_CALLBACK_ARGS;
static void do_old_fkeys PROTO_XT_CALLBACK_ARGS;
+static void do_poponbell PROTO_XT_CALLBACK_ARGS;
static void do_print PROTO_XT_CALLBACK_ARGS;
static void do_print_redir PROTO_XT_CALLBACK_ARGS;
static void do_quit PROTO_XT_CALLBACK_ARGS;
@@ -140,13 +143,13 @@ static void do_scrollbar PROTO_XT_CALLBACK_ARGS;
static void do_scrollkey PROTO_XT_CALLBACK_ARGS;
static void do_scrollttyoutput PROTO_XT_CALLBACK_ARGS;
static void do_securekbd PROTO_XT_CALLBACK_ARGS;
+static void do_keepSelection PROTO_XT_CALLBACK_ARGS;
static void do_selectClipboard PROTO_XT_CALLBACK_ARGS;
static void do_softreset PROTO_XT_CALLBACK_ARGS;
static void do_suspend PROTO_XT_CALLBACK_ARGS;
static void do_terminate PROTO_XT_CALLBACK_ARGS;
static void do_titeInhibit PROTO_XT_CALLBACK_ARGS;
static void do_visualbell PROTO_XT_CALLBACK_ARGS;
-static void do_poponbell PROTO_XT_CALLBACK_ARGS;
static void do_vtfont PROTO_XT_CALLBACK_ARGS;
#ifdef ALLOWLOGGING
@@ -199,6 +202,10 @@ static void do_sun_fkeys PROTO_XT_CALLBACK_ARGS;
static void do_sun_kbd PROTO_XT_CALLBACK_ARGS;
#endif
+#if OPT_TCAP_FKEYS
+static void do_tcap_fkeys PROTO_XT_CALLBACK_ARGS;
+#endif
+
#if OPT_TEK4014
static void do_tekcopy PROTO_XT_CALLBACK_ARGS;
static void do_tekhide PROTO_XT_CALLBACK_ARGS;
@@ -243,7 +250,7 @@ MenuEntry mainMenuEntries[] = {
{ "logging", do_logging, NULL },
#endif
{ "print", do_print, NULL },
- { "print-redirect", do_print_redir, NULL },
+ { "print-redir", do_print_redir, NULL },
{ "line2", NULL, NULL },
{ "8-bit control", do_8bit_control,NULL },
{ "backarrow key", do_backarrow, NULL },
@@ -254,6 +261,9 @@ MenuEntry mainMenuEntries[] = {
#endif
{ "delete-is-del", do_delete_del, NULL },
{ "oldFunctionKeys",do_old_fkeys, NULL },
+#if OPT_TCAP_FKEYS
+ { "tcapFunctionKeys",do_tcap_fkeys, NULL },
+#endif
#if OPT_HP_FUNC_KEYS
{ "hpFunctionKeys", do_hp_fkeys, NULL },
#endif
@@ -288,10 +298,11 @@ MenuEntry vtMenuEntries[] = {
{ "scrollkey", do_scrollkey, NULL },
{ "scrollttyoutput",do_scrollttyoutput, NULL },
{ "allow132", do_allow132, NULL },
+ { "keepSelection", do_keepSelection, NULL },
{ "selectToClipboard",do_selectClipboard, NULL },
{ "visualbell", do_visualbell, NULL },
+ { "bellIsUrgent", do_bellIsUrgent, NULL },
{ "poponbell", do_poponbell, NULL },
- { "marginbell", do_marginbell, NULL },
#if OPT_BLINK_CURS
{ "cursorblink", do_cursorblink, NULL },
#endif
@@ -401,6 +412,20 @@ static MenuList vt_shell[NUM_POPUP_MENUS];
static MenuList tek_shell[NUM_POPUP_MENUS];
#endif
+static String
+setMenuLocale(Bool before, String substitute)
+{
+ String result;
+
+ result = setlocale(LC_CTYPE, substitute);
+ if (before) {
+ result = x_strdup(result);
+ } else {
+ result = 0;
+ }
+ return result;
+}
+
/*
* Returns a pointer to the MenuList entry that matches the popup menu.
*/
@@ -450,12 +475,14 @@ create_menu(Widget w, XtermWidget xtw, MenuIndex num)
static Arg arg =
{XtNcallback, (XtArgVal) cb};
- Widget m;
TScreen *screen = &xtw->screen;
MenuHeader *data = &menu_names[num];
MenuList *list = select_menu(w, num);
struct _MenuEntry *entries = data->entry_list;
int nentries = data->entry_len;
+#if !OPT_TOOLBAR
+ String saveLocale;
+#endif
if (screen->menu_item_bitmap == None) {
/*
@@ -474,32 +501,33 @@ create_menu(Widget w, XtermWidget xtw, MenuIndex num)
RootWindowOfScreen(XtScreen(xtw)),
(char *) check_bits, check_width, check_height);
}
-#if OPT_TOOLBAR
- m = list->w;
- if (m == 0) {
- return m;
- }
-#else
- m = XtCreatePopupShell(data->internal_name,
- simpleMenuWidgetClass,
- toplevel,
- NULL, 0);
- list->w = m;
-#endif
- list->entries = nentries;
-
- for (; nentries > 0; nentries--, entries++) {
- cb[0].callback = (XtCallbackProc) entries->function;
- cb[0].closure = (caddr_t) entries->name;
- entries->widget = XtCreateManagedWidget(entries->name,
- (entries->function ?
- smeBSBObjectClass :
- smeLineObjectClass), m,
- &arg, (Cardinal) 1);
+#if !OPT_TOOLBAR
+ saveLocale = setMenuLocale(True, resource.menuLocale);
+ list->w = XtCreatePopupShell(data->internal_name,
+ simpleMenuWidgetClass,
+ toplevel,
+ NULL, 0);
+#endif
+ if (list->w != 0) {
+ list->entries = nentries;
+
+ for (; nentries > 0; nentries--, entries++) {
+ cb[0].callback = (XtCallbackProc) entries->function;
+ cb[0].closure = (caddr_t) entries->name;
+ entries->widget = XtCreateManagedWidget(entries->name,
+ (entries->function
+ ? smeBSBObjectClass
+ : smeLineObjectClass),
+ list->w,
+ &arg, (Cardinal) 1);
+ }
}
+#if !OPT_TOOLBAR
+ (void) setMenuLocale(False, saveLocale);
+#endif
/* do not realize at this point */
- return m;
+ return list->w;
}
static MenuIndex
@@ -527,18 +555,14 @@ indexOfMenu(String menuName)
return (me);
}
-/*
- * public interfaces
- */
-
/* ARGSUSED */
static Bool
-domenu(Widget w GCC_UNUSED,
+domenu(Widget w,
XEvent * event GCC_UNUSED,
String * params, /* mainMenu, vtMenu, or tekMenu */
Cardinal *param_count) /* 0 or 1 */
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
MenuIndex me;
Bool created = False;
Widget mw;
@@ -577,6 +601,12 @@ domenu(Widget w GCC_UNUSED,
update_meta_esc();
update_delete_del();
update_keyboard_type();
+#if OPT_NUM_LOCK
+ if (!screen->alt_is_not_meta) {
+ SetItemSensitivity(mainMenuEntries[mainMenu_alt_esc].widget,
+ False);
+ }
+#endif
if (!xtermHasPrinter()) {
SetItemSensitivity(mainMenuEntries[mainMenu_print].widget,
False);
@@ -625,15 +655,16 @@ domenu(Widget w GCC_UNUSED,
update_scrollttyoutput();
update_allow132();
update_cursesemul();
+ update_keepSelection();
update_selectToClipboard();
update_visualbell();
update_poponbell();
- update_marginbell();
+ update_bellIsUrgent();
update_cursorblink();
update_altscreen();
update_titeInhibit();
#ifndef NO_ACTIVE_ICON
- if (!screen->fnt_icon || !screen->iconVwin.window) {
+ if (!screen->fnt_icon.fs || !screen->iconVwin.window) {
SetItemSensitivity(
vtMenuEntries[vtMenu_activeicon].widget,
False);
@@ -656,7 +687,7 @@ domenu(Widget w GCC_UNUSED,
set_menu_font(True);
SetItemSensitivity(
fontMenuEntries[fontMenu_fontescape].widget,
- (screen->menu_font_names[fontMenu_fontescape]
+ (screen->menu_font_names[fontMenu_fontescape][fNorm]
? True : False));
#if OPT_BOX_CHARS
update_font_boxchars();
@@ -699,12 +730,13 @@ domenu(Widget w GCC_UNUSED,
#if OPT_TEK4014
case tekMenu:
- if (created) {
- set_tekfont_menu_item(screen->cur.fontsize, True);
+ if (created && tekWidget) {
+ set_tekfont_menu_item(tekWidget->screen.cur.fontsize, True);
update_vtshow();
}
break;
#endif
+ case noMenu:
default:
break;
}
@@ -712,6 +744,10 @@ domenu(Widget w GCC_UNUSED,
return True;
}
+/*
+ * public interfaces
+ */
+
void
HandleCreateMenu(Widget w,
XEvent * event,
@@ -747,7 +783,7 @@ static void
handle_send_signal(Widget gw GCC_UNUSED, int sig)
{
#ifndef VMS
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (hold_screen > 1)
hold_screen = 0;
@@ -765,7 +801,7 @@ do_securekbd(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
Time now = CurrentTime; /* XXX - wrong */
if (screen->grabbedKbd) {
@@ -773,7 +809,7 @@ do_securekbd(Widget gw GCC_UNUSED,
ReverseVideo(term);
screen->grabbedKbd = False;
} else {
- if (XGrabKeyboard(screen->display, XtWindow(CURRENT_EMU(screen)),
+ if (XGrabKeyboard(screen->display, XtWindow(CURRENT_EMU()),
True, GrabModeAsync, GrabModeAsync, now)
!= GrabSuccess) {
Bell(XkbBI_MinorError, 100);
@@ -810,7 +846,7 @@ do_allowsends(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->allowSendEvents = !screen->allowSendEvents;
update_allowsends();
@@ -821,18 +857,29 @@ do_visualbell(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->visualbell = !screen->visualbell;
update_visualbell();
}
static void
+do_bellIsUrgent(Widget gw GCC_UNUSED,
+ XtPointer closure GCC_UNUSED,
+ XtPointer data GCC_UNUSED)
+{
+ TScreen *screen = TScreenOf(term);
+
+ screen->bellIsUrgent = !screen->bellIsUrgent;
+ update_bellIsUrgent();
+}
+
+static void
do_poponbell(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->poponbell = !screen->poponbell;
update_poponbell();
@@ -844,7 +891,7 @@ do_logging(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (screen->logging) {
CloseLog(screen);
@@ -920,7 +967,7 @@ do_alt_esc(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- term->screen.input_eight_bits = !term->screen.input_eight_bits;
+ term->screen.alt_sends_esc = !term->screen.alt_sends_esc;
update_alt_esc();
}
@@ -997,6 +1044,16 @@ do_sun_kbd(Widget gw GCC_UNUSED,
}
#endif
+#if OPT_TCAP_FKEYS
+static void
+do_tcap_fkeys(Widget gw GCC_UNUSED,
+ XtPointer closure GCC_UNUSED,
+ XtPointer data GCC_UNUSED)
+{
+ toggle_keyboard_type(term, keyboardIsTermcap);
+}
+#endif
+
/*
* The following cases use the pid instead of the process group so that we
* don't get hosed by programs that change their process group
@@ -1065,7 +1122,7 @@ do_quit(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- Cleanup(0);
+ Cleanup(SIGHUP);
}
/*
@@ -1085,7 +1142,7 @@ do_jumpscroll(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
term->flags ^= SMOOTHSCROLL;
if (term->flags & SMOOTHSCROLL) {
@@ -1156,7 +1213,7 @@ do_scrollkey(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->scrollkey = !screen->scrollkey;
update_scrollkey();
@@ -1167,18 +1224,29 @@ do_scrollttyoutput(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->scrollttyoutput = !screen->scrollttyoutput;
update_scrollttyoutput();
}
static void
+do_keepSelection(Widget gw GCC_UNUSED,
+ XtPointer closure GCC_UNUSED,
+ XtPointer data GCC_UNUSED)
+{
+ TScreen *screen = TScreenOf(term);
+
+ screen->keepSelection = !screen->keepSelection;
+ update_keepSelection();
+}
+
+static void
do_selectClipboard(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->selectToClipboard = !screen->selectToClipboard;
update_selectToClipboard();
@@ -1189,7 +1257,7 @@ do_allow132(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->c132 = !screen->c132;
update_allow132();
@@ -1200,7 +1268,7 @@ do_cursesemul(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->curses = !screen->curses;
update_cursesemul();
@@ -1211,7 +1279,7 @@ do_marginbell(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (!(screen->marginbell = !screen->marginbell))
screen->bellarmed = -1;
@@ -1222,10 +1290,10 @@ do_marginbell(Widget gw GCC_UNUSED,
static void
handle_tekshow(Widget gw GCC_UNUSED, Bool allowswitch)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
TRACE(("Show tek-window\n"));
- if (!screen->Tshow) { /* not showing, turn on */
+ if (!TEK4014_SHOWN(term)) { /* not showing, turn on */
set_tek_visibility(True);
} else if (screen->Vshow || allowswitch) { /* is showing, turn off */
set_tek_visibility(False);
@@ -1260,7 +1328,7 @@ do_cursorblink(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
ToggleCursorBlink(screen);
}
#endif
@@ -1291,7 +1359,7 @@ do_activeicon(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (screen->iconVwin.window) {
Widget shell = XtParent(term);
@@ -1334,9 +1402,7 @@ do_tekmode(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
-
- switch_modes(screen->TekEmu); /* switch to tek mode */
+ switch_modes(TEK4014_ACTIVE(term)); /* switch to tek mode */
}
/* ARGSUSED */
@@ -1412,7 +1478,7 @@ do_font_renderfont(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
int fontnum = screen->menu_font_number;
String name = term->screen.MenuFontName(fontnum);
@@ -1431,7 +1497,7 @@ do_font_utf8_mode(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
/*
* If xterm was started with -wc option, it might not have the wide fonts.
@@ -1440,7 +1506,7 @@ do_font_utf8_mode(Widget gw GCC_UNUSED,
if (!screen->utf8_mode) {
if (screen->wide_chars) {
if (xtermLoadWideFonts(term, True)) {
- SetVTFont(term, screen->menu_font_number, TRUE, NULL);
+ SetVTFont(term, screen->menu_font_number, True, NULL);
}
} else {
ChangeToWide(term);
@@ -1459,7 +1525,7 @@ do_font_utf8_title(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
screen->utf8_title = !screen->utf8_title;
update_font_utf8_title();
@@ -1476,7 +1542,7 @@ do_tektextlarge(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekMenu_tektextlarge);
+ TekSetFontSize(tekWidget, tekMenu_tektextlarge);
}
static void
@@ -1484,7 +1550,7 @@ do_tektext2(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekMenu_tektext2);
+ TekSetFontSize(tekWidget, tekMenu_tektext2);
}
static void
@@ -1492,7 +1558,7 @@ do_tektext3(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSetFontSize(tekMenu_tektext3);
+ TekSetFontSize(tekWidget, tekMenu_tektext3);
}
static void
@@ -1500,8 +1566,7 @@ do_tektextsmall(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
-
- TekSetFontSize(tekMenu_tektextsmall);
+ TekSetFontSize(tekWidget, tekMenu_tektextsmall);
}
static void
@@ -1509,7 +1574,7 @@ do_tekpage(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSimulatePageButton(False);
+ TekSimulatePageButton(tekWidget, False);
}
static void
@@ -1517,7 +1582,7 @@ do_tekreset(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekSimulatePageButton(True);
+ TekSimulatePageButton(tekWidget, True);
}
static void
@@ -1525,21 +1590,21 @@ do_tekcopy(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TekCopy();
+ TekCopy(tekWidget);
}
static void
handle_vtshow(Widget gw GCC_UNUSED, Bool allowswitch)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
TRACE(("Show vt-window\n"));
if (!screen->Vshow) { /* not showing, turn on */
set_vt_visibility(True);
- } else if (screen->Tshow || allowswitch) { /* is showing, turn off */
+ } else if (TEK4014_SHOWN(term) || allowswitch) { /* is showing, turn off */
set_vt_visibility(False);
- if (!screen->TekEmu && TekRefresh)
- dorefresh();
+ if (!TEK4014_ACTIVE(term) && tekRefreshList)
+ TekRefresh(tekWidget);
end_vt_mode(); /* WARNING: this does a longjmp... */
} else
Bell(XkbBI_MinorError, 0);
@@ -1566,9 +1631,7 @@ do_vtmode(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = &term->screen;
-
- switch_modes(screen->TekEmu); /* switch to vt, or from */
+ switch_modes(TEK4014_ACTIVE(term)); /* switch to vt, or from */
}
/* ARGSUSED */
@@ -1914,6 +1977,16 @@ HandleJumpscroll(Widget w,
}
void
+HandleKeepSelection(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params,
+ Cardinal *param_count)
+{
+ handle_vt_toggle(do_keepSelection, term->screen.keepSelection,
+ params, *param_count, w);
+}
+
+void
HandleSetSelect(Widget w,
XEvent * event GCC_UNUSED,
String * params,
@@ -2024,6 +2097,16 @@ HandleCursesEmul(Widget w,
}
void
+HandleBellIsUrgent(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params,
+ Cardinal *param_count)
+{
+ handle_vt_toggle(do_bellIsUrgent, term->screen.bellIsUrgent,
+ params, *param_count, w);
+}
+
+void
HandleMarginBell(Widget w,
XEvent * event GCC_UNUSED,
String * params,
@@ -2179,12 +2262,12 @@ HandleSetTerminalType(Widget w,
switch (params[0][0]) {
case 'v':
case 'V':
- if (term->screen.TekEmu)
+ if (TEK4014_ACTIVE(term))
do_vtmode(w, (XtPointer) 0, (XtPointer) 0);
break;
case 't':
case 'T':
- if (!term->screen.TekEmu)
+ if (!TEK4014_ACTIVE(term))
do_tekmode(w, (XtPointer) 0, (XtPointer) 0);
break;
default:
@@ -2210,7 +2293,7 @@ HandleVisibility(Widget w,
break;
case 't':
case 'T':
- handle_tek_toggle(do_tekonoff, (int) term->screen.Tshow,
+ handle_tek_toggle(do_tekonoff, (int) TEK4014_SHOWN(term),
params + 1, (*param_count) - 1, w);
break;
default:
@@ -2235,19 +2318,17 @@ HandleSetTekText(Widget w,
proc = do_tektextlarge;
break;
case 1:
- switch (params[0][0]) {
- case 'l':
- case 'L':
+ switch (TekGetFontSize(params[0])) {
+ case TEK_FONT_LARGE:
proc = do_tektextlarge;
break;
- case '2':
+ case TEK_FONT_2:
proc = do_tektext2;
break;
- case '3':
+ case TEK_FONT_3:
proc = do_tektext3;
break;
- case 's':
- case 'S':
+ case TEK_FONT_SMALL:
proc = do_tektextsmall;
break;
}
@@ -2291,10 +2372,17 @@ HandleTekCopy(Widget w,
#endif /* OPT_TEK4014 */
static void
-UpdateMenuItem(Widget mi, XtArgVal val)
+UpdateMenuItem(
+#if OPT_TRACE
+ const char *func,
+#endif
+ MenuEntry * menu,
+ int which,
+ XtArgVal val)
{
static Arg menuArgs =
{XtNleftBitmap, (XtArgVal) 0};
+ Widget mi = menu[which].widget;
if (mi) {
menuArgs.value = (XtArgVal) ((val)
@@ -2302,8 +2390,15 @@ UpdateMenuItem(Widget mi, XtArgVal val)
: None);
XtSetValues(mi, &menuArgs, (Cardinal) 1);
}
+ TRACE(("%s(%d): %s\n", func, which, BtoS(val)));
}
+#if OPT_TRACE
+#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(func, mn, mi, val)
+#else
+#define UpdateCheckbox(func, mn, mi, val) UpdateMenuItem(mn, mi, val)
+#endif
+
void
SetItemSensitivity(Widget mi, XtArgVal val)
{
@@ -2348,6 +2443,7 @@ SetupShell(Widget *menus, MenuList * shell, int n, int m)
char *external_name = 0;
Dimension button_height;
Dimension button_border;
+ String saveLocale = setMenuLocale(True, resource.menuLocale);
shell[n].w = XtVaCreatePopupShell(menu_names[n].internal_name,
simpleMenuWidgetClass,
@@ -2380,6 +2476,7 @@ SetupShell(Widget *menus, MenuList * shell, int n, int m)
XtNborderWidth, &button_border,
(XtPointer) 0);
+ (void) setMenuLocale(True, saveLocale);
return button_height + (button_border * 2);
}
#endif /* OPT_TOOLBAR */
@@ -2388,9 +2485,8 @@ void
SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
{
#if OPT_TOOLBAR
- Dimension button_height;
+ Dimension button_height = 0;
Dimension toolbar_hSpace;
- Dimension toolbar_border;
Arg args[10];
#endif
@@ -2436,7 +2532,6 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
*/
XtVaGetValues(*menus,
XtNhSpace, &toolbar_hSpace,
- XtNborderWidth, &toolbar_border,
(XtPointer) 0);
if (shell == toplevel) { /* vt100 */
@@ -2456,11 +2551,11 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
* Tell the main program how high the toolbar is, to help with the initial
* layout.
*/
- *menu_high = (button_height + 2 * (toolbar_hSpace + toolbar_border));
- TRACE(("...menuHeight:%d = (%d + 2 * (%d + %d))\n",
- *menu_high, button_height, toolbar_hSpace, toolbar_border));
+ *menu_high = (button_height + 2 * (toolbar_hSpace));
+ TRACE(("...menuHeight:%d = (%d + 2 * %d)\n",
+ *menu_high, button_height, toolbar_hSpace));
-#else
+#else /* !OPT_TOOLBAR */
*forms = shell;
*menus = shell;
#endif
@@ -2473,10 +2568,10 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
void
repairSizeHints(void)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (XtIsRealized((Widget) term)) {
- bzero(&term->hints, sizeof(term->hints));
+ getXtermSizeHints(term);
xtermSizeHints(term, ScrollbarWidth(screen));
XSetWMNormalHints(screen->display, XtWindow(SHELL_OF(term)), &term->hints);
@@ -2526,6 +2621,8 @@ toolbar_info(Widget w)
#if OPT_TEK4014
if (w != (Widget) term)
return &(tekWidget->tek.tb_info);
+#else
+ (void) w;
#endif
return &(WhichVWin(&(term->screen))->tb_info);
}
@@ -2643,7 +2740,9 @@ do_toolbar(Widget gw GCC_UNUSED,
void
update_toolbar(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_toolbar].widget,
+ UpdateCheckbox("update_toolbar",
+ mainMenuEntries,
+ mainMenu_toolbar,
resource.toolBar);
}
#endif /* OPT_TOOLBAR */
@@ -2651,14 +2750,18 @@ update_toolbar(void)
void
update_securekbd(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_securekbd].widget,
+ UpdateCheckbox("update_securekbd",
+ mainMenuEntries,
+ mainMenu_securekbd,
term->screen.grabbedKbd);
}
void
update_allowsends(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_allowsends].widget,
+ UpdateCheckbox("update_allowsends",
+ mainMenuEntries,
+ mainMenu_allowsends,
term->screen.allowSendEvents);
}
@@ -2666,7 +2769,9 @@ update_allowsends(void)
void
update_logging(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_logging].widget,
+ UpdateCheckbox("update_logging",
+ mainMenuEntries,
+ mainMenu_logging,
term->screen.logging);
}
#endif
@@ -2674,21 +2779,27 @@ update_logging(void)
void
update_print_redir(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_print_redir].widget,
+ UpdateCheckbox("update_print_redir",
+ mainMenuEntries,
+ mainMenu_print_redir,
term->screen.printer_controlmode);
}
void
update_8bit_control(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_8bit_ctrl].widget,
+ UpdateCheckbox("update_8bit_control",
+ mainMenuEntries,
+ mainMenu_8bit_ctrl,
term->screen.control_eight_bits);
}
void
update_decbkm(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_backarrow].widget,
+ UpdateCheckbox("update_decbkm",
+ mainMenuEntries,
+ mainMenu_backarrow,
(term->keyboard.flags & MODE_DECBKM) != 0);
}
@@ -2696,21 +2807,27 @@ update_decbkm(void)
void
update_num_lock(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_num_lock].widget,
+ UpdateCheckbox("update_num_lock",
+ mainMenuEntries,
+ mainMenu_num_lock,
term->misc.real_NumLock);
}
void
update_alt_esc(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_alt_esc].widget,
- !term->screen.input_eight_bits);
+ UpdateCheckbox("update_alt_esc",
+ mainMenuEntries,
+ mainMenu_alt_esc,
+ term->screen.alt_sends_esc);
}
void
update_meta_esc(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_meta_esc].widget,
+ UpdateCheckbox("update_meta_esc",
+ mainMenuEntries,
+ mainMenu_meta_esc,
term->screen.meta_sends_esc);
}
#endif
@@ -2719,22 +2836,39 @@ update_meta_esc(void)
void
update_sun_fkeys(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_sun_fkeys].widget,
+ UpdateCheckbox("update_sun_fkeys",
+ mainMenuEntries,
+ mainMenu_sun_fkeys,
term->keyboard.type == keyboardIsSun);
}
#endif
+#if OPT_TCAP_FKEYS
+void
+update_tcap_fkeys(void)
+{
+ UpdateCheckbox("update_tcap_fkeys",
+ mainMenuEntries,
+ mainMenu_tcap_fkeys,
+ term->keyboard.type == keyboardIsTermcap);
+}
+#endif
+
void
update_old_fkeys(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_old_fkeys].widget,
+ UpdateCheckbox("update_old_fkeys",
+ mainMenuEntries,
+ mainMenu_old_fkeys,
term->keyboard.type == keyboardIsLegacy);
}
void
update_delete_del(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_delete_del].widget,
+ UpdateCheckbox("update_delete_del",
+ mainMenuEntries,
+ mainMenu_delete_del,
xtermDeleteIsDEL(term));
}
@@ -2742,7 +2876,9 @@ update_delete_del(void)
void
update_sun_kbd(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_sun_kbd].widget,
+ UpdateCheckbox("update_sun_kbd",
+ mainMenuEntries,
+ mainMenu_sun_kbd,
term->keyboard.type == keyboardIsVT220);
}
#endif
@@ -2751,7 +2887,9 @@ update_sun_kbd(void)
void
update_hp_fkeys(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_hp_fkeys].widget,
+ UpdateCheckbox("update_hp_fkeys",
+ mainMenuEntries,
+ mainMenu_hp_fkeys,
term->keyboard.type == keyboardIsHP);
}
#endif
@@ -2760,7 +2898,9 @@ update_hp_fkeys(void)
void
update_sco_fkeys(void)
{
- UpdateMenuItem(mainMenuEntries[mainMenu_sco_fkeys].widget,
+ UpdateCheckbox("update_sco_fkeys",
+ mainMenuEntries,
+ mainMenu_sco_fkeys,
term->keyboard.type == keyboardIsSCO);
}
#endif
@@ -2768,84 +2908,117 @@ update_sco_fkeys(void)
void
update_scrollbar(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_scrollbar].widget,
- ScrollbarWidth(&term->screen));
+ UpdateCheckbox("update_scrollbar",
+ vtMenuEntries,
+ vtMenu_scrollbar,
+ ScrollbarWidth(TScreenOf(term)));
}
void
update_jumpscroll(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_jumpscroll].widget,
+ UpdateCheckbox("update_jumpscroll",
+ vtMenuEntries,
+ vtMenu_jumpscroll,
term->screen.jumpscroll);
}
void
update_reversevideo(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_reversevideo].widget,
+ UpdateCheckbox("update_reversevideo",
+ vtMenuEntries,
+ vtMenu_reversevideo,
(term->misc.re_verse));
}
void
update_autowrap(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_autowrap].widget,
+ UpdateCheckbox("update_autowrap",
+ vtMenuEntries,
+ vtMenu_autowrap,
(term->flags & WRAPAROUND) != 0);
}
void
update_reversewrap(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_reversewrap].widget,
+ UpdateCheckbox("update_reversewrap",
+ vtMenuEntries,
+ vtMenu_reversewrap,
(term->flags & REVERSEWRAP) != 0);
}
void
update_autolinefeed(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_autolinefeed].widget,
+ UpdateCheckbox("update_autolinefeed",
+ vtMenuEntries,
+ vtMenu_autolinefeed,
(term->flags & LINEFEED) != 0);
}
void
update_appcursor(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_appcursor].widget,
+ UpdateCheckbox("update_appcursor",
+ vtMenuEntries,
+ vtMenu_appcursor,
(term->keyboard.flags & MODE_DECCKM) != 0);
}
void
update_appkeypad(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_appkeypad].widget,
+ UpdateCheckbox("update_appkeypad",
+ vtMenuEntries,
+ vtMenu_appkeypad,
(term->keyboard.flags & MODE_DECKPAM) != 0);
}
void
update_scrollkey(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_scrollkey].widget,
+ UpdateCheckbox("update_scrollkey",
+ vtMenuEntries,
+ vtMenu_scrollkey,
term->screen.scrollkey);
}
void
update_scrollttyoutput(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_scrollttyoutput].widget,
+ UpdateCheckbox("update_scrollttyoutput",
+ vtMenuEntries,
+ vtMenu_scrollttyoutput,
term->screen.scrollttyoutput);
}
void
+update_keepSelection(void)
+{
+ UpdateCheckbox("update_keepSelection",
+ vtMenuEntries,
+ vtMenu_keepSelection,
+ term->screen.keepSelection);
+}
+
+void
update_selectToClipboard(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_selectToClipboard].widget,
+ UpdateCheckbox("update_selectToClipboard",
+ vtMenuEntries,
+ vtMenu_selectToClipboard,
term->screen.selectToClipboard);
}
void
update_allow132(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_allow132].widget,
+ UpdateCheckbox("update_allow132",
+ vtMenuEntries,
+ vtMenu_allow132,
term->screen.c132);
}
@@ -2853,7 +3026,7 @@ void
update_cursesemul(void)
{
#if 0 /* 2006-2-12: no longer menu entry */
- UpdateMenuItem(vtMenuEntries[vtMenu_cursesemul].widget,
+ UpdateMenuItem("update_cursesemul", vtMenuEntries, vtMenu_cursesemul,
term->screen.curses);
#endif
}
@@ -2861,29 +3034,48 @@ update_cursesemul(void)
void
update_visualbell(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_visualbell].widget,
+ UpdateCheckbox("update_visualbell",
+ vtMenuEntries,
+ vtMenu_visualbell,
term->screen.visualbell);
}
void
+update_bellIsUrgent(void)
+{
+ UpdateCheckbox("update_bellIsUrgent",
+ vtMenuEntries,
+ vtMenu_bellIsUrgent,
+ term->screen.bellIsUrgent);
+}
+
+void
update_poponbell(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_poponbell].widget,
+ UpdateCheckbox("update_poponbell",
+ vtMenuEntries,
+ vtMenu_poponbell,
term->screen.poponbell);
}
+#ifndef update_marginbell /* 2007-3-7: no longer menu entry */
void
update_marginbell(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_marginbell].widget,
+ UpdateCheckbox("update_marginbell",
+ vtMenuEntries,
+ vtMenu_marginbell,
term->screen.marginbell);
}
+#endif
#if OPT_BLINK_CURS
void
update_cursorblink(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_cursorblink].widget,
+ UpdateCheckbox("update_cursorblink",
+ vtMenuEntries,
+ vtMenu_cursorblink,
term->screen.cursor_blink);
}
#endif
@@ -2891,14 +3083,18 @@ update_cursorblink(void)
void
update_altscreen(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_altscreen].widget,
+ UpdateCheckbox("update_altscreen",
+ vtMenuEntries,
+ vtMenu_altscreen,
term->screen.alternate);
}
void
update_titeInhibit(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_titeInhibit].widget,
+ UpdateCheckbox("update_titeInhibit",
+ vtMenuEntries,
+ vtMenu_titeInhibit,
!(term->misc.titeInhibit));
}
@@ -2906,7 +3102,9 @@ update_titeInhibit(void)
void
update_activeicon(void)
{
- UpdateMenuItem(vtMenuEntries[vtMenu_activeicon].widget,
+ UpdateCheckbox("update_activeicon",
+ vtMenuEntries,
+ vtMenu_activeicon,
term->misc.active_icon);
}
#endif /* NO_ACTIVE_ICON */
@@ -2915,7 +3113,9 @@ update_activeicon(void)
void
update_font_doublesize(void)
{
- UpdateMenuItem(fontMenuEntries[fontMenu_font_doublesize].widget,
+ UpdateCheckbox("update_font_doublesize",
+ fontMenuEntries,
+ fontMenu_font_doublesize,
term->screen.font_doublesize);
}
#endif
@@ -2924,7 +3124,9 @@ update_font_doublesize(void)
void
update_font_boxchars(void)
{
- UpdateMenuItem(fontMenuEntries[fontMenu_font_boxchars].widget,
+ UpdateCheckbox("update_font_boxchars",
+ fontMenuEntries,
+ fontMenu_font_boxchars,
term->screen.force_box_chars);
}
#endif
@@ -2933,7 +3135,9 @@ update_font_boxchars(void)
void
update_font_loadable(void)
{
- UpdateMenuItem(fontMenuEntries[fontMenu_font_loadable].widget,
+ UpdateCheckbox("update_font_loadable",
+ fontMenuEntries,
+ fontMenu_font_loadable,
term->misc.font_loadable);
}
#endif
@@ -2942,7 +3146,9 @@ update_font_loadable(void)
void
update_font_renderfont(void)
{
- UpdateMenuItem(fontMenuEntries[fontMenu_render_font].widget,
+ UpdateCheckbox("update_font_renderfont",
+ fontMenuEntries,
+ fontMenu_render_font,
term->misc.render_font);
}
#endif
@@ -2951,25 +3157,29 @@ update_font_renderfont(void)
void
update_font_utf8_mode(void)
{
- Widget iw = fontMenuEntries[fontMenu_wide_chars].widget;
Bool active = (term->screen.utf8_mode != uAlways);
Bool enable = (term->screen.utf8_mode != uFalse);
TRACE(("update_font_utf8_mode active %d, enable %d\n", active, enable));
- SetItemSensitivity(iw, active);
- UpdateMenuItem(iw, enable);
+ SetItemSensitivity(fontMenuEntries[fontMenu_wide_chars].widget, active);
+ UpdateCheckbox("update_font_utf8_mode",
+ fontMenuEntries,
+ fontMenu_wide_chars,
+ enable);
}
void
update_font_utf8_title(void)
{
- Widget iw = fontMenuEntries[fontMenu_wide_title].widget;
Bool active = (term->screen.utf8_mode != uFalse);
Bool enable = (term->screen.utf8_title);
TRACE(("update_font_utf8_title active %d, enable %d\n", active, enable));
- SetItemSensitivity(iw, active);
- UpdateMenuItem(iw, enable);
+ SetItemSensitivity(fontMenuEntries[fontMenu_wide_title].widget, active);
+ UpdateCheckbox("update_font_utf8_title",
+ fontMenuEntries,
+ fontMenu_wide_title,
+ enable);
}
#endif
@@ -2978,8 +3188,10 @@ void
update_tekshow(void)
{
if (!(term->screen.inhibit & I_TEK)) {
- UpdateMenuItem(vtMenuEntries[vtMenu_tekshow].widget,
- term->screen.Tshow);
+ UpdateCheckbox("update_tekshow",
+ vtMenuEntries,
+ vtMenu_tekshow,
+ TEK4014_SHOWN(term));
}
}
@@ -2987,10 +3199,14 @@ void
update_vttekmode(void)
{
if (!(term->screen.inhibit & I_TEK)) {
- UpdateMenuItem(vtMenuEntries[vtMenu_tekmode].widget,
- term->screen.TekEmu);
- UpdateMenuItem(tekMenuEntries[tekMenu_vtmode].widget,
- !term->screen.TekEmu);
+ UpdateCheckbox("update_vtmode",
+ vtMenuEntries,
+ vtMenu_tekmode,
+ TEK4014_ACTIVE(term));
+ UpdateCheckbox("update_tekmode",
+ tekMenuEntries,
+ tekMenu_vtmode,
+ !TEK4014_ACTIVE(term));
}
}
@@ -2998,7 +3214,9 @@ void
update_vtshow(void)
{
if (!(term->screen.inhibit & I_TEK)) {
- UpdateMenuItem(tekMenuEntries[tekMenu_vtshow].widget,
+ UpdateCheckbox("update_vtshow",
+ tekMenuEntries,
+ tekMenu_vtshow,
term->screen.Vshow);
}
}
@@ -3009,7 +3227,7 @@ set_vthide_sensitivity(void)
if (!(term->screen.inhibit & I_TEK)) {
SetItemSensitivity(
vtMenuEntries[vtMenu_vthide].widget,
- term->screen.Tshow);
+ TEK4014_SHOWN(term));
}
}
@@ -3027,7 +3245,7 @@ void
set_tekfont_menu_item(int n, int val)
{
if (!(term->screen.inhibit & I_TEK)) {
- UpdateMenuItem(tekMenuEntries[FS2MI(n)].widget,
+ UpdateCheckbox("set_tekfont_menu_item", tekMenuEntries, FS2MI(n),
(val));
}
}
@@ -3036,6 +3254,8 @@ set_tekfont_menu_item(int n, int val)
void
set_menu_font(int val)
{
- UpdateMenuItem(fontMenuEntries[term->screen.menu_font_number].widget,
+ UpdateCheckbox("set_menu_font",
+ fontMenuEntries,
+ term->screen.menu_font_number,
(val));
}
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 8589fadfa..63408aadc 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,10 +1,8 @@
-/* $XTermId: misc.c,v 1.314 2006/08/03 23:54:32 tom Exp $ */
-
-/* $XFree86: xc/programs/xterm/misc.c,v 3.107 2006/06/19 00:36:51 dickey Exp $ */
+/* $XTermId: misc.c,v 1.384 2008/07/27 15:38:05 tom Exp $ */
/*
*
- * Copyright 1999-2005,2006 by Thomas E. Dickey
+ * Copyright 1999-2007,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -65,8 +63,10 @@
#include <pwd.h>
#include <sys/wait.h>
+#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
+#include <X11/Xlocale.h>
#include <X11/Xmu/Error.h>
#include <X11/Xmu/SysUtil.h>
@@ -88,6 +88,7 @@
#include <fontutils.h>
#include <xcharmouse.h>
#include <xstrings.h>
+#include <xtermcap.h>
#include <VTparse.h>
#include <assert.h>
@@ -108,27 +109,169 @@
#if OPT_TEK4014
#define OUR_EVENT(event,Type) \
(event.type == Type && \
- (event.xcrossing.window == XtWindow(XtParent(term)) || \
+ (event.xcrossing.window == XtWindow(XtParent(xw)) || \
(tekWidget && \
event.xcrossing.window == XtWindow(XtParent(tekWidget)))))
#else
#define OUR_EVENT(event,Type) \
(event.type == Type && \
- (event.xcrossing.window == XtWindow(XtParent(term))))
+ (event.xcrossing.window == XtWindow(XtParent(xw))))
+#endif
+
+static Cursor make_hidden_cursor(XtermWidget);
+
+#if OPT_EXEC_XTERM
+/* Like readlink(2), but returns a malloc()ed buffer, or NULL on
+ error; adapted from libc docs */
+static char *
+Readlink(const char *filename)
+{
+ char *buf = NULL;
+ unsigned size = 100;
+ int n;
+
+ for (;;) {
+ buf = TypeRealloc(char, size, buf);
+ memset(buf, 0, size);
+
+ n = readlink(filename, buf, size);
+ if (n < 0) {
+ free(buf);
+ return NULL;
+ }
+
+ if ((unsigned) n < size) {
+ return buf;
+ }
+
+ size *= 2;
+ }
+}
+#endif /* OPT_EXEC_XTERM */
+
+static void
+Sleep(int msec)
+{
+ static struct timeval select_timeout;
+
+ select_timeout.tv_sec = 0;
+ select_timeout.tv_usec = msec * 1000;
+ select(0, 0, 0, 0, &select_timeout);
+}
+
+static void
+selectwindow(TScreen * screen, int flag)
+{
+ TRACE(("selectwindow(%d) flag=%d\n", screen->select, flag));
+
+#if OPT_TEK4014
+ if (TEK4014_ACTIVE(term)) {
+ if (!Ttoggled)
+ TCursorToggle(tekWidget, TOGGLE);
+ screen->select |= flag;
+ if (!Ttoggled)
+ TCursorToggle(tekWidget, TOGGLE);
+ } else
+#endif
+ {
+ if (screen->xic)
+ XSetICFocus(screen->xic);
+
+ if (screen->cursor_state && CursorMoved(screen))
+ HideCursor();
+ screen->select |= flag;
+ if (screen->cursor_state)
+ ShowCursor();
+ }
+}
+
+static void
+unselectwindow(TScreen * screen, int flag)
+{
+ TRACE(("unselectwindow(%d) flag=%d\n", screen->select, flag));
+
+ if (screen->hide_pointer) {
+ screen->hide_pointer = False;
+ xtermDisplayCursor(term);
+ }
+
+ if (!screen->always_highlight) {
+#if OPT_TEK4014
+ if (TEK4014_ACTIVE(term)) {
+ if (!Ttoggled)
+ TCursorToggle(tekWidget, TOGGLE);
+ screen->select &= ~flag;
+ if (!Ttoggled)
+ TCursorToggle(tekWidget, TOGGLE);
+ } else
#endif
+ {
+ if (screen->xic)
+ XUnsetICFocus(screen->xic);
+
+ screen->select &= ~flag;
+ if (screen->cursor_state && CursorMoved(screen))
+ HideCursor();
+ if (screen->cursor_state)
+ ShowCursor();
+ }
+ }
+}
-static Bool ChangeColorsRequest(XtermWidget xw, int start, char
- *names, int final);
-static void DoSpecialEnterNotify(XEnterWindowEvent * ev);
-static void DoSpecialLeaveNotify(XEnterWindowEvent * ev);
-static void selectwindow(TScreen * screen, int flag);
-static void unselectwindow(TScreen * screen, int flag);
-static void Sleep(int msec);
+static void
+DoSpecialEnterNotify(XtermWidget xw, XEnterWindowEvent * ev)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ TRACE(("DoSpecialEnterNotify(%d)\n", screen->select));
+#ifdef ACTIVEWINDOWINPUTONLY
+ if (ev->window == XtWindow(XtParent(CURRENT_EMU())))
+#endif
+ if (((ev->detail) != NotifyInferior) &&
+ ev->focus &&
+ !(screen->select & FOCUS))
+ selectwindow(screen, INWINDOW);
+}
+
+static void
+DoSpecialLeaveNotify(XtermWidget xw, XEnterWindowEvent * ev)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ TRACE(("DoSpecialLeaveNotify(%d)\n", screen->select));
+#ifdef ACTIVEWINDOWINPUTONLY
+ if (ev->window == XtWindow(XtParent(CURRENT_EMU())))
+#endif
+ if (((ev->detail) != NotifyInferior) &&
+ ev->focus &&
+ !(screen->select & FOCUS))
+ unselectwindow(screen, INWINDOW);
+}
+
+#ifndef XUrgencyHint
+#define XUrgencyHint (1L << 8) /* X11R5 does not define */
+#endif
+
+static void
+setXUrgency(TScreen * screen, Bool enable)
+{
+ if (screen->bellIsUrgent) {
+ XWMHints *h = XGetWMHints(screen->display, VShellWindow);
+ if (h != 0) {
+ if (enable) {
+ h->flags |= XUrgencyHint;
+ } else {
+ h->flags &= ~XUrgencyHint;
+ }
+ XSetWMHints(screen->display, VShellWindow, h);
+ }
+ }
+}
void
do_xevents(void)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (XtAppPending(app_con)
||
@@ -142,17 +285,94 @@ do_xevents(void)
}
void
+xtermDisplayCursor(XtermWidget xw)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ if (screen->Vshow) {
+ if (screen->hide_pointer) {
+ TRACE(("Display hidden_cursor\n"));
+ XDefineCursor(screen->display, VWindow(screen), screen->hidden_cursor);
+ } else {
+ TRACE(("Display pointer_cursor\n"));
+ recolor_cursor(screen,
+ screen->pointer_cursor,
+ T_COLOR(screen, MOUSE_FG),
+ T_COLOR(screen, MOUSE_BG));
+ XDefineCursor(screen->display, VWindow(screen), screen->pointer_cursor);
+ }
+ }
+}
+
+void
+xtermShowPointer(XtermWidget xw, Bool enable)
+{
+ static int tried = -1;
+ TScreen *screen = TScreenOf(xw);
+
+#if OPT_TEK4014
+ if (TEK4014_SHOWN(xw))
+ enable = True;
+#endif
+
+ /*
+ * Whether we actually hide the pointer depends on the pointer-mode and
+ * the mouse-mode:
+ */
+ if (!enable) {
+ switch (screen->pointer_mode) {
+ case pNever:
+ enable = True;
+ break;
+ case pNoMouse:
+ if (screen->send_mouse_pos != MOUSE_OFF)
+ enable = True;
+ break;
+ case pAlways:
+ break;
+ }
+ }
+
+ if (enable) {
+ if (screen->hide_pointer) {
+ screen->hide_pointer = False;
+ xtermDisplayCursor(xw);
+ switch (screen->send_mouse_pos) {
+ case ANY_EVENT_MOUSE:
+ break;
+ default:
+ MotionOff(screen, xw);
+ break;
+ }
+ }
+ } else if (!(screen->hide_pointer) && (tried <= 0)) {
+ if (screen->hidden_cursor == 0) {
+ screen->hidden_cursor = make_hidden_cursor(xw);
+ }
+ if (screen->hidden_cursor == 0) {
+ tried = 1;
+ } else {
+ tried = 0;
+ screen->hide_pointer = True;
+ xtermDisplayCursor(xw);
+ MotionOn(screen, xw);
+ }
+ }
+}
+
+void
xevents(void)
{
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
XEvent event;
XtInputMask input_mask;
- TScreen *screen = &term->screen;
if (need_cleanup)
Cleanup(0);
if (screen->scroll_amt)
- FlushScroll(term);
+ FlushScroll(xw);
/*
* process timeouts, relying on the fact that XtAppProcessEvent
* will process the timeout and return without blockng on the
@@ -181,7 +401,7 @@ xevents(void)
* We simply ignore all events except for those not passed down to
* this function, e.g., those handled in in_put().
*/
- if (waitingForTrackInfo) {
+ if (screen->waitingForTrackInfo) {
Sleep(10);
return;
}
@@ -192,18 +412,18 @@ xevents(void)
* looking at the event ourselves we make sure that we can
* do the right thing.
*/
- if (OUR_EVENT(event, EnterNotify))
- DoSpecialEnterNotify(&event.xcrossing);
- else if (OUR_EVENT(event, LeaveNotify))
- DoSpecialLeaveNotify(&event.xcrossing);
- else if ((screen->send_mouse_pos == ANY_EVENT_MOUSE
+ if (OUR_EVENT(event, EnterNotify)) {
+ DoSpecialEnterNotify(xw, &event.xcrossing);
+ } else if (OUR_EVENT(event, LeaveNotify)) {
+ DoSpecialLeaveNotify(xw, &event.xcrossing);
+ } else if ((screen->send_mouse_pos == ANY_EVENT_MOUSE
#if OPT_DEC_LOCATOR
- || screen->send_mouse_pos == DEC_LOCATOR
+ || screen->send_mouse_pos == DEC_LOCATOR
#endif /* OPT_DEC_LOCATOR */
- )
- && event.xany.type == MotionNotify
- && event.xcrossing.window == XtWindow(term)) {
- SendMousePosition(term, &event);
+ )
+ && event.xany.type == MotionNotify
+ && event.xcrossing.window == XtWindow(xw)) {
+ SendMousePosition(xw, &event);
continue;
}
@@ -212,25 +432,79 @@ xevents(void)
((event.xany.type != KeyPress) &&
(event.xany.type != KeyRelease) &&
(event.xany.type != ButtonPress) &&
- (event.xany.type != ButtonRelease)))
+ (event.xany.type != ButtonRelease))) {
+
+ /*
+ * If the event is interesting (and not a keyboard event), turn the
+ * mouse pointer back on.
+ */
+ if (screen->hide_pointer) {
+ switch (event.xany.type) {
+ case KeyPress:
+ case KeyRelease:
+ case ButtonPress:
+ case ButtonRelease:
+ /* also these... */
+ case Expose:
+ case NoExpose:
+ case PropertyNotify:
+ break;
+ default:
+ xtermShowPointer(xw, True);
+ break;
+ }
+ }
+
XtDispatchEvent(&event);
+ }
} while ((input_mask = XtAppPending(app_con)) & XtIMXEvent);
}
+static Cursor
+make_hidden_cursor(XtermWidget xw)
+{
+ TScreen *screen = TScreenOf(xw);
+ Cursor c;
+ Display *dpy = screen->display;
+ XFontStruct *fn;
+
+ static XColor dummy;
+
+ /*
+ * Prefer nil2 (which is normally available) to "fixed" (which is supposed
+ * to be "always" available), since it's a smaller glyph in case the
+ * server insists on drawing _somethng_.
+ */
+ TRACE(("Ask for nil2 font\n"));
+ if ((fn = XLoadQueryFont(dpy, "nil2")) == 0) {
+ TRACE(("...Ask for fixed font\n"));
+ fn = XLoadQueryFont(dpy, "fixed");
+ }
+
+ if (fn != 0) {
+ /* a space character seems to work as a cursor (dots are not needed) */
+ c = XCreateGlyphCursor(dpy, fn->fid, fn->fid, 'X', ' ', &dummy, &dummy);
+ XFreeFont(dpy, fn);
+ } else {
+ c = 0;
+ }
+ TRACE(("XCreateGlyphCursor ->%#lx\n", c));
+ return (c);
+}
+
Cursor
make_colored_cursor(unsigned cursorindex, /* index into font */
unsigned long fg, /* pixel value */
unsigned long bg) /* pixel value */
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
Cursor c;
Display *dpy = screen->display;
c = XCreateFontCursor(dpy, cursorindex);
- if (c == (Cursor) 0)
- return (c);
-
- recolor_cursor(screen, c, fg, bg);
+ if (c != None) {
+ recolor_cursor(screen, c, fg, bg);
+ }
return (c);
}
@@ -243,7 +517,7 @@ HandleKeyPressed(Widget w GCC_UNUSED,
{
TRACE(("Handle 7bit-key\n"));
#ifdef ACTIVEWINDOWINPUTONLY
- if (w == CURRENT_EMU(&(term->screen)))
+ if (w == CURRENT_EMU())
#endif
Input(term, &event->xkey, False);
}
@@ -257,7 +531,7 @@ HandleEightBitKeyPressed(Widget w GCC_UNUSED,
{
TRACE(("Handle 8bit-key\n"));
#ifdef ACTIVEWINDOWINPUTONLY
- if (w == CURRENT_EMU(&(term->screen)))
+ if (w == CURRENT_EMU())
#endif
Input(term, &event->xkey, True);
}
@@ -270,7 +544,7 @@ HandleStringEvent(Widget w GCC_UNUSED,
Cardinal *nparams)
{
#ifdef ACTIVEWINDOWINPUTONLY
- if (w != CURRENT_EMU(&(term->screen)))
+ if (w != CURRENT_EMU())
return;
#endif
@@ -299,6 +573,95 @@ HandleStringEvent(Widget w GCC_UNUSED,
}
}
+#if OPT_EXEC_XTERM
+
+#ifndef PROCFS_ROOT
+#define PROCFS_ROOT "/proc"
+#endif
+
+/* ARGSUSED */
+void
+HandleSpawnTerminal(Widget w GCC_UNUSED,
+ XEvent * event GCC_UNUSED,
+ String * params,
+ Cardinal *nparams)
+{
+ TScreen *screen = &term->screen;
+ char *child_cwd = NULL;
+ char *child_exe;
+ pid_t pid;
+
+ /*
+ * Try to find the actual program which is running in the child process.
+ * This works for Linux. If we cannot find the program, fall back to the
+ * xterm program (which is usually adequate). Give up if we are given only
+ * a relative path to xterm, since that would not always match $PATH.
+ */
+ child_exe = Readlink(PROCFS_ROOT "/self/exe");
+ if (!child_exe) {
+ if (strncmp(ProgramName, "./", 2)
+ && strncmp(ProgramName, "../", 3)) {
+ child_exe = xtermFindShell(ProgramName, True);
+ } else {
+ fprintf(stderr, "Cannot exec-xterm given %s\n", ProgramName);
+ }
+ if (child_exe == 0)
+ return;
+ }
+
+ /*
+ * Determine the current working directory of the child so that we can
+ * spawn a new terminal in the same directory.
+ *
+ * If we cannot get the CWD of the child, just use our own.
+ */
+ if (screen->pid) {
+ char child_cwd_link[sizeof(PROCFS_ROOT) + 80];
+ sprintf(child_cwd_link, PROCFS_ROOT "/%lu/cwd", (unsigned long) screen->pid);
+ child_cwd = Readlink(child_cwd_link);
+ }
+
+ /* The reaper will take care of cleaning up the child */
+ pid = fork();
+ if (pid == -1) {
+ fprintf(stderr, "Could not fork: %s\n", SysErrorMsg(errno));
+ } else if (!pid) {
+ /* We are the child */
+ if (child_cwd) {
+ chdir(child_cwd); /* We don't care if this fails */
+ }
+
+ if (setuid(screen->uid) == -1
+ || setgid(screen->gid) == -1) {
+ fprintf(stderr, "Cannot reset uid/gid\n");
+ } else {
+ int myargc = *nparams + 1;
+ char **myargv = TypeMallocN(char *, myargc + 1);
+ int n = 0;
+
+ myargv[n++] = child_exe;
+
+ while (n < myargc) {
+ myargv[n++] = *params++;
+ }
+
+ myargv[n] = 0;
+ execv(child_exe, myargv);
+
+ /* If we get here, we've failed */
+ fprintf(stderr, "exec of '%s': %s\n", child_exe, SysErrorMsg(errno));
+ }
+ _exit(0);
+ } else {
+ /* We are the parent; clean up */
+ if (child_cwd)
+ free(child_cwd);
+ if (child_exe)
+ free(child_exe);
+ }
+}
+#endif /* OPT_EXEC_XTERM */
+
/*
* Rather than sending characters to the host, put them directly into our
* input queue. That lets a user have access to any of the control sequences
@@ -326,7 +689,7 @@ HandleInterpret(Widget w GCC_UNUSED,
if (have - used + need < BUF_SIZE) {
- fillPtyData(&term->screen, VTbuffer, value, (int) strlen(value));
+ fillPtyData(TScreenOf(term), VTbuffer, value, (int) strlen(value));
TRACE(("Interpret %s\n", value));
VTbuffer->update++;
@@ -334,21 +697,6 @@ HandleInterpret(Widget w GCC_UNUSED,
}
}
-static void
-DoSpecialEnterNotify(XEnterWindowEvent * ev)
-{
- TScreen *screen = &term->screen;
-
- TRACE(("DoSpecialEnterNotify(%d)\n", screen->select));
-#ifdef ACTIVEWINDOWINPUTONLY
- if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen))))
-#endif
- if (((ev->detail) != NotifyInferior) &&
- ev->focus &&
- !(screen->select & FOCUS))
- selectwindow(screen, INWINDOW);
-}
-
/*ARGSUSED*/
void
HandleEnterWindow(Widget w GCC_UNUSED,
@@ -360,21 +708,6 @@ HandleEnterWindow(Widget w GCC_UNUSED,
TRACE(("HandleEnterWindow ignored\n"));
}
-static void
-DoSpecialLeaveNotify(XEnterWindowEvent * ev)
-{
- TScreen *screen = &term->screen;
-
- TRACE(("DoSpecialLeaveNotify(%d)\n", screen->select));
-#ifdef ACTIVEWINDOWINPUTONLY
- if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen))))
-#endif
- if (((ev->detail) != NotifyInferior) &&
- ev->focus &&
- !(screen->select & FOCUS))
- unselectwindow(screen, INWINDOW);
-}
-
/*ARGSUSED*/
void
HandleLeaveWindow(Widget w GCC_UNUSED,
@@ -394,14 +727,20 @@ HandleFocusChange(Widget w GCC_UNUSED,
Boolean * cont GCC_UNUSED)
{
XFocusChangeEvent *event = (XFocusChangeEvent *) ev;
- TScreen *screen = &term->screen;
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
- TRACE(("HandleFocusChange type=%d, mode=%d, detail=%d\n",
- event->type,
+ TRACE(("HandleFocusChange type=%s, mode=%d, detail=%d\n",
+ visibleEventType(event->type),
event->mode,
event->detail));
- if (event->type == FocusIn) {
+ if (screen->quiet_grab
+ && (event->mode == NotifyGrab || event->mode == NotifyUngrab)) {
+ ;
+ } else if (event->type == FocusIn) {
+ setXUrgency(screen, False);
+
/*
* NotifyNonlinear only happens (on FocusIn) if the pointer was not in
* one of our windows. Use this to reset a case where one xterm is
@@ -418,10 +757,16 @@ HandleFocusChange(Widget w GCC_UNUSED,
((event->detail == NotifyPointer)
? INWINDOW
: FOCUS));
+ SendFocusButton(xw, event);
} else {
+#if OPT_FOCUS_EVENT
+ if (event->type == FocusOut) {
+ SendFocusButton(xw, event);
+ }
+#endif
/*
- * XGrabKeyboard() will generate FocusOut/NotifyGrab event that we want
- * to ignore.
+ * XGrabKeyboard() will generate NotifyGrab event that we want to
+ * ignore.
*/
if (event->mode != NotifyGrab) {
unselectwindow(screen,
@@ -431,75 +776,19 @@ HandleFocusChange(Widget w GCC_UNUSED,
}
if (screen->grabbedKbd && (event->mode == NotifyUngrab)) {
Bell(XkbBI_Info, 100);
- ReverseVideo(term);
+ ReverseVideo(xw);
screen->grabbedKbd = False;
update_securekbd();
}
}
}
-static void
-selectwindow(TScreen * screen, int flag)
-{
- TRACE(("selectwindow(%d) flag=%d\n", screen->select, flag));
-
-#if OPT_TEK4014
- if (screen->TekEmu) {
- if (!Ttoggled)
- TCursorToggle(TOGGLE);
- screen->select |= flag;
- if (!Ttoggled)
- TCursorToggle(TOGGLE);
- return;
- } else
-#endif
- {
- if (screen->xic)
- XSetICFocus(screen->xic);
-
- if (screen->cursor_state && CursorMoved(screen))
- HideCursor();
- screen->select |= flag;
- if (screen->cursor_state)
- ShowCursor();
- return;
- }
-}
-
-static void
-unselectwindow(TScreen * screen, int flag)
-{
- TRACE(("unselectwindow(%d) flag=%d\n", screen->select, flag));
-
- if (screen->always_highlight)
- return;
-
-#if OPT_TEK4014
- if (screen->TekEmu) {
- if (!Ttoggled)
- TCursorToggle(TOGGLE);
- screen->select &= ~flag;
- if (!Ttoggled)
- TCursorToggle(TOGGLE);
- } else
-#endif
- {
- if (screen->xic)
- XUnsetICFocus(screen->xic);
- screen->select &= ~flag;
- if (screen->cursor_state && CursorMoved(screen))
- HideCursor();
- if (screen->cursor_state)
- ShowCursor();
- }
-}
-
static long lastBellTime; /* in milliseconds */
void
Bell(Atom which GCC_UNUSED, int percent)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
struct timeval curtime;
long now_msecs;
@@ -508,6 +797,8 @@ Bell(Atom which GCC_UNUSED, int percent)
return;
}
+ setXUrgency(screen, True);
+
/* has enough time gone by that we are allowed to ring
the bell again? */
if (screen->bellSuppressTime) {
@@ -544,7 +835,7 @@ Bell(Atom which GCC_UNUSED, int percent)
back. If the server is suspending operations while the bell
is being emitted (problematic for audio bell), this lets us
know when the previous bell has finished */
- Widget w = CURRENT_EMU(screen);
+ Widget w = CURRENT_EMU();
XChangeProperty(XtDisplay(w), XtWindow(w),
XA_NOTICE, XA_NOTICE, 8, PropModeAppend, NULL, 0);
screen->bellInProgress = True;
@@ -565,7 +856,7 @@ flashWindow(TScreen * screen, Window window, GC visualGC, unsigned width, unsign
void
VisualBell(void)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (VB_DELAY > 0) {
Pixel xorPixel = (T_COLOR(screen, TEXT_FG) ^
@@ -577,10 +868,11 @@ VisualBell(void)
gcval.foreground = xorPixel;
visualGC = XtGetGC((Widget) term, GCFunction + GCForeground, &gcval);
#if OPT_TEK4014
- if (screen->TekEmu) {
- flashWindow(screen, TWindow(screen), visualGC,
- TFullWidth(screen),
- TFullHeight(screen));
+ if (TEK4014_ACTIVE(term)) {
+ TekScreen *tekscr = &(tekWidget->screen);
+ flashWindow(screen, TWindow(tekscr), visualGC,
+ TFullWidth(tekscr),
+ TFullHeight(tekscr));
} else
#endif
{
@@ -599,7 +891,7 @@ HandleBellPropertyChange(Widget w GCC_UNUSED,
XEvent * ev,
Boolean * more GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
if (ev->xproperty.atom == XA_NOTICE) {
screen->bellInProgress = False;
@@ -695,15 +987,16 @@ dabbrev_expand(TScreen * screen)
static int x, y;
static char *dabbrev_hint = 0, *lastexpansion = 0;
+ static unsigned int expansions;
char *expansion;
Char *copybuffer;
size_t hint_len;
- unsigned i;
unsigned del_cnt;
unsigned buf_cnt;
if (!screen->dabbrev_working) { /* initialize */
+ expansions = 0;
x = screen->cur_col;
y = screen->cur_row + screen->savelines;
@@ -722,7 +1015,16 @@ dabbrev_expand(TScreen * screen)
}
hint_len = strlen(dabbrev_hint);
- while ((expansion = dabbrev_prev_word(&x, &y, screen))) {
+ for (;;) {
+ if (!(expansion = dabbrev_prev_word(&x, &y, screen))) {
+ if (expansions >= 2) {
+ expansions = 0;
+ x = screen->cur_col;
+ y = screen->cur_row + screen->savelines;
+ continue;
+ }
+ break;
+ }
if (!strncmp(dabbrev_hint, expansion, hint_len) && /* empty hint matches everything */
strlen(expansion) > hint_len && /* trivial expansion disallowed */
strcmp(expansion, lastexpansion)) /* different from previous */
@@ -735,9 +1037,7 @@ dabbrev_expand(TScreen * screen)
buf_cnt = del_cnt + strlen(expansion) - hint_len;
if (!(copybuffer = TypeMallocN(Char, buf_cnt)))
return 0;
- for (i = 0; i < del_cnt; i++) { /* delete previous expansion */
- copybuffer[i] = screen->dabbrev_erase_char;
- }
+ memset(copybuffer, screen->dabbrev_erase_char, del_cnt); /* delete previous expansion */
memmove(copybuffer + del_cnt,
expansion + hint_len,
strlen(expansion) - hint_len);
@@ -749,6 +1049,7 @@ dabbrev_expand(TScreen * screen)
lastexpansion = strdup(expansion);
if (!lastexpansion)
return 0;
+ expansions++;
return 1;
}
@@ -759,10 +1060,12 @@ HandleDabbrevExpand(Widget gw,
String * params GCC_UNUSED,
Cardinal *nparams GCC_UNUSED)
{
- XtermWidget w = (XtermWidget) gw;
- TScreen *screen = &w->screen;
- if (!dabbrev_expand(screen))
- Bell(XkbBI_TerminalBell, 0);
+ if (IsXtermWidget(gw)) {
+ XtermWidget w = (XtermWidget) gw;
+ TScreen *screen = &w->screen;
+ if (!dabbrev_expand(screen))
+ Bell(XkbBI_TerminalBell, 0);
+ }
}
#endif /* OPT_DABBREV */
@@ -775,7 +1078,7 @@ HandleDeIconify(Widget gw,
Cardinal *nparams GCC_UNUSED)
{
if (IsXtermWidget(gw)) {
- TScreen *screen = &((XtermWidget) gw)->screen;
+ TScreen *screen = TScreenOf((XtermWidget) gw);
XMapWindow(screen->display, VShellWindow);
}
}
@@ -788,7 +1091,7 @@ HandleIconify(Widget gw,
Cardinal *nparams GCC_UNUSED)
{
if (IsXtermWidget(gw)) {
- TScreen *screen = &((XtermWidget) gw)->screen;
+ TScreen *screen = TScreenOf((XtermWidget) gw);
XIconifyWindow(screen->display,
VShellWindow,
DefaultScreen(screen->display));
@@ -942,9 +1245,11 @@ HandleRestoreSize(Widget gw,
void
Redraw(void)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
XExposeEvent event;
+ TRACE(("Redraw\n"));
+
event.type = Expose;
event.display = screen->display;
event.x = 0;
@@ -964,8 +1269,9 @@ Redraw(void)
}
}
#if OPT_TEK4014
- if (TWindow(screen) && screen->Tshow) {
- event.window = TWindow(screen);
+ if (TEK4014_SHOWN(term)) {
+ TekScreen *tekscr = &(tekWidget->screen);
+ event.window = TWindow(tekscr);
event.width = tekWidget->core.width;
event.height = tekWidget->core.height;
TekExpose((Widget) tekWidget, (XEvent *) & event, NULL);
@@ -1074,8 +1380,8 @@ creat_as(uid_t uid, gid_t gid, Bool append, char *pathname, int mode)
#endif /* HAVE_WAITPID */
TRACE(("creat_as(uid=%d/%d, gid=%d/%d, append=%d, pathname=%s, mode=%#o)\n",
- uid, geteuid(),
- gid, getegid(),
+ (int) uid, (int) geteuid(),
+ (int) gid, (int) getegid(),
append,
pathname,
mode));
@@ -1173,7 +1479,7 @@ xtermResetIds(TScreen * screen)
static SIGNAL_T
logpipe(int sig GCC_UNUSED)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
#ifdef SYSV
(void) signal(SIGPIPE, SIG_IGN);
@@ -1223,7 +1529,7 @@ StartLog(TScreen * screen)
sizeof(yyyy_mm_dd_hh_mm_ss),
"%Y.%m.%d.%H.%M.%S", ltm) > 0)) {
(void) sprintf(log_def_name, "Xterm.log.%.255s.%.20s.%d",
- hostname, yyyy_mm_dd_hh_mm_ss, getpid());
+ hostname, yyyy_mm_dd_hh_mm_ss, (int) getpid());
}
if ((log_default = x_strdup(log_def_name)) == NULL)
return;
@@ -1268,7 +1574,7 @@ StartLog(TScreen * screen)
close(ConnectionNumber(screen->display));
close(screen->respond);
- if ((((cp = getenv("SHELL")) == NULL || *cp == 0)
+ if ((((cp = x_getenv("SHELL")) == NULL)
&& ((pw = getpwuid(screen->uid)) == NULL
|| *(cp = pw->pw_shell) == 0))
|| (shell = CastMallocN(char, strlen(cp))) == 0) {
@@ -1364,107 +1670,141 @@ ReportAnsiColorRequest(XtermWidget xw, int colornum, int final)
color.red,
color.green,
color.blue);
- unparseputc1(xw, OSC);
+ unparseputc1(xw, ANSI_OSC);
unparseputs(xw, buffer);
unparseputc1(xw, final);
unparse_end(xw);
}
-/*
-* Find closest color for "def" in "cmap".
-* Set "def" to the resulting color.
-* Based on Monish Shah's "find_closest_color()" for Vim 6.0,
-* modified with ideas from David Tong's "noflash" library.
-* Return False if not able to find or allocate a color.
-*/
static int
-find_closest_color(Display * display, Colormap cmap, XColor * def)
+getColormapSize(Display * display)
{
- double tmp, distance, closestDistance;
- int closest, numFound;
- XColor *colortable;
+ int result;
+ int numFound;
XVisualInfo myTemplate, *visInfoPtr;
- char *found;
- unsigned i;
- unsigned cmap_size;
- unsigned attempts;
myTemplate.visualid = XVisualIDFromVisual(DefaultVisual(display,
XDefaultScreen(display)));
visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask,
&myTemplate, &numFound);
- if (numFound < 1) {
- /* FindClosestColor couldn't lookup visual */
- return False;
- }
+ result = (numFound >= 1) ? visInfoPtr->colormap_size : 0;
- cmap_size = visInfoPtr->colormap_size;
XFree((char *) visInfoPtr);
- colortable = TypeMallocN(XColor, cmap_size);
- if (!colortable) {
- return False; /* out of memory */
- }
- found = TypeCallocN(char, cmap_size);
- if (!found) {
- free(colortable);
- return False; /* out of memory */
- }
+ return result;
+}
- for (i = 0; i < cmap_size; i++) {
- colortable[i].pixel = (unsigned long) i;
- }
- XQueryColors(display, cmap, colortable, (int) cmap_size);
+/*
+ * Find closest color for "def" in "cmap".
+ * Set "def" to the resulting color.
+ *
+ * Based on Monish Shah's "find_closest_color()" for Vim 6.0,
+ * modified with ideas from David Tong's "noflash" library.
+ * The code from Vim in turn was derived from FindClosestColor() in Tcl/Tk.
+ *
+ * These provide some introduction:
+ * http://en.wikipedia.org/wiki/YIQ
+ * for an introduction to YIQ weights.
+ * http://en.wikipedia.org/wiki/Luminance_(video)
+ * for a discussion of luma.
+ * http://en.wikipedia.org/wiki/YUV
+ *
+ * Return False if not able to find or allocate a color.
+ */
+static Boolean
+find_closest_color(Display * dpy, Colormap cmap, XColor * def)
+{
+ Boolean result = False;
+ XColor *colortable;
+ char *tried;
+ double diff, thisRGB, bestRGB;
+ unsigned attempts;
+ unsigned bestInx;
+ unsigned cmap_size;
+ unsigned i;
+
+ cmap_size = getColormapSize(dpy);
+ if (cmap_size != 0) {
+
+ colortable = TypeMallocN(XColor, cmap_size);
+ if (colortable != 0) {
+
+ tried = TypeCallocN(char, cmap_size);
+ if (tried != 0) {
+
+ for (i = 0; i < cmap_size; i++) {
+ colortable[i].pixel = (unsigned long) i;
+ }
+ XQueryColors(dpy, cmap, colortable, (int) cmap_size);
- /*
- * Find the color that best approximates the desired one, then
- * try to allocate that color. If that fails, it must mean that
- * the color was read-write (so we can't use it, since its owner
- * might change it) or else it was already freed. Try again,
- * over and over again, until something succeeds.
- */
- for (attempts = 0; attempts < cmap_size; attempts++) {
- closestDistance = 1e30;
- closest = 0;
- for (i = 0; i < cmap_size; i++) {
- if (!found[closest]) {
/*
- * Use Euclidean distance in RGB space, weighted by Y (of YIQ)
- * as the objective function; this accounts for differences
- * in the color sensitivity of the eye.
+ * Try (possibly each entry in the color map) to find the best
+ * approximation to the requested color.
*/
- tmp = .30 * (((int) def->red) - (int) colortable[i].red);
- distance = tmp * tmp;
- tmp = .61 * (((int) def->green) - (int) colortable[i].green);
- distance += tmp * tmp;
- tmp = .11 * (((int) def->blue) - (int) colortable[i].blue);
- distance += tmp * tmp;
- if (distance < closestDistance) {
- closest = i;
- closestDistance = distance;
+ for (attempts = 0; attempts < cmap_size; attempts++) {
+ Boolean first = True;
+
+ bestRGB = 0.0;
+ bestInx = 0;
+ for (i = 0; i < cmap_size; i++) {
+ if (!tried[bestInx]) {
+ /*
+ * Look for the best match based on luminance.
+ * Measure this by the least-squares difference of
+ * the weighted R/G/B components from the color map
+ * versus the requested color. Use the Y (luma)
+ * component of the YIQ color space model for
+ * weights that correspond to the luminance.
+ */
+#define AddColorWeight(weight, color) \
+ diff = weight * (int) ((def->color) - colortable[i].color); \
+ thisRGB = diff * diff
+
+ AddColorWeight(0.30, red);
+ AddColorWeight(0.61, green);
+ AddColorWeight(0.11, blue);
+
+ if (first || (thisRGB < bestRGB)) {
+ first = False;
+ bestInx = i;
+ bestRGB = thisRGB;
+ }
+ }
+ }
+ if (XAllocColor(dpy, cmap, &colortable[bestInx]) != 0) {
+ *def = colortable[bestInx];
+ result = True;
+ break;
+ }
+ /*
+ * It failed - either the color map entry was readonly, or
+ * another client has allocated the entry. Mark the entry
+ * so we will ignore it
+ */
+ tried[bestInx] = True;
}
+ free(tried);
}
+ free(colortable);
}
- if (XAllocColor(display, cmap, &colortable[closest]) != 0) {
- *def = colortable[closest];
- break;
- }
- found[closest] = True; /* Don't look at this entry again */
- }
-
- free(colortable);
- free(found);
- if (attempts < cmap_size) {
- return True; /* Got a closest matching color */
- } else {
- return False; /* Couldn't allocate a near match */
}
+ return result;
}
-static Bool
+/*
+ * Allocate a color for the "ANSI" colors. That actually includes colors up
+ * to 256.
+ *
+ * Returns
+ * -1 on error
+ * 0 on no change
+ * 1 if a new color was allocated.
+ */
+static int
AllocateAnsiColor(XtermWidget xw,
ColorRes * res,
char *spec)
{
+ int result;
XColor def;
TScreen *screen = &xw->screen;
Colormap cmap = xw->core.colormap;
@@ -1472,16 +1812,28 @@ AllocateAnsiColor(XtermWidget xw,
if (XParseColor(screen->display, cmap, spec, &def)
&& (XAllocColor(screen->display, cmap, &def)
|| find_closest_color(screen->display, cmap, &def))) {
- SET_COLOR_RES(res, def.pixel);
- TRACE(("AllocateAnsiColor[%d] %s (pixel %#lx)\n",
- (res - screen->Acolors), spec, def.pixel));
+ if (
#if OPT_COLOR_RES
- res->mode = True;
+ res->mode == True &&
#endif
- return (True);
+ EQL_COLOR_RES(res, def.pixel)) {
+ result = 0;
+ } else {
+ result = 1;
+ SET_COLOR_RES(res, def.pixel);
+ TRACE(("AllocateAnsiColor[%d] %s (pixel %#lx)\n",
+ (res - screen->Acolors), spec, def.pixel));
+#if OPT_COLOR_RES
+ if (!res->mode)
+ result = 0;
+ res->mode = True;
+#endif
+ }
+ } else {
+ TRACE(("AllocateAnsiColor %s (failed)\n", spec));
+ result = -1;
}
- TRACE(("AllocateAnsiColor %s (failed)\n", spec));
- return (False);
+ return (result);
}
#if OPT_COLOR_RES
@@ -1499,7 +1851,7 @@ xtermGetColorRes(ColorRes * res)
if (res >= term->screen.Acolors) {
assert(res - term->screen.Acolors < MAXCOLORS);
- if (!AllocateAnsiColor(term, res, res->resource)) {
+ if (AllocateAnsiColor(term, res, res->resource) < 0) {
res->value = term->screen.Tcolors[TEXT_FG].value;
res->mode = -True;
fprintf(stderr,
@@ -1523,7 +1875,8 @@ ChangeAnsiColorRequest(XtermWidget xw,
{
char *name;
int color;
- int r = False;
+ int repaint = False;
+ int code;
TRACE(("ChangeAnsiColorRequest string='%s'\n", buf));
@@ -1545,17 +1898,22 @@ ChangeAnsiColorRequest(XtermWidget xw,
ReportAnsiColorRequest(xw, color, final);
else {
TRACE(("ChangeAnsiColor for Acolors[%d]\n", color));
- if (!AllocateAnsiColor(xw, &(xw->screen.Acolors[color]), name))
+ code = AllocateAnsiColor(xw, &(xw->screen.Acolors[color]), name);
+ if (code < 0) {
+ /* stop on any error */
break;
+ } else if (code > 0) {
+ repaint = True;
+ }
/* FIXME: free old color somehow? We aren't for the other color
* change style (dynamic colors).
*/
- r = True;
}
}
- if (r)
- ChangeAnsiColors(xw);
- return (r);
+ if (repaint)
+ xtermRepaint(xw);
+
+ return (repaint);
}
#else
#define find_closest_color(display, cmap, def) 0
@@ -1616,7 +1974,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final)
if (!strcmp(buf, "?")) {
TRACE(("Getting selection\n"));
- unparseputc1(xw, OSC);
+ unparseputc1(xw, ANSI_OSC);
unparseputs(xw, "52");
unparseputc(xw, ';');
@@ -1642,6 +2000,278 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final)
/***====================================================================***/
+static Bool
+xtermIsPrintable(TScreen * screen, Char ** bufp, Char * last)
+{
+ Bool result = False;
+ Char *cp = *bufp;
+ Char *next = cp;
+
+ (void) screen;
+ (void) last;
+
+#if OPT_WIDE_CHARS
+ if (xtermEnvUTF8() && screen->utf8_title) {
+ PtyData data;
+
+ if (decodeUtf8(fakePtyData(&data, cp, last))) {
+ if (data.utf_data != UCS_REPL
+ && (data.utf_data >= 128 ||
+ ansi_table[data.utf_data] == CASE_PRINT)) {
+ next += (data.utf_size - 1);
+ result = True;
+ } else {
+ result = False;
+ }
+ } else {
+ result = False;
+ }
+ } else
+#endif
+#if OPT_C1_PRINT
+ if (screen->c1_printable
+ && (*cp >= 128 && *cp < 160)) {
+ result = True;
+ } else
+#endif
+ if (ansi_table[*cp] == CASE_PRINT) {
+ result = True;
+ }
+ *bufp = next;
+ return result;
+}
+
+/***====================================================================***/
+
+/*
+ * Enum corresponding to the actual OSC codes rather than the internal
+ * array indices.
+ */
+typedef enum {
+ OSC_TEXT_FG = 10
+ ,OSC_TEXT_BG
+ ,OSC_TEXT_CURSOR
+ ,OSC_MOUSE_FG
+ ,OSC_MOUSE_BG
+#if OPT_TEK4014
+ ,OSC_TEK_FG = 15
+ ,OSC_TEK_BG
+#endif
+#if OPT_HIGHLIGHT_COLOR
+ ,OSC_HIGHLIGHT_BG = 17
+#endif
+#if OPT_TEK4014
+ ,OSC_TEK_CURSOR = 18
+#endif
+#if OPT_HIGHLIGHT_COLOR
+ ,OSC_HIGHLIGHT_FG = 19
+#endif
+ ,OSC_NCOLORS
+} OscTextColors;
+
+static ScrnColors *pOldColors = NULL;
+
+static Bool
+GetOldColors(XtermWidget xw)
+{
+ int i;
+ if (pOldColors == NULL) {
+ pOldColors = (ScrnColors *) XtMalloc(sizeof(ScrnColors));
+ if (pOldColors == NULL) {
+ fprintf(stderr, "allocation failure in GetOldColors\n");
+ return (False);
+ }
+ pOldColors->which = 0;
+ for (i = 0; i < NCOLORS; i++) {
+ pOldColors->colors[i] = 0;
+ pOldColors->names[i] = NULL;
+ }
+ GetColors(xw, pOldColors);
+ }
+ return (True);
+}
+
+static int
+oppositeColor(int n)
+{
+ switch (n) {
+ case TEXT_FG:
+ n = TEXT_BG;
+ break;
+ case TEXT_BG:
+ n = TEXT_FG;
+ break;
+ case MOUSE_FG:
+ n = MOUSE_BG;
+ break;
+ case MOUSE_BG:
+ n = MOUSE_FG;
+ break;
+#if OPT_TEK4014
+ case TEK_FG:
+ n = TEK_BG;
+ break;
+ case TEK_BG:
+ n = TEK_FG;
+ break;
+#endif
+#if OPT_HIGHLIGHT_COLOR
+ case HIGHLIGHT_FG:
+ n = HIGHLIGHT_BG;
+ break;
+ case HIGHLIGHT_BG:
+ n = HIGHLIGHT_FG;
+ break;
+#endif
+ default:
+ break;
+ }
+ return n;
+}
+
+static void
+ReportColorRequest(XtermWidget xw, int ndx, int final)
+{
+ XColor color;
+ Colormap cmap = xw->core.colormap;
+ char buffer[80];
+
+ /*
+ * ChangeColorsRequest() has "always" chosen the opposite color when
+ * reverse-video is set. Report this as the original color index, but
+ * reporting the opposite color which would be used.
+ */
+ int i = (xw->misc.re_verse) ? oppositeColor(ndx) : ndx;
+
+ GetOldColors(xw);
+ color.pixel = pOldColors->colors[ndx];
+ XQueryColor(xw->screen.display, cmap, &color);
+ sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10,
+ color.red,
+ color.green,
+ color.blue);
+ TRACE(("ReportColors %d: %#lx as %s\n", ndx, pOldColors->colors[ndx], buffer));
+ unparseputc1(xw, ANSI_OSC);
+ unparseputs(xw, buffer);
+ unparseputc1(xw, final);
+ unparse_end(xw);
+}
+
+static Bool
+UpdateOldColors(XtermWidget xw GCC_UNUSED, ScrnColors * pNew)
+{
+ int i;
+
+ /* if we were going to free old colors, this would be the place to
+ * do it. I've decided not to (for now), because it seems likely
+ * that we'd have a small set of colors we use over and over, and that
+ * we could save some overhead this way. The only case in which this
+ * (clearly) fails is if someone is trying a boatload of colors, in
+ * which case they can restart xterm
+ */
+ for (i = 0; i < NCOLORS; i++) {
+ if (COLOR_DEFINED(pNew, i)) {
+ if (pOldColors->names[i] != NULL) {
+ XtFree(pOldColors->names[i]);
+ pOldColors->names[i] = NULL;
+ }
+ if (pNew->names[i]) {
+ pOldColors->names[i] = pNew->names[i];
+ }
+ pOldColors->colors[i] = pNew->colors[i];
+ }
+ }
+ return (True);
+}
+
+/*
+ * OSC codes are constant, but the indices for the color arrays depend on how
+ * xterm is compiled.
+ */
+static int
+OscToColorIndex(OscTextColors mode)
+{
+ int result = 0;
+
+#define CASE(name) case OSC_##name: result = name; break
+ switch (mode) {
+ CASE(TEXT_FG);
+ CASE(TEXT_BG);
+ CASE(TEXT_CURSOR);
+ CASE(MOUSE_FG);
+ CASE(MOUSE_BG);
+#if OPT_TEK4014
+ CASE(TEK_FG);
+ CASE(TEK_BG);
+#endif
+#if OPT_HIGHLIGHT_COLOR
+ CASE(HIGHLIGHT_BG);
+ CASE(HIGHLIGHT_FG);
+#endif
+#if OPT_TEK4014
+ CASE(TEK_CURSOR);
+#endif
+ case OSC_NCOLORS:
+ break;
+ }
+ return result;
+}
+
+static Bool
+ChangeColorsRequest(XtermWidget xw,
+ int start,
+ char *names,
+ int final)
+{
+ Bool result = False;
+ char *thisName;
+ ScrnColors newColors;
+ int i, ndx;
+
+ TRACE(("ChangeColorsRequest start=%d, names='%s'\n", start, names));
+
+ if (GetOldColors(xw)) {
+ newColors.which = 0;
+ for (i = 0; i < NCOLORS; i++) {
+ newColors.names[i] = NULL;
+ }
+ for (i = start; i < OSC_NCOLORS; i++) {
+ ndx = OscToColorIndex((OscTextColors) i);
+ if (xw->misc.re_verse)
+ ndx = oppositeColor(ndx);
+
+ if ((names == NULL) || (names[0] == '\0')) {
+ newColors.names[ndx] = NULL;
+ } else {
+ if (names[0] == ';')
+ thisName = NULL;
+ else
+ thisName = names;
+ names = strchr(names, ';');
+ if (names != NULL) {
+ *names++ = '\0';
+ }
+ if (thisName != 0 && !strcmp(thisName, "?")) {
+ ReportColorRequest(xw, ndx, final);
+ } else if (!pOldColors->names[ndx]
+ || (thisName
+ && strcmp(thisName, pOldColors->names[ndx]))) {
+ AllocateTermColor(xw, &newColors, ndx, thisName);
+ }
+ }
+ }
+
+ if (newColors.which != 0) {
+ ChangeColors(xw, &newColors);
+ UpdateOldColors(xw, &newColors);
+ }
+ result = True;
+ }
+ return result;
+}
+
+/***====================================================================***/
+
void
do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
{
@@ -1685,19 +2315,12 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
state = 3;
/* FALLTHRU */
default:
- if (ansi_table[CharOf(*cp)] != CASE_PRINT) {
+ if (!xtermIsPrintable(screen, &cp, oscbuf + len)) {
switch (mode) {
case 0:
case 1:
case 2:
-#if OPT_WIDE_CHARS
- /*
- * If we're running with UTF-8, it is possible for title
- * strings to contain "nonprinting" text.
- */
- if (xtermEnvUTF8())
-#endif
- break;
+ break;
default:
TRACE(("do_osc found nonprinting char %02X offset %d\n",
CharOf(*cp),
@@ -1712,16 +2335,16 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
switch (mode) {
case 0: /* new icon name and title */
- Changename(buf);
- Changetitle(buf);
+ ChangeIconName(buf);
+ ChangeTitle(buf);
break;
case 1: /* new icon name only */
- Changename(buf);
+ ChangeIconName(buf);
break;
case 2: /* new title only */
- Changetitle(buf);
+ ChangeTitle(buf);
break;
case 3: /* change X property */
@@ -1732,21 +2355,21 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
ChangeAnsiColorRequest(xw, buf, final);
break;
#endif
- case 10 + TEXT_FG:
- case 10 + TEXT_BG:
- case 10 + TEXT_CURSOR:
- case 10 + MOUSE_FG:
- case 10 + MOUSE_BG:
+ case OSC_TEXT_FG:
+ case OSC_TEXT_BG:
+ case OSC_TEXT_CURSOR:
+ case OSC_MOUSE_FG:
+ case OSC_MOUSE_BG:
#if OPT_HIGHLIGHT_COLOR
- case 10 + HIGHLIGHT_BG:
+ case OSC_HIGHLIGHT_BG:
#endif
#if OPT_TEK4014
- case 10 + TEK_FG:
- case 10 + TEK_BG:
- case 10 + TEK_CURSOR:
+ case OSC_TEK_FG:
+ case OSC_TEK_BG:
+ case OSC_TEK_CURSOR:
#endif
if (xw->misc.dynamicColors)
- ChangeColorsRequest(xw, mode - 10, buf, final);
+ ChangeColorsRequest(xw, mode, buf, final);
break;
case 30:
@@ -1777,10 +2400,11 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
#endif /* ALLOWLOGGING */
case 50:
+#if OPT_SHIFT_FONTS
if (buf != 0 && !strcmp(buf, "?")) {
int num = screen->menu_font_number;
- unparseputc1(xw, OSC);
+ unparseputc1(xw, ANSI_OSC);
unparseputs(xw, "50");
if ((buf = screen->MenuFontName(num)) != 0) {
@@ -1790,6 +2414,7 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
unparseputc1(xw, final);
unparse_end(xw);
} else if (buf != 0) {
+ int num = screen->menu_font_number;
VTFontNames fonts;
memset(&fonts, 0, sizeof(fonts));
@@ -1800,7 +2425,6 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
* corresponding menu font entry.
*/
if (*buf == '#') {
- int num = screen->menu_font_number;
int rel = 0;
if (*++buf == '+') {
@@ -1823,20 +2447,24 @@ do_osc(XtermWidget xw, Char * oscbuf, unsigned len GCC_UNUSED, int final)
num = 0;
}
- if (rel != 0)
- num = lookupRelativeFontSize(screen,
+ if (rel != 0) {
+ num = lookupRelativeFontSize(xw,
screen->menu_font_number, rel);
+ }
if (num < 0
|| num > fontMenu_lastBuiltin
|| (buf = screen->MenuFontName(num)) == 0) {
Bell(XkbBI_MinorError, 0);
break;
}
+ } else {
+ num = fontMenu_fontescape;
}
fonts.f_n = buf;
- SetVTFont(xw, fontMenu_fontescape, True, &fonts);
+ SetVTFont(xw, num, True, &fonts);
}
+#endif /* OPT_SHIFT_FONTS */
break;
case 51:
/* reserved for Emacs shell (Rob Mayoff <mayoff@dqd.com>) */
@@ -2003,7 +2631,7 @@ parse_decdld(ANSI * params, char *string)
len = 0;
while (*string != '\0') {
ch = CharOf(*string++);
- if (ch >= 0x20 && ch <= 0x2f) {
+ if (ch >= ANSI_SPA && ch <= 0x2f) {
if (len < 2)
DscsName[len++] = ch;
} else if (ch >= 0x30 && ch <= 0x7e) {
@@ -2185,16 +2813,16 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
} else
okay = False;
- unparseputc1(xw, DCS);
+ unparseputc1(xw, ANSI_DCS);
unparseputc(xw, okay ? '1' : '0');
unparseputc(xw, '$');
unparseputc(xw, 'r');
if (okay)
cp = reply;
unparseputs(xw, cp);
- unparseputc1(xw, ST);
+ unparseputc1(xw, ANSI_ST);
} else {
- unparseputc(xw, CAN);
+ unparseputc(xw, ANSI_CAN);
}
break;
#if OPT_TCAP_QUERY
@@ -2207,7 +2835,7 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
char *tmp;
char *parsed = ++cp;
- unparseputc1(xw, DCS);
+ unparseputc1(xw, ANSI_DCS);
code = xtermcapKeycode(xw, &parsed, &state, &fkey);
@@ -2227,11 +2855,22 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
unparseputc(xw, '=');
screen->tc_query_code = code;
screen->tc_query_fkey = fkey;
+#if OPT_ISO_COLORS
/* XK_COLORS is a fake code for the "Co" entry (maximum
* number of colors) */
if (code == XK_COLORS) {
unparseputn(xw, NUM_ANSI_COLORS);
- } else {
+ } else
+#endif
+#if OPT_TCAP_FKEYS
+ /*
+ * First ensure that we handle the extended cursor- and
+ * editing-keypad keys.
+ */
+ if ((code <= XK_Fn(MAX_FKEY))
+ || xtermcapString(xw, CodeToXkey(code), 0) == 0)
+#endif
+ {
XKeyEvent event;
event.state = state;
Input(xw, &event, False);
@@ -2248,7 +2887,7 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
code = xtermcapKeycode(xw, &parsed, &state, &fkey);
}
}
- unparseputc1(xw, ST);
+ unparseputc1(xw, ANSI_ST);
}
break;
#endif
@@ -2285,17 +2924,22 @@ ChangeGroup(String attribute, char *value)
#if OPT_WIDE_CHARS
static Char *converted; /* NO_LEAKS */
#endif
+ static char empty[1];
+
Arg args[1];
- char *original = (value != 0) ? value : "";
+ char *original = (value != 0) ? value : empty;
char *name = original;
- TScreen *screen = &term->screen;
- Widget w = CURRENT_EMU(screen);
+ TScreen *screen = TScreenOf(term);
+ Widget w = CURRENT_EMU();
Widget top = SHELL_OF(w);
unsigned limit = strlen(name);
+ Char *c1 = (Char *) original;
+ Char *cp;
TRACE(("ChangeGroup(attribute=%s, value=%s)\n", attribute, name));
- (void) screen;
+ if (!screen->allowTitleOps)
+ return;
/*
* Ignore titles that are too long to be plausible requests.
@@ -2303,6 +2947,13 @@ ChangeGroup(String attribute, char *value)
if (limit >= 1024)
return;
+ for (cp = c1; *cp != 0; ++cp) {
+ Char *c2 = cp;
+ if (!xtermIsPrintable(screen, &cp, c1 + limit)) {
+ memset(c2, '?', (unsigned) (cp + 1 - c2));
+ }
+ }
+
#if OPT_WIDE_CHARS
/*
* Title strings are limited to ISO-8859-1, which is consistent with the
@@ -2337,7 +2988,7 @@ ChangeGroup(String attribute, char *value)
#if OPT_SAME_NAME
/* If the attribute isn't going to change, then don't bother... */
- if (sameName) {
+ if (resource.sameName) {
char *buf;
XtSetArg(args[0], attribute, &buf);
XtGetValues(top, args, 1);
@@ -2348,6 +2999,7 @@ ChangeGroup(String attribute, char *value)
#endif /* OPT_SAME_NAME */
TRACE(("...updating %s\n", attribute));
+ TRACE(("...value is %s\n", name));
XtSetArg(args[0], attribute, name);
XtSetValues(top, args, 1);
@@ -2355,12 +3007,14 @@ ChangeGroup(String attribute, char *value)
if (xtermEnvUTF8()) {
Display *dpy = XtDisplay(term);
Atom my_atom;
- char *propname = (!strcmp(attribute, XtNtitle)
- ? "_NET_WM_NAME"
- : "_NET_WM_ICON_NAME");
+
+ const char *propname = (!strcmp(attribute, XtNtitle)
+ ? "_NET_WM_NAME"
+ : "_NET_WM_ICON_NAME");
if ((my_atom = XInternAtom(dpy, propname, False)) != None) {
- if (screen->utf8_title) {
+ if (screen->utf8_title) { /* FIXME - redundant? */
TRACE(("...updating %s\n", propname));
+ TRACE(("...value is %s\n", original));
XChangeProperty(dpy, VShellWindow,
my_atom, XA_UTF8_STRING(dpy), 8,
PropModeReplace,
@@ -2375,15 +3029,15 @@ ChangeGroup(String attribute, char *value)
}
void
-Changename(char *name)
+ChangeIconName(char *name)
{
if (name == 0)
name = "";
#if OPT_ZICONBEEP /* If warning should be given then give it */
- if (zIconBeep && zIconBeep_flagged) {
+ if (resource.zIconBeep && term->screen.zIconBeep_flagged) {
char *newname = CastMallocN(char, strlen(name) + 4);
if (!newname) {
- fprintf(stderr, "malloc failed in Changename\n");
+ fprintf(stderr, "malloc failed in ChangeIconName\n");
return;
}
strcpy(newname, "*** ");
@@ -2396,7 +3050,7 @@ Changename(char *name)
}
void
-Changetitle(char *name)
+ChangeTitle(char *name)
{
ChangeGroup(XtNtitle, name);
}
@@ -2429,113 +3083,6 @@ ChangeXprop(char *buf)
/***====================================================================***/
-static ScrnColors *pOldColors = NULL;
-
-static Bool
-GetOldColors(XtermWidget xw)
-{
- int i;
- if (pOldColors == NULL) {
- pOldColors = (ScrnColors *) XtMalloc(sizeof(ScrnColors));
- if (pOldColors == NULL) {
- fprintf(stderr, "allocation failure in GetOldColors\n");
- return (False);
- }
- pOldColors->which = 0;
- for (i = 0; i < NCOLORS; i++) {
- pOldColors->colors[i] = 0;
- pOldColors->names[i] = NULL;
- }
- GetColors(xw, pOldColors);
- }
- return (True);
-}
-
-static int
-oppositeColor(int n)
-{
- switch (n) {
- case TEXT_FG:
- n = TEXT_BG;
- break;
- case TEXT_BG:
- n = TEXT_FG;
- break;
- case MOUSE_FG:
- n = MOUSE_BG;
- break;
- case MOUSE_BG:
- n = MOUSE_FG;
- break;
-#if OPT_TEK4014
- case TEK_FG:
- n = TEK_BG;
- break;
- case TEK_BG:
- n = TEK_FG;
- break;
-#endif
- default:
- break;
- }
- return n;
-}
-
-static void
-ReportColorRequest(XtermWidget xw, int ndx, int final)
-{
- XColor color;
- Colormap cmap = xw->core.colormap;
- char buffer[80];
-
- /*
- * ChangeColorsRequest() has "always" chosen the opposite color when
- * reverse-video is set. Report this as the original color index, but
- * reporting the opposite color which would be used.
- */
- int i = (xw->misc.re_verse) ? oppositeColor(ndx) : ndx;
-
- GetOldColors(xw);
- color.pixel = pOldColors->colors[ndx];
- XQueryColor(xw->screen.display, cmap, &color);
- sprintf(buffer, "%d;rgb:%04x/%04x/%04x", i + 10,
- color.red,
- color.green,
- color.blue);
- TRACE(("ReportColors %d: %#lx as %s\n", ndx, pOldColors->colors[ndx], buffer));
- unparseputc1(xw, OSC);
- unparseputs(xw, buffer);
- unparseputc1(xw, final);
- unparse_end(xw);
-}
-
-static Bool
-UpdateOldColors(XtermWidget xw GCC_UNUSED, ScrnColors * pNew)
-{
- int i;
-
- /* if we were going to free old colors, this would be the place to
- * do it. I've decided not to (for now), because it seems likely
- * that we'd have a small set of colors we use over and over, and that
- * we could save some overhead this way. The only case in which this
- * (clearly) fails is if someone is trying a boatload of colors, in
- * which case they can restart xterm
- */
- for (i = 0; i < NCOLORS; i++) {
- if (COLOR_DEFINED(pNew, i)) {
- if (pOldColors->names[i] != NULL) {
- XtFree(pOldColors->names[i]);
- pOldColors->names[i] = NULL;
- }
- if (pNew->names[i]) {
- pOldColors->names[i] = pNew->names[i];
- }
- pOldColors->colors[i] = pNew->colors[i];
- }
- }
- return (True);
-}
-
/*
* This is part of ReverseVideo(). It reverses the data stored for the old
* "dynamic" colors that might have been retrieved using OSC 10-18.
@@ -2601,67 +3148,9 @@ AllocateTermColor(XtermWidget xw,
TRACE(("AllocateTermColor #%d: %s (failed)\n", ndx, name));
return (False);
}
-
-static Bool
-ChangeColorsRequest(XtermWidget xw,
- int start,
- char *names,
- int final)
-{
- char *thisName;
- ScrnColors newColors;
- int i, ndx;
-
- TRACE(("ChangeColorsRequest start=%d, names='%s'\n", start, names));
-
- if ((pOldColors == NULL)
- && (!GetOldColors(xw))) {
- return (False);
- }
- newColors.which = 0;
- for (i = 0; i < NCOLORS; i++) {
- newColors.names[i] = NULL;
- }
- for (i = start; i < NCOLORS; i++) {
- if (xw->misc.re_verse)
- ndx = oppositeColor(i);
- else
- ndx = i;
- if ((names == NULL) || (names[0] == '\0')) {
- newColors.names[ndx] = NULL;
- } else {
- if (names[0] == ';')
- thisName = NULL;
- else
- thisName = names;
- names = strchr(names, ';');
- if (names != NULL) {
- *names = '\0';
- names++;
- }
- if (thisName != 0 && !strcmp(thisName, "?"))
- ReportColorRequest(xw, ndx, final);
- else if (!pOldColors->names[ndx]
- || (thisName
- && strcmp(thisName, pOldColors->names[ndx]))) {
- AllocateTermColor(xw, &newColors, ndx, thisName);
- }
- }
- }
-
- if (newColors.which == 0)
- return (True);
-
- ChangeColors(xw, &newColors);
- UpdateOldColors(xw, &newColors);
- return (True);
-}
-
/***====================================================================***/
-#ifndef DEBUG
/* ARGSUSED */
-#endif
void
Panic(char *s GCC_UNUSED, int a GCC_UNUSED)
{
@@ -2675,100 +3164,91 @@ Panic(char *s GCC_UNUSED, int a GCC_UNUSED)
#endif /* DEBUG */
}
-char *
-SysErrorMsg(int n)
+const char *
+SysErrorMsg(int code)
{
static char unknown[] = "unknown error";
- char *s = strerror(n);
+ char *s = strerror(code);
return s ? s : unknown;
}
-void
-SysError(int i)
+const char *
+SysReasonMsg(int code)
{
- static const char *table[] =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ,"main: ioctl() failed on FIONBIO" /* 11 */
- ,"main: ioctl() failed on F_GETFL" /* 12 */
- ,"main: ioctl() failed on F_SETFL" /* 13 */
- ,"spawn: open() failed on /dev/tty" /* 14 */
- ,"spawn: ioctl() failed on TIOCGETP" /* 15 */
- ,0
- ,"spawn: ptsname() failed" /* 17 */
- ,"spawn: open() failed on ptsname" /* 18 */
- ,"spawn: ioctl() failed on I_PUSH/\"ptem\"" /* 19 */
- ,"spawn: ioctl() failed on I_PUSH/\"consem\"" /* 20 */
- ,"spawn: ioctl() failed on I_PUSH/\"ldterm\"" /* 21 */
- ,"spawn: ioctl() failed on I_PUSH/\"ttcompat\"" /* 22 */
- ,"spawn: ioctl() failed on TIOCSETP" /* 23 */
- ,"spawn: ioctl() failed on TIOCSETC" /* 24 */
- ,"spawn: ioctl() failed on TIOCSETD" /* 25 */
- ,"spawn: ioctl() failed on TIOCSLTC" /* 26 */
- ,"spawn: ioctl() failed on TIOCLSET" /* 27 */
- ,"spawn: initgroups() failed" /* 28 */
- ,"spawn: fork() failed" /* 29 */
- ,"spawn: exec() failed" /* 30 */
- ,0
- ,"get_pty: not enough ptys" /* 32 */
- ,0
- ,"waiting for initial map" /* 34 */
- ,"spawn: setuid() failed" /* 35 */
- ,"spawn: can't initialize window" /* 36 */
- ,0, 0, 0, 0, 0, 0, 0, 0, 0
- ,"spawn: ioctl() failed on TIOCKSET" /* 46 */
- ,"spawn: ioctl() failed on TIOCKSETC" /* 47 */
- ,"spawn: realloc of ttydev failed" /* 48 */
- ,"luit: command-line malloc failed" /* 49 */
- ,"in_put: select() failed" /* 50 */
- ,0, 0, 0
- ,"VTInit: can't initialize window" /* 54 */
- ,0, 0
- ,"HandleKeymapChange: malloc failed" /* 57 */
- ,0, 0
- ,"Tinput: select() failed" /* 60 */
- ,0, 0, 0
- ,"TekInit: can't initialize window" /* 64 */
- ,0, 0, 0, 0, 0, 0
- ,"SaltTextAway: malloc() failed" /* 71 */
- ,0, 0, 0, 0, 0, 0, 0, 0
- ,"StartLog: exec() failed" /* 80 */
- ,0, 0
- ,"xerror: XError event" /* 83 */
- ,"xioerror: X I/O error" /* 84 */
- ,0, 0, 0, 0, 0
- ,"Alloc: calloc() failed on base" /* 90 */
- ,"Alloc: calloc() failed on rows" /* 91 */
- ,"ScreenResize: realloc() failed on alt base" /* 92 */
- ,0, 0, 0
- ,"ScreenResize: malloc() or realloc() failed" /* 96 */
- ,0, 0, 0, 0, 0
- ,"ScrnPointers: malloc/realloc() failed" /* 102 */
- ,0, 0, 0, 0, 0, 0, 0
- ,"ScrollBarOn: realloc() failed on base" /* 110 */
- ,"ScrollBarOn: realloc() failed on rows" /* 111 */
- ,0, 0, 0, 0, 0, 0, 0, 0, 0
- ,"my_memmove: malloc/realloc failed" /* 121 */
+ /* *INDENT-OFF* */
+ static const struct {
+ int code;
+ const char *name;
+ } table[] = {
+ { ERROR_FIONBIO, "main: ioctl() failed on FIONBIO" },
+ { ERROR_F_GETFL, "main: ioctl() failed on F_GETFL" },
+ { ERROR_F_SETFL, "main: ioctl() failed on F_SETFL", },
+ { ERROR_OPDEVTTY, "spawn: open() failed on /dev/tty", },
+ { ERROR_TIOCGETP, "spawn: ioctl() failed on TIOCGETP", },
+ { ERROR_PTSNAME, "spawn: ptsname() failed", },
+ { ERROR_OPPTSNAME, "spawn: open() failed on ptsname", },
+ { ERROR_PTEM, "spawn: ioctl() failed on I_PUSH/\"ptem\"" },
+ { ERROR_CONSEM, "spawn: ioctl() failed on I_PUSH/\"consem\"" },
+ { ERROR_LDTERM, "spawn: ioctl() failed on I_PUSH/\"ldterm\"" },
+ { ERROR_TTCOMPAT, "spawn: ioctl() failed on I_PUSH/\"ttcompat\"" },
+ { ERROR_TIOCSETP, "spawn: ioctl() failed on TIOCSETP" },
+ { ERROR_TIOCSETC, "spawn: ioctl() failed on TIOCSETC" },
+ { ERROR_TIOCSETD, "spawn: ioctl() failed on TIOCSETD" },
+ { ERROR_TIOCSLTC, "spawn: ioctl() failed on TIOCSLTC" },
+ { ERROR_TIOCLSET, "spawn: ioctl() failed on TIOCLSET" },
+ { ERROR_INIGROUPS, "spawn: initgroups() failed" },
+ { ERROR_FORK, "spawn: fork() failed" },
+ { ERROR_EXEC, "spawn: exec() failed" },
+ { ERROR_PTYS, "get_pty: not enough ptys" },
+ { ERROR_PTY_EXEC, "waiting for initial map" },
+ { ERROR_SETUID, "spawn: setuid() failed" },
+ { ERROR_INIT, "spawn: can't initialize window" },
+ { ERROR_TIOCKSET, "spawn: ioctl() failed on TIOCKSET" },
+ { ERROR_TIOCKSETC, "spawn: ioctl() failed on TIOCKSETC" },
+ { ERROR_SPREALLOC, "spawn: realloc of ttydev failed" },
+ { ERROR_LUMALLOC, "luit: command-line malloc failed" },
+ { ERROR_SELECT, "in_put: select() failed" },
+ { ERROR_VINIT, "VTInit: can't initialize window" },
+ { ERROR_KMMALLOC1, "HandleKeymapChange: malloc failed" },
+ { ERROR_TSELECT, "Tinput: select() failed" },
+ { ERROR_TINIT, "TekInit: can't initialize window" },
+ { ERROR_BMALLOC2, "SaltTextAway: malloc() failed" },
+ { ERROR_LOGEXEC, "StartLog: exec() failed" },
+ { ERROR_XERROR, "xerror: XError event" },
+ { ERROR_XIOERROR, "xioerror: X I/O error" },
+ { ERROR_SCALLOC, "Alloc: calloc() failed on base" },
+ { ERROR_SCALLOC2, "Alloc: calloc() failed on rows" },
+ { ERROR_SREALLOC, "ScreenResize: realloc() failed on alt base" },
+ { ERROR_RESIZE, "ScreenResize: malloc() or realloc() failed" },
+ { ERROR_SAVE_PTR, "ScrnPointers: malloc/realloc() failed" },
+ { ERROR_SBRALLOC, "ScrollBarOn: realloc() failed on base" },
+ { ERROR_SBRALLOC2, "ScrollBarOn: realloc() failed on rows" },
+ { ERROR_MMALLOC, "my_memmove: malloc/realloc failed" },
};
- int oerrno;
+ /* *INDENT-ON* */
- oerrno = errno;
- fprintf(stderr, "%s: Error %d, errno %d: ", xterm_name, i, oerrno);
- fprintf(stderr, "%s\n", SysErrorMsg(oerrno));
- if ((Cardinal) i < XtNumber(table) && table[i] != 0) {
- fprintf(stderr, "Reason: %s\n", table[i]);
+ Cardinal n;
+ const char *result = "?";
+
+ for (n = 0; n < XtNumber(table); ++n) {
+ if (code == table[n].code) {
+ result = table[n].name;
+ break;
+ }
}
- Cleanup(i);
+ return result;
}
-static void
-Sleep(int msec)
+void
+SysError(int code)
{
- static struct timeval select_timeout;
+ int oerrno = errno;
- select_timeout.tv_sec = 0;
- select_timeout.tv_usec = msec * 1000;
- select(0, 0, 0, 0, &select_timeout);
+ fprintf(stderr, "%s: Error %d, errno %d: ", xterm_name, code, oerrno);
+ fprintf(stderr, "%s\n", SysErrorMsg(oerrno));
+ fprintf(stderr, "Reason: %s\n", SysReasonMsg(code));
+
+ Cleanup(code);
}
/*
@@ -2778,7 +3258,7 @@ void
Cleanup(int code)
{
static Bool cleaning;
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
/*
* Process "-hold" and session cleanup only for a normal exit.
@@ -2790,7 +3270,7 @@ Cleanup(int code)
}
cleaning = True;
- need_cleanup = FALSE;
+ need_cleanup = False;
TRACE(("Cleanup %d\n", code));
@@ -2828,8 +3308,8 @@ xtermFindShell(char *leaf, Bool warning)
TRACE(("xtermFindShell(%s)\n", leaf));
if (*result != '\0' && strchr("+/-", *result) == 0) {
/* find it in $PATH */
- if ((s = getenv("PATH")) != 0) {
- if ((tmp = TypeMallocN(char, strlen(leaf) + strlen(s) + 1)) != 0) {
+ if ((s = x_getenv("PATH")) != 0) {
+ if ((tmp = TypeMallocN(char, strlen(leaf) + strlen(s) + 2)) != 0) {
Bool found = False;
while (*s != '\0') {
strcpy(tmp, s);
@@ -2871,6 +3351,26 @@ xtermFindShell(char *leaf, Bool warning)
}
#endif /* VMS */
+#define ENV_HUNK(n) ((((n) + 1) | 31) + 1)
+
+/*
+ * copy the environment before Setenv'ing.
+ */
+void
+xtermCopyEnv(char **oldenv)
+{
+ unsigned size;
+ char **newenv;
+
+ for (size = 0; oldenv[size] != NULL; size++) {
+ ;
+ }
+
+ newenv = TypeCallocN(char *, ENV_HUNK(size));
+ memmove(newenv, oldenv, size * sizeof(char *));
+ environ = newenv;
+}
+
/*
* sets the value of var to be arg in the Unix 4.2 BSD environment env.
* Var should end with '=' (bindings are of the form "var=value").
@@ -2882,28 +3382,48 @@ void
xtermSetenv(char *var, char *value)
{
if (value != 0) {
+ char *test;
int envindex = 0;
size_t len = strlen(var);
+ int found = -1;
- TRACE(("xtermSetenv(var=%s, value=%s)\n", var, value));
+ TRACE(("xtermSetenv(%s=%s)\n", var, value));
- while (environ[envindex] != NULL) {
- if (strncmp(environ[envindex], var, len) == 0) {
- /* found it */
- environ[envindex] = CastMallocN(char, len + strlen(value));
- strcpy(environ[envindex], var);
- strcat(environ[envindex], value);
- return;
+ while ((test = environ[envindex]) != NULL) {
+ if (strncmp(test, var, len) == 0 && test[len] == '=') {
+ found = envindex;
+ break;
}
envindex++;
}
- TRACE(("...expanding env to %d\n", envindex + 1));
+ if (found < 0) {
+ unsigned need = ENV_HUNK(envindex + 1);
+ unsigned have = ENV_HUNK(envindex);
+
+ if (need > have) {
+ char **newenv;
+ newenv = TypeMallocN(char *, need);
+ if (newenv == 0) {
+ fprintf(stderr, "Cannot increase environment\n");
+ return;
+ }
+ memmove(newenv, environ, have * sizeof(*newenv));
+ free(environ);
+ environ = newenv;
+ }
+
+ found = envindex;
+ environ[found + 1] = NULL;
+ environ = environ;
+ }
- environ[envindex] = CastMallocN(char, len + strlen(value));
- (void) strcpy(environ[envindex], var);
- strcat(environ[envindex], value);
- environ[++envindex] = NULL;
+ environ[found] = CastMallocN(char, 1 + len + strlen(value));
+ if (environ[found] == 0) {
+ fprintf(stderr, "Cannot allocate environment %s\n", var);
+ return;
+ }
+ sprintf(environ[found], "%s=%s", var, value);
}
}
@@ -2935,14 +3455,12 @@ xioerror(Display * dpy)
void
xt_error(String message)
{
- char *ptr;
-
(void) fprintf(stderr, "%s Xt error: %s\n", ProgramName, message);
/*
* Check for the obvious - Xt does a poor job of reporting this.
*/
- if ((ptr = getenv("DISPLAY")) == 0 || *x_strtrim(ptr) == '\0') {
+ if (x_getenv("DISPLAY") == 0) {
fprintf(stderr, "%s: DISPLAY is not set\n", ProgramName);
}
exit(1);
@@ -2974,7 +3492,7 @@ withdraw_window(Display * dpy, Window w, int scr)
void
set_vt_visibility(Bool on)
{
- TScreen *screen = &term->screen;
+ TScreen *screen = TScreenOf(term);
TRACE(("set_vt_visibility(%d)\n", on));
if (on) {
@@ -3011,11 +3529,10 @@ set_vt_visibility(Bool on)
void
set_tek_visibility(Bool on)
{
- TScreen *screen = &term->screen;
-
TRACE(("set_tek_visibility(%d)\n", on));
+
if (on) {
- if (!screen->Tshow && (tekWidget || TekInit())) {
+ if (!TEK4014_SHOWN(term) && (tekWidget || TekInit())) {
Widget tekParent = SHELL_OF(tekWidget);
XtRealizeWidget(tekParent);
XtMapWidget(XtParent(tekWidget));
@@ -3030,14 +3547,14 @@ set_tek_visibility(Bool on)
(void) XSetWMProtocols(XtDisplay(tekParent),
XtWindow(tekParent),
&wm_delete_window, 1);
- screen->Tshow = True;
+ TEK4014_SHOWN(term) = True;
}
} else {
- if (screen->Tshow && tekWidget) {
+ if (TEK4014_SHOWN(term) && tekWidget) {
withdraw_window(XtDisplay(tekWidget),
TShellWindow,
XScreenNumberOfScreen(XtScreen(tekWidget)));
- screen->Tshow = False;
+ TEK4014_SHOWN(term) = False;
}
}
set_tekhide_sensitivity();
@@ -3051,10 +3568,8 @@ set_tek_visibility(Bool on)
void
end_tek_mode(void)
{
- TScreen *screen = &term->screen;
-
- if (screen->TekEmu) {
- FlushLog(screen);
+ if (TEK4014_ACTIVE(term)) {
+ FlushLog(&(term->screen));
longjmp(Tekend, 1);
}
return;
@@ -3063,11 +3578,9 @@ end_tek_mode(void)
void
end_vt_mode(void)
{
- TScreen *screen = &term->screen;
-
- if (!screen->TekEmu) {
- FlushLog(screen);
- screen->TekEmu = True;
+ if (!TEK4014_ACTIVE(term)) {
+ FlushLog(&(term->screen));
+ TEK4014_ACTIVE(term) = True;
longjmp(VTend, 1);
}
return;
@@ -3077,8 +3590,8 @@ void
switch_modes(Bool tovt) /* if true, then become vt mode */
{
if (tovt) {
- if (TekRefresh)
- dorefresh();
+ if (tekRefreshList)
+ TekRefresh(tekWidget);
end_tek_mode(); /* WARNING: this does a longjmp... */
} else {
end_vt_mode(); /* WARNING: this does a longjmp... */
@@ -3088,21 +3601,17 @@ switch_modes(Bool tovt) /* if true, then become vt mode */
void
hide_vt_window(void)
{
- TScreen *screen = &term->screen;
-
set_vt_visibility(False);
- if (!screen->TekEmu)
+ if (!TEK4014_ACTIVE(term))
switch_modes(False); /* switch to tek mode */
}
void
hide_tek_window(void)
{
- TScreen *screen = &term->screen;
-
set_tek_visibility(False);
- TekRefresh = (TekLink *) 0;
- if (screen->TekEmu)
+ tekRefreshList = (TekLink *) 0;
+ if (TEK4014_ACTIVE(term))
switch_modes(True); /* does longjmp to vt mode */
}
#endif /* OPT_TEK4014 */
@@ -3170,8 +3679,12 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs)
sortedOptDescs(descs, numDescs);
free(opt_array);
opt_array = 0;
- } else if (options != 0 && descs != 0)
+ return 0;
+ } else if (options == 0 || descs == 0) {
+ return 0;
+ }
#endif
+
if (opt_array == 0) {
Cardinal opt_count, j;
#if OPT_TRACE
@@ -3250,7 +3763,7 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs)
}
/*
- * Report the locale that xterm was started in.
+ * Report the character-type locale that xterm was started in.
*/
char *
xtermEnvLocale(void)
@@ -3258,10 +3771,9 @@ xtermEnvLocale(void)
static char *result;
if (result == 0) {
- if ((result = getenv("LC_ALL")) == 0 || *result == '\0')
- if ((result = getenv("LC_CTYPE")) == 0 || *result == '\0')
- if ((result = getenv("LANG")) == 0 || *result == '\0')
- result = "";
+ if ((result = x_nonempty(setlocale(LC_CTYPE, 0))) == 0) {
+ result = "C";
+ }
TRACE(("xtermEnvLocale ->%s\n", result));
}
return result;
@@ -3277,7 +3789,7 @@ xtermEnvEncoding(void)
result = nl_langinfo(CODESET);
#else
char *locale = xtermEnvLocale();
- if (*locale == 0 || !strcmp(locale, "C") || !strcmp(locale, "POSIX")) {
+ if (!strcmp(locale, "C") || !strcmp(locale, "POSIX")) {
result = "ASCII";
} else {
result = "ISO-8859-1";
diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c
index 055e51c82..2f6ebfa53 100644
--- a/app/xterm/ptydata.c
+++ b/app/xterm/ptydata.c
@@ -1,4 +1,4 @@
-/* $XTermId: ptydata.c,v 1.79 2008/02/21 22:19:03 tom Exp $ */
+/* $XTermId: ptydata.c,v 1.80 2008/04/20 22:41:25 tom Exp $ */
/*
* $XFree86: xc/programs/xterm/ptydata.c,v 1.25 2006/02/13 01:14:59 dickey Exp $
@@ -6,7 +6,7 @@
/************************************************************
-Copyright 1999-2006,2007 by Thomas E. Dickey
+Copyright 1999-2007,2008 by Thomas E. Dickey
All Rights Reserved
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index 692b0443c..717584d54 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.513 2008/02/25 00:05:13 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.517 2008/07/27 19:38:00 tom Exp $ */
/*
* Copyright 1999-2007,2008 by Thomas E. Dickey
@@ -1380,7 +1380,7 @@ typedef struct {
*/
int base64_accu;
int base64_count;
- int base64_pad;
+ unsigned base64_pad;
#endif
#if OPT_READLINE
unsigned click1_moves;
@@ -1510,6 +1510,7 @@ typedef struct {
ScrnBuf allbuf; /* screen buffer (may include
lines scrolled off top) */
Char *sbuf_address; /* main screen memory address */
+ Boolean is_running; /* true when buffers are legal */
/*
* Data for the alternate buffer.
*/
@@ -1839,6 +1840,7 @@ typedef struct
#if OPT_MOD_FKEYS
TModify modify_now; /* current modifier value */
TModify modify_1st; /* original modifier value, for resets */
+ int format_keys; /* format of modifyOtherKeys */
#endif
} TKeyboard;
@@ -2241,7 +2243,6 @@ typedef struct Tek_Link
/***====================================================================***/
#if OPT_TRACE
-#include <trace.h>
#undef NDEBUG /* turn on assert's */
#else
#ifndef NDEBUG
@@ -2249,6 +2250,8 @@ typedef struct Tek_Link
#endif
#endif
+#include <trace.h>
+
#ifndef TRACE
#define TRACE(p) /*nothing*/
#endif
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index 4049e03d8..9c6714af7 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,7 +1,7 @@
-/* $XTermId: screen.c,v 1.208 2006/07/23 22:06:22 tom Exp $ */
+/* $XTermId: screen.c,v 1.241 2008/04/20 21:07:10 tom Exp $ */
/*
- * Copyright 1999-2005,2006 by Thomas E. Dickey
+ * Copyright 1999-2007,2008 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -52,8 +52,6 @@
* SOFTWARE.
*/
-/* $XFree86: xc/programs/xterm/screen.c,v 3.77 2006/06/19 00:36:51 dickey Exp $ */
-
/* screen.c */
#include <stdio.h>
@@ -376,13 +374,72 @@ ChangeToWide(XtermWidget xw)
SwitchBufPtrs(screen);
update_font_utf8_mode();
- SetVTFont(xw, screen->menu_font_number, TRUE, NULL);
+ SetVTFont(xw, screen->menu_font_number, True, NULL);
}
TRACE(("...ChangeToWide\n"));
}
#endif
/*
+ * Clear cells, no side-effects.
+ */
+void
+ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
+{
+ if (len != 0) {
+ TScreen *screen = &(xw->screen);
+ flags |= TERM_COLOR_FLAGS(xw);
+
+ memset(SCRN_BUF_CHARS(screen, row) + col, ' ', len);
+ memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len);
+
+ if_OPT_EXT_COLORS(screen, {
+ memset(SCRN_BUF_FGRND(screen, row) + col,
+ xw->sgr_foreground, len);
+ memset(SCRN_BUF_BGRND(screen, row) + col,
+ xw->cur_background, len);
+ });
+ if_OPT_ISO_TRADITIONAL_COLORS(screen, {
+ memset(SCRN_BUF_COLOR(screen, row) + col,
+ (int) xtermColorPair(xw), len);
+ });
+ if_OPT_DEC_CHRSET({
+ memset(SCRN_BUF_CSETS(screen, row) + col,
+ curXtermChrSet(xw, row), len);
+ });
+ if_OPT_WIDE_CHARS(screen, {
+ int off;
+ for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
+ memset(SCREEN_PTR(screen, row, off) + col, 0, len);
+ }
+ });
+ }
+}
+
+/*
+ * Clear data in the screen-structure (no I/O).
+ * Check for wide-character damage as well, clearing the damaged cells.
+ */
+void
+ScrnClearCells(XtermWidget xw, int row, int col, unsigned len)
+{
+#if OPT_WIDE_CHARS
+ TScreen *screen = &(xw->screen);
+#endif
+ int flags = 0;
+
+ if_OPT_WIDE_CHARS(screen, {
+ int kl;
+ int kr;
+ if (DamagedCells(screen, len, &kl, &kr, INX2ROW(screen, row), col)
+ && kr >= kl) {
+ ClearCells(xw, flags, (unsigned) (kr - kl + 1), row, kl);
+ }
+ });
+ ClearCells(xw, flags, len, row, col);
+}
+
+/*
* Disown the selection and repaint the area that is highlighted so it is no
* longer highlighted.
*/
@@ -390,7 +447,11 @@ void
ScrnDisownSelection(XtermWidget xw)
{
if (ScrnHaveSelection(&(xw->screen))) {
- DisownSelection(xw);
+ if (xw->screen.keepSelection) {
+ UnhiliteSelection(xw);
+ } else {
+ DisownSelection(xw);
+ }
}
}
@@ -399,11 +460,11 @@ ScrnDisownSelection(XtermWidget xw)
* to match flags.
*/
void
-ScreenWrite(XtermWidget xw,
- PAIRED_CHARS(Char * str, Char * str2),
- unsigned flags,
- unsigned cur_fg_bg,
- unsigned length)
+ScrnWriteText(XtermWidget xw,
+ PAIRED_CHARS(Char * str, Char * str2),
+ unsigned flags,
+ unsigned cur_fg_bg,
+ unsigned length)
{
TScreen *screen = &(xw->screen);
#if OPT_ISO_COLORS
@@ -420,7 +481,6 @@ ScreenWrite(XtermWidget xw,
Char *attrs;
int avail = MaxCols(screen) - screen->cur_col;
Char *chars;
- int wrappedbit;
#if OPT_WIDE_CHARS
Char starcol1, starcol2;
#endif
@@ -449,8 +509,6 @@ ScreenWrite(XtermWidget xw,
cb = SCRN_BUF_CSETS(screen, screen->cur_row) + screen->cur_col;
});
- wrappedbit = ScrnTstWrapped(screen, screen->cur_row);
-
#if OPT_WIDE_CHARS
starcol1 = *chars;
starcol2 = chars[length - 1];
@@ -481,16 +539,14 @@ ScreenWrite(XtermWidget xw,
char2 = SCRN_BUF_WIDEC(screen, screen->cur_row);
char2 += screen->cur_col;
if (screen->cur_col && starcol1 == HIDDEN_LO && *char2 == HIDDEN_HI
- && iswide(char1[-1] | (char2[-1] << 8))) {
+ && iswide(PACK_PAIR(char1, char2, -1))) {
char1[-1] = ERROR_1;
char2[-1] = ERROR_2;
}
/* if we are overwriting the right hand half of a
wide character, make the other half vanish */
while (length) {
- int ch = *str;
- if (str2)
- ch |= *str2 << 8;
+ int ch = PACK_PAIR(str, str2, 0);
*char1 = *str;
char1++;
@@ -521,21 +577,19 @@ ScreenWrite(XtermWidget xw,
}
/* if we are overwriting the left hand half of a
wide character, make the other half vanish */
- }
-
- else {
+ } else {
if ((char2 = SCRN_BUF_WIDEC(screen, screen->cur_row)) != 0) {
char2 += screen->cur_col;
if (screen->cur_col && starcol1 == HIDDEN_LO && *char2 == HIDDEN_HI
- && iswide(chars[-1] | (char2[-1] << 8))) {
+ && iswide(PACK_PAIR(chars, char2, -1))) {
chars[-1] = ERROR_1;
char2[-1] = ERROR_2;
}
/* if we are overwriting the right hand half of a
wide character, make the other half vanish */
if (chars[length] == HIDDEN_LO && char2[length] == HIDDEN_HI &&
- iswide(starcol2 | (char2[length - 1] << 8))) {
+ iswide(PACK_PAIR(chars, char2, length - 1))) {
chars[length] = ERROR_1;
char2[length] = ERROR_2;
}
@@ -563,8 +617,8 @@ ScreenWrite(XtermWidget xw,
}
});
if_OPT_EXT_COLORS(screen, {
- memset(fbf, (Char) (cur_fg_bg >> 8), real_width);
- memset(fbb, (Char) (cur_fg_bg & 0xff), real_width);
+ memset(fbf, (int) ExtractForeground(cur_fg_bg), real_width);
+ memset(fbb, (int) ExtractBackground(cur_fg_bg), real_width);
});
if_OPT_ISO_TRADITIONAL_COLORS(screen, {
memset(fb, (int) cur_fg_bg, real_width);
@@ -573,11 +627,6 @@ ScreenWrite(XtermWidget xw,
memset(cb, curXtermChrSet(xw, screen->cur_row), real_width);
});
- if (wrappedbit)
- ScrnSetWrapped(screen, screen->cur_row);
- else
- ScrnClrWrapped(screen, screen->cur_row);
-
if_OPT_WIDE_CHARS(screen, {
screen->last_written_col = screen->cur_col + real_width - 1;
screen->last_written_row = screen->cur_row;
@@ -740,19 +789,18 @@ ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where,
void
ScrnInsertChar(XtermWidget xw, unsigned n)
{
+#define Target (data + col + n)
+#define Source (data + col)
+
TScreen *screen = &(xw->screen);
ScrnBuf sb = screen->visbuf;
- unsigned last = MaxCols(screen);
+ int last = MaxCols(screen);
int row = screen->cur_row;
- unsigned col = screen->cur_col;
- unsigned i;
- Char *ptr = BUF_CHARS(sb, row);
- Char *attrs = BUF_ATTRS(sb, row);
- int wrappedbit = ScrnTstWrapped(screen, row);
- int flags = CHARDRAWN | TERM_COLOR_FLAGS(xw);
+ int col = screen->cur_col;
+ Char *data;
size_t nbytes;
- if (last <= (col + n)) {
+ if (last <= (int) (col + n)) {
if (last <= col)
return;
n = last - col;
@@ -762,51 +810,52 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
assert(n > 0);
- assert(last > n);
-
- ScrnClrWrapped(screen, row); /* make sure the bit isn't moved */
- for (i = last - 1; i >= col + n; i--) {
- unsigned j = i - n;
- assert(i >= n);
- ptr[i] = ptr[j];
- attrs[i] = attrs[j];
- }
+ assert(last > (int) n);
+
+ if_OPT_WIDE_CHARS(screen, {
+ int xx = INX2ROW(screen, screen->cur_row);
+ int kl;
+ int kr = screen->cur_col;
+ if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
+ ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
+ }
+ kr = screen->max_col - n + 1;
+ if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
+ ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
+ }
+ });
+
+ data = BUF_CHARS(sb, row);
+ memmove(Target, Source, nbytes);
+
+ data = BUF_ATTRS(sb, row);
+ memmove(Target, Source, nbytes);
- for (i = col; i < col + n; i++)
- ptr[i] = ' ';
- for (i = col; i < col + n; i++)
- attrs[i] = flags;
if_OPT_EXT_COLORS(screen, {
- ptr = BUF_FGRND(sb, row);
- memmove(ptr + col + n, ptr + col, nbytes);
- memset(ptr + col, xw->sgr_foreground, n);
- ptr = BUF_BGRND(sb, row);
- memmove(ptr + col + n, ptr + col, nbytes);
- memset(ptr + col, xw->cur_background, n);
+ data = BUF_FGRND(sb, row);
+ memmove(Target, Source, nbytes);
+ data = BUF_BGRND(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_ISO_TRADITIONAL_COLORS(screen, {
- ptr = BUF_COLOR(sb, row);
- memmove(ptr + col + n, ptr + col, nbytes);
- memset(ptr + col, (int) xtermColorPair(xw), n);
+ data = BUF_COLOR(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_DEC_CHRSET({
- ptr = BUF_CSETS(sb, row);
- memmove(ptr + col + n, ptr + col, nbytes);
- memset(ptr + col, curXtermChrSet(xw, row), n);
+ data = BUF_CSETS(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_WIDE_CHARS(screen, {
int off;
for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
- ptr = BUFFER_PTR(sb, row, off);
- memmove(ptr + col + n, ptr + col, nbytes);
- memset(ptr + col, 0, n);
+ data = BUFFER_PTR(sb, row, off);
+ memmove(Target, Source, nbytes);
}
});
+ ClearCells(xw, CHARDRAWN, n, row, col);
- if (wrappedbit)
- ScrnSetWrapped(screen, row);
- else
- ScrnClrWrapped(screen, row);
+#undef Source
+#undef Target
}
/*
@@ -815,16 +864,18 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
void
ScrnDeleteChar(XtermWidget xw, unsigned n)
{
+#define Target (data + col)
+#define Source (data + col + n)
+
TScreen *screen = &(xw->screen);
ScrnBuf sb = screen->visbuf;
- unsigned last = MaxCols(screen);
- unsigned row = screen->cur_row;
- unsigned col = screen->cur_col;
- Char *ptr = BUF_CHARS(sb, row);
- Char *attrs = BUF_ATTRS(sb, row);
+ int last = MaxCols(screen);
+ int row = screen->cur_row;
+ int col = screen->cur_col;
+ Char *data;
size_t nbytes;
- if (last <= (col + n)) {
+ if (last <= (int) (col + n)) {
if (last <= col)
return;
n = last - col;
@@ -834,40 +885,49 @@ ScrnDeleteChar(XtermWidget xw, unsigned n)
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
assert(n > 0);
- assert(last > n);
+ assert(last > (int) n);
+
+ if_OPT_WIDE_CHARS(screen, {
+ int kl;
+ int kr;
+ if (DamagedCells(screen, n, &kl, &kr,
+ INX2ROW(screen, screen->cur_row),
+ screen->cur_col))
+ ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
+ });
+
+ data = BUF_CHARS(sb, row);
+ memmove(Target, Source, nbytes);
- memmove(ptr + col, ptr + col + n, nbytes);
- memmove(attrs + col, attrs + col + n, nbytes);
- bzero(ptr + last - n, n);
- memset(attrs + last - n, (Char) (TERM_COLOR_FLAGS(xw)), n);
+ data = BUF_ATTRS(sb, row);
+ memmove(Target, Source, nbytes);
if_OPT_EXT_COLORS(screen, {
- ptr = BUF_FGRND(sb, row);
- memmove(ptr + col, ptr + col + n, nbytes);
- memset(ptr + last - n, xw->sgr_foreground, n);
- ptr = BUF_BGRND(sb, row);
- memmove(ptr + col, ptr + col + n, nbytes);
- memset(ptr + last - n, xw->cur_background, n);
+ data = BUF_FGRND(sb, row);
+ memmove(Target, Source, nbytes);
+ data = BUF_BGRND(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_ISO_TRADITIONAL_COLORS(screen, {
- ptr = BUF_COLOR(sb, row);
- memmove(ptr + col, ptr + col + n, nbytes);
- memset(ptr + last - n, (int) xtermColorPair(xw), n);
+ data = BUF_COLOR(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_DEC_CHRSET({
- ptr = BUF_CSETS(sb, row);
- memmove(ptr + col, ptr + col + n, nbytes);
- memset(ptr + last - n, curXtermChrSet(xw, row), n);
+ data = BUF_CSETS(sb, row);
+ memmove(Target, Source, nbytes);
});
if_OPT_WIDE_CHARS(screen, {
int off;
for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
- ptr = BUFFER_PTR(sb, row, off);
- memmove(ptr + col, ptr + col + n, nbytes);
- memset(ptr + last - n, 0, n);
+ data = BUFFER_PTR(sb, row, off);
+ memmove(Target, Source, nbytes);
}
});
+ ClearCells(xw, 0, n, row, (int) (last - n));
ScrnClrWrapped(screen, row);
+
+#undef Source
+#undef Target
}
/*
@@ -975,8 +1035,8 @@ ScrnRefresh(XtermWidget xw,
/* adjust to redraw all of a widechar if we just wanted
to draw the right hand half */
if (leftcol > 0 &&
- (chars[leftcol] | (widec[leftcol] << 8)) == HIDDEN_CHAR &&
- iswide(chars[leftcol - 1] | (widec[leftcol - 1] << 8))) {
+ (PACK_PAIR(chars, widec, leftcol)) == HIDDEN_CHAR &&
+ iswide(PACK_PAIR(chars, widec, leftcol - 1))) {
leftcol--;
ncols++;
col = leftcol;
@@ -1078,7 +1138,7 @@ ScrnRefresh(XtermWidget xw,
flags = attrs[col];
#if OPT_WIDE_CHARS
if (widec)
- wideness = iswide(chars[col] | (widec[col] << 8));
+ wideness = iswide(PACK_PAIR(chars, widec, col));
else
wideness = 0;
#endif
@@ -1115,8 +1175,8 @@ ScrnRefresh(XtermWidget xw,
#endif
#if OPT_WIDE_CHARS
|| (widec
- && ((iswide(chars[col] | (widec[col] << 8))) != wideness)
- && !((chars[col] | (widec[col] << 8)) == HIDDEN_CHAR))
+ && ((iswide(PACK_PAIR(chars, widec, col))) != wideness)
+ && !((PACK_PAIR(chars, widec, col)) == HIDDEN_CHAR))
#endif
#if OPT_DEC_CHRSET
|| (cb[col] != cs)
@@ -1151,8 +1211,8 @@ ScrnRefresh(XtermWidget xw,
int my_x = CurCursorX(screen,
ROW2INX(screen, row),
i);
- int base = chars[i] | (widec[i] << 8);
- int combo = com_lo[i] | (com_hi[i] << 8);
+ int base = PACK_PAIR(chars, widec, i);
+ int combo = PACK_PAIR(com_lo, com_hi, i);
if (iswide(base))
my_x = CurCursorX(screen,
@@ -1194,7 +1254,7 @@ ScrnRefresh(XtermWidget xw,
});
#if OPT_WIDE_CHARS
if (widec)
- wideness = iswide(chars[col] | (widec[col] << 8));
+ wideness = iswide(PACK_PAIR(chars, widec, col));
#endif
gc = updatedXtermGC(xw, flags, fg_bg, hilite);
@@ -1237,8 +1297,8 @@ ScrnRefresh(XtermWidget xw,
int my_x = CurCursorX(screen,
ROW2INX(screen, row),
i);
- int base = chars[i] | (widec[i] << 8);
- int combo = com_lo[i] | (com_hi[i] << 8);
+ int base = PACK_PAIR(chars, widec, i);
+ int combo = PACK_PAIR(com_lo, com_hi, i);
if (iswide(base))
my_x = CurCursorX(screen,
@@ -1319,32 +1379,17 @@ ClearBufRows(XtermWidget xw,
int last)
{
TScreen *screen = &(xw->screen);
- ScrnBuf buf = screen->visbuf;
unsigned len = MaxCols(screen);
int row;
- int flags = TERM_COLOR_FLAGS(xw);
TRACE(("ClearBufRows %d..%d\n", first, last));
for (row = first; row <= last; row++) {
- ScrnClrWrapped(screen, row);
- bzero(BUF_CHARS(buf, row), len);
- memset(BUF_ATTRS(buf, row), flags, len);
- if_OPT_EXT_COLORS(screen, {
- memset(BUF_FGRND(buf, row), xw->sgr_foreground, len);
- memset(BUF_BGRND(buf, row), xw->cur_background, len);
- });
- if_OPT_ISO_TRADITIONAL_COLORS(screen, {
- memset(BUF_COLOR(buf, row), (int) xtermColorPair(xw), len);
- });
if_OPT_DEC_CHRSET({
- memset(BUF_CSETS(buf, row), 0, len);
- });
- if_OPT_WIDE_CHARS(screen, {
- int off;
- for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
- memset(BUFFER_PTR(buf, row, off), 0, len);
- }
+ /* clearing the whole row resets the doublesize characters */
+ SCRN_ROW_CSET(screen, row) = CSET_SWL;
});
+ ScrnClrWrapped(screen, row);
+ ClearCells(xw, 0, len, row, 0);
}
}
@@ -1373,7 +1418,7 @@ ScreenResize(XtermWidget xw,
TScreen *screen = &(xw->screen);
int code, rows, cols;
int border = 2 * screen->border;
- int move_down_by;
+ int move_down_by = 0;
#ifdef TTYSIZE_STRUCT
TTYSIZE_STRUCT ts;
#endif
@@ -1386,19 +1431,21 @@ ScreenResize(XtermWidget xw,
assert(width > 0);
assert(height > 0);
- /* clear the right and bottom internal border because of NorthWest
- gravity might have left junk on the right and bottom edges */
- if (width >= FullWidth(screen)) {
- XClearArea(screen->display, tw,
- FullWidth(screen), 0, /* right edge */
- 0, (unsigned) height, /* from top to bottom */
- False);
- }
- if (height >= FullHeight(screen)) {
- XClearArea(screen->display, tw,
- 0, FullHeight(screen), /* bottom */
- (unsigned) width, 0, /* all across the bottom */
- False);
+ if (screen->is_running) {
+ /* clear the right and bottom internal border because of NorthWest
+ gravity might have left junk on the right and bottom edges */
+ if (width >= FullWidth(screen)) {
+ XClearArea(screen->display, tw,
+ FullWidth(screen), 0, /* right edge */
+ 0, (unsigned) height, /* from top to bottom */
+ False);
+ }
+ if (height >= FullHeight(screen)) {
+ XClearArea(screen->display, tw,
+ 0, FullHeight(screen), /* bottom */
+ (unsigned) width, 0, /* all across the bottom */
+ False);
+ }
}
TRACE(("...computing rows/cols: %.2f %.2f\n",
@@ -1421,45 +1468,50 @@ ScreenResize(XtermWidget xw,
TRACE(("...ScreenResize chars %dx%d\n", rows, cols));
- if (screen->cursor_state)
- HideCursor();
- if (screen->alternate
- && xw->misc.resizeGravity == SouthWestGravity)
- /* swap buffer pointers back to make this work */
- SwitchBufPtrs(screen);
- if (screen->altbuf)
- (void) Reallocate(xw,
- &screen->altbuf,
- &screen->abuf_address,
- rows,
- cols,
- MaxRows(screen),
- MaxCols(screen));
- move_down_by = Reallocate(xw,
- &screen->allbuf,
- &screen->sbuf_address,
- rows + savelines, cols,
- MaxRows(screen) + savelines,
+ if (screen->is_running) {
+ if (screen->cursor_state)
+ HideCursor();
+ if (screen->alternate
+ && xw->misc.resizeGravity == SouthWestGravity)
+ /* swap buffer pointers back to make this work */
+ SwitchBufPtrs(screen);
+ if (screen->altbuf)
+ (void) Reallocate(xw,
+ &screen->altbuf,
+ &screen->abuf_address,
+ rows,
+ cols,
+ MaxRows(screen),
MaxCols(screen));
- screen->visbuf = &screen->allbuf[MAX_PTRS * savelines];
+ move_down_by = Reallocate(xw,
+ &screen->allbuf,
+ &screen->sbuf_address,
+ rows + savelines, cols,
+ MaxRows(screen) + savelines,
+ MaxCols(screen));
+ screen->visbuf = &screen->allbuf[MAX_PTRS * savelines];
+ }
+ AdjustSavedCursor(xw, move_down_by);
set_max_row(screen, screen->max_row + delta_rows);
set_max_col(screen, cols - 1);
- if (xw->misc.resizeGravity == SouthWestGravity) {
- screen->savedlines -= move_down_by;
- if (screen->savedlines < 0)
- screen->savedlines = 0;
- if (screen->savedlines > screen->savelines)
- screen->savedlines = screen->savelines;
- if (screen->topline < -screen->savedlines)
- screen->topline = -screen->savedlines;
- set_cur_row(screen, screen->cur_row + move_down_by);
- screen->cursorp.row += move_down_by;
- ScrollSelection(screen, move_down_by, True);
-
- if (screen->alternate)
- SwitchBufPtrs(screen); /* put the pointers back */
+ if (screen->is_running) {
+ if (xw->misc.resizeGravity == SouthWestGravity) {
+ screen->savedlines -= move_down_by;
+ if (screen->savedlines < 0)
+ screen->savedlines = 0;
+ if (screen->savedlines > screen->savelines)
+ screen->savedlines = screen->savelines;
+ if (screen->topline < -screen->savedlines)
+ screen->topline = -screen->savedlines;
+ set_cur_row(screen, screen->cur_row + move_down_by);
+ screen->cursorp.row += move_down_by;
+ ScrollSelection(screen, move_down_by, True);
+
+ if (screen->alternate)
+ SwitchBufPtrs(screen); /* put the pointers back */
+ }
}
/* adjust scrolling region */
@@ -1480,9 +1532,7 @@ ScreenResize(XtermWidget xw,
screen->fullVwin.fullheight = height;
screen->fullVwin.fullwidth = width;
- if (screen->scrollWidget)
- ResizeScrollBar(xw);
-
+ ResizeScrollBar(xw);
ResizeSelection(screen, rows, cols);
#ifndef NO_ACTIVE_ICON
@@ -1568,6 +1618,44 @@ non_blank_line(TScreen * screen,
}
/*
+ * Rectangle parameters start from one.
+ */
+#define minRectRow(screen) (getMinRow(screen) + 1)
+#define minRectCol(screen) (getMinCol(screen) + 1)
+#define maxRectRow(screen) (getMaxRow(screen) + 1)
+#define maxRectCol(screen) (getMaxCol(screen) + 1)
+
+static int
+limitedParseRow(XtermWidget xw, TScreen * screen, int row)
+{
+ int min_row = minRectRow(screen);
+ int max_row = maxRectRow(screen);
+
+ if (row < min_row)
+ row = min_row;
+ else if (row > max_row)
+ row = max_row;
+ return row;
+}
+
+static int
+limitedParseCol(XtermWidget xw, TScreen * screen, int col)
+{
+ int min_col = minRectCol(screen);
+ int max_col = maxRectCol(screen);
+
+ (void) xw;
+ if (col < min_col)
+ col = min_col;
+ else if (col > max_col)
+ col = max_col;
+ return col;
+}
+
+#define LimitedParse(num, func, dft) \
+ func(xw, screen, (nparams > num) ? params[num] : dft)
+
+/*
* Copy the rectangle boundaries into a struct, providing default values as
* needed.
*/
@@ -1577,10 +1665,10 @@ xtermParseRect(XtermWidget xw, int nparams, int *params, XTermRect * target)
TScreen *screen = &(xw->screen);
memset(target, 0, sizeof(*target));
- target->top = (nparams > 0) ? params[0] : getMinRow(screen) + 1;
- target->left = (nparams > 1) ? params[1] : getMinCol(screen) + 1;
- target->bottom = (nparams > 2) ? params[2] : getMaxRow(screen) + 1;
- target->right = (nparams > 3) ? params[3] : getMaxCol(screen) + 1;
+ target->top = LimitedParse(0, limitedParseRow, minRectRow(screen));
+ target->left = LimitedParse(1, limitedParseCol, minRectCol(screen));
+ target->bottom = LimitedParse(2, limitedParseRow, maxRectRow(screen));
+ target->right = LimitedParse(3, limitedParseCol, maxRectCol(screen));
TRACE(("parsed rectangle %d,%d %d,%d\n",
target->top,
target->left,
@@ -1594,41 +1682,74 @@ validRect(XtermWidget xw, XTermRect * target)
TScreen *screen = &(xw->screen);
TRACE(("comparing against screensize %dx%d\n",
- getMaxRow(screen) + 1,
- getMaxCol(screen) + 1));
+ maxRectRow(screen),
+ maxRectCol(screen)));
return (target != 0
- && target->top > getMinRow(screen)
- && target->left > getMinCol(screen)
+ && target->top >= minRectRow(screen)
+ && target->left >= minRectCol(screen)
&& target->top <= target->bottom
&& target->left <= target->right
- && target->top <= getMaxRow(screen) + 1
- && target->right <= getMaxCol(screen) + 1);
+ && target->top <= maxRectRow(screen)
+ && target->right <= maxRectCol(screen));
}
/*
- * Fills a rectangle with the given character and video-attributes.
+ * Fills a rectangle with the given 8-bit character and video-attributes.
+ * Colors and double-size attribute are unmodified.
*/
void
-ScrnFillRectangle(XtermWidget xw, XTermRect * target, int value, unsigned flags)
+ScrnFillRectangle(XtermWidget xw,
+ XTermRect * target,
+ int value,
+ unsigned flags,
+ Bool keepColors)
{
TScreen *screen = &(xw->screen);
- TRACE(("filling rectangle with '%c'\n", value));
+ TRACE(("filling rectangle with '%c' flags %#x\n", value, flags));
if (validRect(xw, target)) {
unsigned left = target->left - 1;
unsigned size = target->right - left;
Char attrs = flags;
- int row;
+ int row, col;
attrs &= ATTRIBUTES;
attrs |= CHARDRAWN;
for (row = target->bottom - 1; row >= (target->top - 1); row--) {
- TRACE(("filling %d [%d..%d]\n", row, left + 1, left + size));
- memset(SCRN_BUF_ATTRS(screen, row) + left, attrs, size);
+ TRACE(("filling %d [%d..%d]\n", row, left, left + size));
+
+ /*
+ * Fill attributes, preserving "protected" flag, as well as
+ * colors if asked.
+ */
+ for (col = left; col < target->right; ++col) {
+ Char temp = SCRN_BUF_ATTRS(screen, row)[col];
+ if (!keepColors) {
+ temp &= ~(FG_COLOR | BG_COLOR);
+ }
+ temp = attrs | (temp & (FG_COLOR | BG_COLOR | PROTECTED));
+ temp |= CHARDRAWN;
+ SCRN_BUF_ATTRS(screen, row)[col] = temp;
+#if OPT_ISO_COLORS
+ if (attrs & (FG_COLOR | BG_COLOR)) {
+ if_OPT_EXT_COLORS(screen, {
+ SCRN_BUF_FGRND(screen, row)[col] = xw->sgr_foreground;
+ SCRN_BUF_BGRND(screen, row)[col] = xw->cur_background;
+ });
+ if_OPT_ISO_TRADITIONAL_COLORS(screen, {
+ SCRN_BUF_COLOR(screen, row)[col] = xtermColorPair(xw);
+ });
+ }
+#endif
+ }
+
memset(SCRN_BUF_CHARS(screen, row) + left, (Char) value, size);
if_OPT_WIDE_CHARS(screen, {
- bzero(SCRN_BUF_WIDEC(screen, row) + left, size);
- });
+ int off;
+ for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
+ memset(SCREEN_PTR(screen, row, off) + left, 0, size);
+ }
+ })
}
ScrnUpdate(xw,
target->top - 1,
@@ -1661,24 +1782,17 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
XTermRect target;
xtermParseRect(xw,
((nparam > 3) ? 2 : (nparam - 1)),
- params + 1,
+ params,
&target);
if (validRect(xw, &target)) {
unsigned high = (source->bottom - source->top) + 1;
unsigned wide = (source->right - source->left) + 1;
- unsigned size = (high * wide);
- int row, col, n;
+ unsigned size = (high * wide * MAX_PTRS);
+ int row, col, n, j;
- Char *attrs = TypeMallocN(Char, size);
- Char *chars = TypeMallocN(Char, size);
+ Char *cells = TypeMallocN(Char, size);
-#if OPT_WIDE_CHARS
- Char *widec = TypeMallocN(Char, size);
- if (widec == 0)
- return;
-#endif
- if (attrs == 0
- || chars == 0)
+ if (cells == 0)
return;
TRACE(("OK - make copy %dx%d\n", high, wide));
@@ -1687,12 +1801,10 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
for (row = source->top - 1; row < source->bottom; ++row) {
for (col = source->left - 1; col < source->right; ++col) {
- n = ((1 + row - source->top) * wide) + (1 + col - source->left);
- attrs[n] = SCRN_BUF_ATTRS(screen, row)[col] | CHARDRAWN;
- chars[n] = SCRN_BUF_CHARS(screen, row)[col];
- if_OPT_WIDE_CHARS(screen, {
- widec[n] = SCRN_BUF_WIDEC(screen, row)[col];
- })
+ n = (((1 + row - source->top) * wide)
+ + (1 + col - source->left)) * MAX_PTRS;
+ for (j = OFF_ATTRS; j < MAX_PTRS; ++j)
+ cells[n + j] = SCREEN_PTR(screen, row, j)[col];
}
}
for (row = target.top - 1; row < target.bottom; ++row) {
@@ -1701,20 +1813,15 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
&& row <= getMaxRow(screen)
&& col >= getMinCol(screen)
&& col <= getMaxCol(screen)) {
- n = ((1 + row - target.top) * wide) + (1 + col - target.left);
- SCRN_BUF_ATTRS(screen, row)[col] = attrs[n];
- SCRN_BUF_CHARS(screen, row)[col] = chars[n];
- if_OPT_WIDE_CHARS(screen, {
- SCRN_BUF_WIDEC(screen, row)[col] = widec[n];
- })
+ n = (((1 + row - target.top) * wide)
+ + (1 + col - target.left)) * MAX_PTRS;
+ for (j = OFF_ATTRS; j < MAX_PTRS; ++j)
+ SCREEN_PTR(screen, row, j)[col] = cells[n + j];
+ SCRN_BUF_ATTRS(screen, row)[col] |= CHARDRAWN;
}
}
}
- free(attrs);
- free(chars);
-#if OPT_WIDE_CHARS
- free(widec);
-#endif
+ free(cells);
ScrnUpdate(xw,
(target.top - 1),
@@ -1727,7 +1834,13 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
}
/*
- * Modifies the video-attributes only - so selection is unaffected.
+ * Modifies the video-attributes only - so selection (not a video attribute) is
+ * unaffected. Colors and double-size flags are unaffected as well.
+ *
+ * FIXME: our representation for "invisible" does not work with this operation,
+ * since the attribute byte is fully-allocated for other flags. The logic
+ * is shown for INVISIBLE because it's harmless, and useful in case the
+ * CHARDRAWN or PROTECTED flags are reassigned.
*/
void
ScrnMarkRectangle(XtermWidget xw,
@@ -1759,7 +1872,7 @@ ScrnMarkRectangle(XtermWidget xw,
? (target->right - 1)
: getMaxCol(screen));
- TRACE(("marking %d [%d..%d]\n", row, left + 1, right + 1));
+ TRACE(("marking %d [%d..%d]\n", row, left, right));
for (col = left; col <= right; ++col) {
unsigned flags = SCRN_BUF_ATTRS(screen, row)[col];
@@ -1782,6 +1895,9 @@ ScrnMarkRectangle(XtermWidget xw,
case 7:
flags ^= INVERSE;
break;
+ case 8:
+ flags ^= INVISIBLE;
+ break;
}
} else {
switch (params[n]) {
@@ -1800,6 +1916,9 @@ ScrnMarkRectangle(XtermWidget xw,
case 7:
flags |= INVERSE;
break;
+ case 8:
+ flags |= INVISIBLE;
+ break;
case 22:
flags &= ~BOLD;
break;
@@ -1812,6 +1931,9 @@ ScrnMarkRectangle(XtermWidget xw,
case 27:
flags &= ~INVERSE;
break;
+ case 28:
+ flags &= ~INVISIBLE;
+ break;
}
}
}
@@ -1836,7 +1958,7 @@ ScrnMarkRectangle(XtermWidget xw,
/*
* Resets characters to space, except where prohibited by DECSCA. Video
- * attributes are untouched.
+ * attributes (including color) are untouched.
*/
void
ScrnWipeRectangle(XtermWidget xw,
@@ -1855,14 +1977,17 @@ ScrnWipeRectangle(XtermWidget xw,
int left = (target->left - 1);
int right = (target->right - 1);
- TRACE(("wiping %d [%d..%d]\n", row, left + 1, right + 1));
+ TRACE(("wiping %d [%d..%d]\n", row, left, right));
for (col = left; col <= right; ++col) {
if (!((screen->protected_mode == DEC_PROTECT)
&& (SCRN_BUF_ATTRS(screen, row)[col] & PROTECTED))) {
SCRN_BUF_ATTRS(screen, row)[col] |= CHARDRAWN;
SCRN_BUF_CHARS(screen, row)[col] = ' ';
if_OPT_WIDE_CHARS(screen, {
- SCRN_BUF_WIDEC(screen, row)[col] = '\0';
+ int off;
+ for (off = OFF_WIDEC; off < MAX_PTRS; ++off) {
+ memset(SCREEN_PTR(screen, row, off) + col, 0, 1);
+ }
})
}
}
diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c
index c82da89de..3f9ddad4c 100644
--- a/app/xterm/scrollbar.c
+++ b/app/xterm/scrollbar.c
@@ -1,4 +1,4 @@
-/* $XTermId: scrollbar.c,v 1.134 2008/02/28 01:07:30 tom Exp $ */
+/* $XTermId: scrollbar.c,v 1.136 2008/06/03 20:55:33 tom Exp $ */
/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.48 2006/02/13 01:14:59 dickey Exp $ */
@@ -180,17 +180,13 @@ DoResizeScreen(XtermWidget xw)
MaxCols(screen),
reqHeight, reqWidth));
- geomreqresult = XtMakeResizeRequest((Widget) xw, reqWidth, reqHeight,
- &repWidth, &repHeight);
- TRACE(("scrollbar.c XtMakeResizeRequest %dx%d -> %dx%d (status %d)\n",
- reqHeight, reqWidth,
- repHeight, repWidth,
- geomreqresult));
+ geomreqresult = REQ_RESIZE((Widget) xw, reqWidth, reqHeight,
+ &repWidth, &repHeight);
if (geomreqresult == XtGeometryAlmost) {
TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth));
- geomreqresult = XtMakeResizeRequest((Widget) xw, repWidth,
- repHeight, NULL, NULL);
+ geomreqresult = REQ_RESIZE((Widget) xw, repWidth,
+ repHeight, NULL, NULL);
}
if (geomreqresult != XtGeometryYes) {
@@ -327,29 +323,31 @@ ResizeScrollBar(XtermWidget xw)
{
TScreen *screen = &(xw->screen);
- int height = screen->fullVwin.height + screen->border * 2;
- int width = screen->scrollWidget->core.width;
- int ypos = -ScrollBarBorder(xw);
+ if (screen->scrollWidget != 0) {
+ int height = screen->fullVwin.height + screen->border * 2;
+ int width = screen->scrollWidget->core.width;
+ int ypos = -ScrollBarBorder(xw);
#ifdef SCROLLBAR_RIGHT
- int xpos = ((xw->misc.useRight)
- ? (screen->fullVwin.fullwidth -
- screen->scrollWidget->core.width -
- BorderWidth(screen->scrollWidget))
- : -ScrollBarBorder(xw));
+ int xpos = ((xw->misc.useRight)
+ ? (screen->fullVwin.fullwidth -
+ screen->scrollWidget->core.width -
+ BorderWidth(screen->scrollWidget))
+ : -ScrollBarBorder(xw));
#else
- int xpos = -ScrollBarBorder(xw);
+ int xpos = -ScrollBarBorder(xw);
#endif
- TRACE(("ResizeScrollBar at %d,%d %dx%d\n", ypos, xpos, height, width));
+ TRACE(("ResizeScrollBar at %d,%d %dx%d\n", ypos, xpos, height, width));
- XtConfigureWidget(
- screen->scrollWidget,
- xpos,
- ypos,
- width,
- height,
- BorderWidth(screen->scrollWidget));
- ScrollBarDrawThumb(screen->scrollWidget);
+ XtConfigureWidget(
+ screen->scrollWidget,
+ xpos,
+ ypos,
+ width,
+ height,
+ BorderWidth(screen->scrollWidget));
+ ScrollBarDrawThumb(screen->scrollWidget);
+ }
}
void
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index 2391ad9f3..f77a9dcd6 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,12 +1,8 @@
-/* $XTermId: trace.c,v 1.67 2006/07/15 12:00:58 tom Exp $ */
-
-/*
- * $XFree86: xc/programs/xterm/trace.c,v 3.23 2005/09/18 23:48:13 dickey Exp $
- */
+/* $XTermId: trace.c,v 1.85 2008/06/03 20:52:34 tom Exp $ */
/************************************************************
-Copyright 1997-2005,2006 by Thomas E. Dickey
+Copyright 1997-2007,2008 by Thomas E. Dickey
All Rights Reserved
@@ -43,6 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/types.h>
#include <stdio.h>
#include <stdarg.h>
+#include <assert.h>
#ifdef HAVE_X11_TRANSLATEI_H
#include <X11/TranslateI.h>
@@ -62,7 +59,7 @@ extern "C" {
char *trace_who = "parent";
void
-Trace(char *fmt,...)
+Trace(const char *fmt,...)
{
static FILE *fp;
static char *trace_out;
@@ -116,7 +113,7 @@ Trace(char *fmt,...)
void
TraceIds(const char *fname, int lnum)
{
- Trace("process %d ", getpid());
+ Trace("process %d ", (int) getpid());
#ifdef HAVE_UNISTD_H
Trace("real (%u/%u) effective (%u/%u)",
(unsigned) getuid(), (unsigned) getgid(),
@@ -130,6 +127,58 @@ TraceIds(const char *fname, int lnum)
}
}
+static void
+formatAscii(char *dst, unsigned value)
+{
+ switch (value) {
+ case '\\':
+ sprintf(dst, "\\\\");
+ break;
+ case '\b':
+ sprintf(dst, "\\b");
+ break;
+ case '\n':
+ sprintf(dst, "\\n");
+ break;
+ case '\r':
+ sprintf(dst, "\\r");
+ break;
+ case '\t':
+ sprintf(dst, "\\t");
+ break;
+ default:
+ if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160))
+ sprintf(dst, "\\%03o", value);
+ else
+ sprintf(dst, "%c", CharOf(value));
+ break;
+ }
+}
+
+#if OPT_DEC_CHRSET
+
+const char *
+visibleChrsetName(int chrset)
+{
+ const char *result = "?";
+ switch (chrset) {
+ case CSET_SWL:
+ result = "CSET_SWL";
+ break;
+ case CSET_DHL_TOP:
+ result = "CSET_DHL_TOP";
+ break;
+ case CSET_DHL_BOT:
+ result = "CSET_DHL_BOT";
+ break;
+ case CSET_DWL:
+ result = "CSET_DWL";
+ break;
+ }
+ return result;
+}
+#endif
+
char *
visibleChars(PAIRED_CHARS(Char * buf, Char * buf2), unsigned len)
{
@@ -155,10 +204,7 @@ visibleChars(PAIRED_CHARS(Char * buf, Char * buf2), unsigned len)
sprintf(dst, "\\u+%04X", value);
else
#endif
- if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160))
- sprintf(dst, "\\%03o", value);
- else
- sprintf(dst, "%c", CharOf(value));
+ formatAscii(dst, value);
dst += strlen(dst);
}
return result;
@@ -184,10 +230,7 @@ visibleIChar(IChar * buf, unsigned len)
sprintf(dst, "\\u+%04X", value);
else
#endif
- if (E2A(value) < 32 || (E2A(value) >= 127 && E2A(value) < 160))
- sprintf(dst, "\\%03o", value);
- else
- sprintf(dst, "%c", CharOf(value));
+ formatAscii(dst, value);
dst += strlen(dst);
}
return result;
@@ -205,11 +248,178 @@ visibleKeyboardType(xtermKeyboardType type)
CASETYPE(keyboardIsHP);
CASETYPE(keyboardIsSCO);
CASETYPE(keyboardIsSun);
+ CASETYPE(keyboardIsTermcap);
CASETYPE(keyboardIsVT220);
}
return result;
}
+const char *
+visibleEventType(int type)
+{
+ const char *result = "?";
+ switch (type) {
+ CASETYPE(KeyPress);
+ CASETYPE(KeyRelease);
+ CASETYPE(ButtonPress);
+ CASETYPE(ButtonRelease);
+ CASETYPE(MotionNotify);
+ CASETYPE(EnterNotify);
+ CASETYPE(LeaveNotify);
+ CASETYPE(FocusIn);
+ CASETYPE(FocusOut);
+ CASETYPE(KeymapNotify);
+ CASETYPE(Expose);
+ CASETYPE(GraphicsExpose);
+ CASETYPE(NoExpose);
+ CASETYPE(VisibilityNotify);
+ CASETYPE(CreateNotify);
+ CASETYPE(DestroyNotify);
+ CASETYPE(UnmapNotify);
+ CASETYPE(MapNotify);
+ CASETYPE(MapRequest);
+ CASETYPE(ReparentNotify);
+ CASETYPE(ConfigureNotify);
+ CASETYPE(ConfigureRequest);
+ CASETYPE(GravityNotify);
+ CASETYPE(ResizeRequest);
+ CASETYPE(CirculateNotify);
+ CASETYPE(CirculateRequest);
+ CASETYPE(PropertyNotify);
+ CASETYPE(SelectionClear);
+ CASETYPE(SelectionRequest);
+ CASETYPE(SelectionNotify);
+ CASETYPE(ColormapNotify);
+ CASETYPE(ClientMessage);
+ CASETYPE(MappingNotify);
+ }
+ return result;
+}
+
+const char *
+visibleXError(int code)
+{
+ static char temp[80];
+ const char *result = "?";
+ switch (code) {
+ CASETYPE(Success);
+ CASETYPE(BadRequest);
+ CASETYPE(BadValue);
+ CASETYPE(BadWindow);
+ CASETYPE(BadPixmap);
+ CASETYPE(BadAtom);
+ CASETYPE(BadCursor);
+ CASETYPE(BadFont);
+ CASETYPE(BadMatch);
+ CASETYPE(BadDrawable);
+ CASETYPE(BadAccess);
+ CASETYPE(BadAlloc);
+ CASETYPE(BadColor);
+ CASETYPE(BadGC);
+ CASETYPE(BadIDChoice);
+ CASETYPE(BadName);
+ CASETYPE(BadLength);
+ CASETYPE(BadImplementation);
+ default:
+ sprintf(temp, "%d", code);
+ result = temp;
+ break;
+ }
+ return result;
+}
+
+#if OPT_TRACE_FLAGS
+#define isScrnFlag(flag) ((flag) == LINEWRAPPED)
+
+static char *
+ScrnText(TScreen * screen, int row)
+{
+ Char *chars = SCRN_BUF_CHARS(screen, row);
+#if OPT_WIDE_CHARS
+ Char *widec = 0;
+#endif
+
+ if_OPT_WIDE_CHARS(screen, {
+ widec = SCRN_BUF_WIDEC(screen, row);
+ });
+ return visibleChars(PAIRED_CHARS(chars, widec), screen->max_col + 1);
+}
+
+#if OPT_TRACE_FLAGS > 1
+#define DETAILED_FLAGS(name) \
+ Trace("TEST " #name " %d [%d..%d] top %d chars %p (%d)\n", \
+ row, \
+ -screen->savedlines, \
+ screen->max_row, \
+ screen->topline, \
+ SCRN_BUF_CHARS(screen, row), \
+ (&(SCRN_BUF_FLAGS(screen, row)) - screen->visbuf) / MAX_PTRS)
+#else
+#define DETAILED_FLAGS(name) /* nothing */
+#endif
+
+#define SHOW_BAD_ROW(name, screen, row) \
+ Trace("OOPS " #name " bad row %d [%d..%d]\n", \
+ row, -(screen->savedlines), screen->max_row)
+
+#define SHOW_SCRN_FLAG(name,code) \
+ Trace(#name " {%d, top=%d, saved=%d}%05d%s:%s\n", \
+ row, screen->topline, screen->savedlines, \
+ ROW2ABS(screen, row), \
+ code ? "*" : "", \
+ ScrnText(screen, row))
+
+void
+ScrnClrFlag(TScreen * screen, int row, int flag)
+{
+ DETAILED_FLAGS(ScrnClrFlag);
+ if (!okScrnRow(screen, row)) {
+ SHOW_BAD_ROW(ScrnClrFlag, screen, row);
+ assert(0);
+ } else if (isScrnFlag(flag)) {
+ SHOW_SCRN_FLAG(ScrnClrFlag, 0);
+ }
+
+ SCRN_BUF_FLAGS(screen, row) =
+ (Char *) ((long) SCRN_BUF_FLAGS(screen, row) & ~(flag));
+}
+
+void
+ScrnSetFlag(TScreen * screen, int row, int flag)
+{
+ DETAILED_FLAGS(ScrnSetFlag);
+ if (!okScrnRow(screen, row)) {
+ SHOW_BAD_ROW(ScrnSetFlag, screen, row);
+ assert(0);
+ } else if (isScrnFlag(flag)) {
+ SHOW_SCRN_FLAG(ScrnSetFlag, 1);
+ }
+
+ SCRN_BUF_FLAGS(screen, row) =
+ (Char *) (((long) SCRN_BUF_FLAGS(screen, row) | (flag)));
+}
+
+int
+ScrnTstFlag(TScreen * screen, int row, int flag)
+{
+ int code = 0;
+ if (!okScrnRow(screen, row)) {
+ SHOW_BAD_ROW(ScrnTstFlag, screen, row);
+ } else {
+ code = ((long) SCRN_BUF_FLAGS(screen, row) & (flag)) != 0;
+
+ DETAILED_FLAGS(ScrnTstFlag);
+ if (!okScrnRow(screen, row)) {
+ SHOW_BAD_ROW(ScrnSetFlag, screen, row);
+ assert(0);
+ } else if (isScrnFlag(flag)) {
+ SHOW_SCRN_FLAG(ScrnTstFlag, code);
+ }
+ }
+ return code;
+}
+#endif /* OPT_TRACE_FLAGS */
+
void
TraceSizeHints(XSizeHints * hints)
{
@@ -228,6 +438,8 @@ TraceSizeHints(XSizeHints * hints)
TRACE((" max %d,%d\n", hints->max_height, hints->max_width));
if (hints->flags & PResizeInc)
TRACE((" inc %d,%d\n", hints->height_inc, hints->width_inc));
+ else
+ TRACE((" inc NONE!\n"));
if (hints->flags & PAspect)
TRACE((" min aspect %d/%d\n", hints->min_aspect.y, hints->min_aspect.y));
if (hints->flags & PAspect)
@@ -241,14 +453,11 @@ TraceSizeHints(XSizeHints * hints)
void
TraceWMSizeHints(XtermWidget xw)
{
- XSizeHints sizehints;
- long supp = 0;
-
- bzero(&sizehints, sizeof(sizehints));
- if (!XGetWMNormalHints(xw->screen.display, XtWindow(SHELL_OF(xw)),
- &sizehints, &supp))
- bzero(&sizehints, sizeof(sizehints));
- TraceSizeHints(&sizehints);
+ XSizeHints sizehints = xw->hints;
+
+ getXtermSizeHints(xw);
+ TraceSizeHints(&xw->hints);
+ xw->hints = sizehints;
}
/*
@@ -287,6 +496,24 @@ TraceTranslations(const char *name, Widget w)
XSetErrorHandler(save);
}
+int
+TraceResizeRequest(const char *fn, int ln, Widget w,
+ Dimension reqwide,
+ Dimension reqhigh,
+ Dimension * gotwide,
+ Dimension * gothigh)
+{
+ int rc;
+
+ TRACE(("%s@%d ResizeRequest %dx%d\n", fn, ln, reqhigh, reqwide));
+ rc = XtMakeResizeRequest((Widget) w, reqwide, reqhigh, gotwide, gothigh);
+ TRACE(("... ResizeRequest -> "));
+ if (gothigh && gotwide)
+ TRACE(("%dx%d ", *gothigh, *gotwide));
+ TRACE(("(%d)\n", rc));
+ return rc;
+}
+
#define XRES_S(name) Trace(#name " = %s\n", NonNull(resp->name))
#define XRES_B(name) Trace(#name " = %s\n", BtoS(resp->name))
#define XRES_I(name) Trace(#name " = %d\n", resp->name)
@@ -323,13 +550,14 @@ TraceXtermResources(void)
XRES_B(ptyInitialErase);
XRES_B(backarrow_is_erase);
#endif
- XRES_B(wait_for_map);
XRES_B(useInsertMode);
#if OPT_ZICONBEEP
XRES_I(zIconBeep);
#endif
#if OPT_PTY_HANDSHAKE
+ XRES_B(wait_for_map);
XRES_B(ptyHandshake);
+ XRES_B(ptySttySize);
#endif
#if OPT_SAME_NAME
XRES_B(sameName);
@@ -492,6 +720,11 @@ TraceOptions(OptionHelp * options, XrmOptionDescRec * resources, Cardinal res_co
case XrmoptionSkipLine:
TRACE((" %-28s {remainder of line}\n", res_array[j].option));
break;
+ case XrmoptionIsArg:
+ case XrmoptionNoArg:
+ case XrmoptionResArg:
+ case XrmoptionSepArg:
+ case XrmoptionStickyArg:
default:
break;
}
diff --git a/app/xterm/trace.h b/app/xterm/trace.h
index 69754217f..9f2c3b9cd 100644
--- a/app/xterm/trace.h
+++ b/app/xterm/trace.h
@@ -1,12 +1,8 @@
-/* $XTermId: trace.h,v 1.38 2006/08/02 23:48:54 tom Exp $ */
-
-/*
- * $XFree86: xc/programs/xterm/trace.h,v 3.17 2005/09/18 23:48:13 dickey Exp $
- */
+/* $XTermId: trace.h,v 1.44 2008/07/27 15:21:20 tom Exp $ */
/************************************************************
-Copyright 1997-2005,2006 by Thomas E. Dickey
+Copyright 1997-2007,2008 by Thomas E. Dickey
All Rights Reserved
@@ -39,7 +35,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#if OPT_TRACE
-extern void Trace ( char *, ... )
+extern void Trace ( const char *, ... )
#ifdef GCC_PRINTF
__attribute__ ((format(printf,1,2)))
#endif
@@ -50,10 +46,13 @@ extern void Trace ( char *, ... )
#define TRACE2(p) Trace p
#endif
-extern char * visibleChars (PAIRED_CHARS(Char *buf, Char *buf2), unsigned len);
+extern const char * visibleChrsetName(int /* chrset */);
+extern char * visibleChars (PAIRED_CHARS(Char * /* buf */, Char * /* buf2 */), unsigned /* len */);
extern char * visibleIChar (IChar *, unsigned);
+extern const char * visibleEventType (int);
+extern const char * visibleXError (int /* code */);
-extern void TraceArgv(const char *tag, char **argv);
+extern void TraceArgv(const char * /* tag */, char ** /* argv */);
#define TRACE_ARGV(tag,argv) TraceArgv(tag,argv)
extern char *trace_who;
@@ -62,10 +61,10 @@ extern char *trace_who;
extern void TraceSizeHints(XSizeHints *);
#define TRACE_HINTS(hints) TraceSizeHints(hints)
-extern void TraceIds(const char *fname, int lnum);
+extern void TraceIds(const char * /* fname */, int /* lnum */);
#define TRACE_IDS TraceIds(__FILE__, __LINE__)
-extern void TraceOptions(OptionHelp *options, XrmOptionDescRec *resources, Cardinal count);
+extern void TraceOptions(OptionHelp * /* options */, XrmOptionDescRec * /* resources */, Cardinal /* count */);
#define TRACE_OPTS(opts,ress,lens) TraceOptions(opts,ress,lens)
extern void TraceTranslations(const char *, Widget);
@@ -77,6 +76,17 @@ extern void TraceWMSizeHints(XtermWidget);
extern void TraceXtermResources(void);
#define TRACE_XRES() TraceXtermResources()
+extern int TraceResizeRequest(const char * /* fn */, int /* ln */, Widget /* w */, Dimension /* reqwide */, Dimension /* reqhigh */, Dimension * /* gotwide */, Dimension * /* gothigh */);
+#define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \
+ TraceResizeRequest(__FILE__, __LINE__, w, reqwide, reqhigh, gotwide, gothigh)
+
+#else
+
+#define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \
+ XtMakeResizeRequest((Widget) (w), \
+ (Dimension) (reqwide), (Dimension) (reqhigh), \
+ (gotwide), (gothigh))
+
#endif
#endif /* included_trace_h */
diff --git a/app/xterm/version.h b/app/xterm/version.h
index b74cf2be9..3056d53a9 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.290 2008/02/28 00:17:03 tom Exp $ */
+/* $XTermId: version.h,v 1.292 2008/05/26 19:18:04 tom Exp $ */
/*
* These definitions are used to build the string that's printed in response to
@@ -6,7 +6,7 @@
* version of X to which this version of xterm has been built. The number in
* parentheses is my patch number (Thomas E. Dickey).
*/
-#define XTERM_PATCH 234
+#define XTERM_PATCH 236
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index 4e92f18e4..478cec666 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.498 2008/01/30 00:50:07 tom Exp $ */
+/* $XTermId: xterm.h,v 1.502 2008/05/26 19:23:05 tom Exp $ */
/************************************************************
@@ -397,6 +397,7 @@ extern char **environ;
#define XtNfontDoublesize "fontDoublesize"
#define XtNfontStyle "fontStyle"
#define XtNforceBoxChars "forceBoxChars"
+#define XtNformatOtherKeys "formatOtherKeys"
#define XtNfreeBoldBox "freeBoldBox"
#define XtNhighlightColor "highlightColor"
#define XtNhighlightColorMode "highlightColorMode"
@@ -435,9 +436,9 @@ extern char **environ;
#define XtNnMarginBell "nMarginBell"
#define XtNnumLock "numLock"
#define XtNoldXtermFKeys "oldXtermFKeys"
-#define XtNpointerMode "pointerMode"
#define XtNpointerColor "pointerColor"
#define XtNpointerColorBackground "pointerColorBackground"
+#define XtNpointerMode "pointerMode"
#define XtNpointerShape "pointerShape"
#define XtNpopOnBell "popOnBell"
#define XtNprintAttributes "printAttributes"
@@ -545,6 +546,7 @@ extern char **environ;
#define XtCFontDoublesize "FontDoublesize"
#define XtCFontStyle "FontStyle"
#define XtCForceBoxChars "ForceBoxChars"
+#define XtCFormatOtherKeys "FormatOtherKeys"
#define XtCFreeBoldBox "FreeBoldBox"
#define XtCHighlightColorMode "HighlightColorMode"
#define XtCHighlightReverse "HighlightReverse"
@@ -749,6 +751,7 @@ extern void noleaks_cachedCgs (XtermWidget /* xw */);
#endif
/* charproc.c */
+extern Bool CheckBufPtrs (TScreen * /* screen */);
extern int VTInit (void);
extern int v_write (int /* f */, Char * /* d */, unsigned /* len */);
extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */);
@@ -789,9 +792,10 @@ extern void noleaks_charproc (void);
/* charsets.c */
extern unsigned xtermCharSetIn (unsigned /* code */, int /* charset */);
-extern int xtermCharSetOut (IChar * /* buf */, IChar * /* ptr */, int /* charset */);
+extern int xtermCharSetOut (XtermWidget /* xw */, IChar * /* buf */, IChar * /* ptr */, int /* charset */);
/* cursor.c */
+extern void AdjustSavedCursor (XtermWidget /* xw */, int /* adjust */);
extern void CarriageReturn (TScreen * /* screen */);
extern void CursorBack (XtermWidget /* xw */, int /* n */);
extern void CursorDown (TScreen * /* screen */, int /* n */);
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index 0e10ac1b0..9cb1fc03d 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -20,7 +20,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.664 2008/03/02 23:32:51 tom Exp $
+ $XTermId: xterm.log.html,v 1.685 2008/07/27 23:10:10 tom Exp $
-->
<HTML>
<HEAD>
@@ -45,7 +45,9 @@ Most of these are summarized in the XFree86 CHANGELOG
is the latest version of this file.
<UL>
-<LI><A HREF="#xterm_234">Patch #234 - 2008-03/02</A>
+<LI><A HREF="#xterm_236">Patch #236 - 2008/07/27</A>
+<LI><A HREF="#xterm_235">Patch #235 - 2008/04/20</A>
+<LI><A HREF="#xterm_234">Patch #234 - 2008/03/02</A>
<LI><A HREF="#xterm_233">Patch #233 - 2008/02/24</A>
<LI><A HREF="#xterm_232">Patch #232 - 2008/01/30</A>
<LI><A HREF="#xterm_231">Patch #231 - 2008/01/05</A>
@@ -282,7 +284,78 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
-<H1><A NAME="xterm_234">Patch #234 - 2008-03/02</A></H1>
+<H1><A NAME="xterm_236">Patch #236 - 2008/07/27</A></H1>
+<ul>
+ <li>correct memory reallocation when handling a paste of UTF-8 text
+ from <a href="#xterm_225">patch #225</a> changes
+ (report/patch by Max Mikhanosha).
+
+ <li>correct allocation of temporary buffer in
+ <code>xtermFindShell</code> in case the user's <code>$PATH</code>
+ contains no ":" (report/analysis by Victor Stinner,
+ Freedesktop.Org Bugzilla #16790).
+
+ <li>modify CF_XOPEN_SOURCE to add case for DragonFly BSD, to fix
+ new compile problem exposed by fix for fd_mask (patch by
+ Hasso Tepper).
+
+ <li>add configure-check for ncurses <code>use_extended_names</code>,
+ (report by Martin Mokrejs).
+
+ <li>correct computation for toolbar height; layout manager already
+ takes into account <code>borderWidth</code> resource.
+
+ <li>implement VT320-style SCS (select character set) for ISO Latin-1
+ supplemental.
+
+ <li>fixes for vt100-style character sets in UTF-8 mode (Ubuntu #230919).
+
+ <li>fix to make <code>luit</code> work with xterm's <code>-ls</code>
+ option (report/patch by Marius Tolzmann).
+
+ <li>update config.guess, config.sub
+</ul>
+
+<H1><A NAME="xterm_235">Patch #235 - 2008/04/20</A></H1>
+<ul>
+ <li>add control sequences for some of the recent resource/menu
+ settings:
+ <ul>
+ <li><code>altSendsEscape</code> (private mode 1039)
+ <li><code>keepSelection</code> (private mode 1040)
+ <li><code>selectToClipboard</code> (private mode 1041)
+ <li><code>bellIsUrgent</code> (private mode 1042)
+ <li><code>popOnBell</code> (private mode 1043)
+ </ul>
+
+ <li>add resource <code>formatOtherKeys</code> to provide an alternate
+ escape sequence format for the <code>modifyOtherKeys</code>
+ resource (request by Paul LeoNerd Evans).
+
+ <li>adjust saved-cursor position if the window is resized while
+ displaying the alternate screen (Novell #196880, Debian #383384).
+
+ <li>improve pointer-checks to fix a bug exposed by resizing during
+ initialization under StumpWM window manager
+ (Fedora Bugzilla #437928).
+
+ <li>modify <code>unselectwindow()</code> to ensure that the mouse
+ pointer is not hidden after xterm loses focus (report by Jeremy
+ Huddleston).
+
+ <li>add special check for fd_mask on Mac OS X (report by Jeremy
+ Huddleston).
+
+ <li>add <code>dylib</code> to autoconf's suffix list used for checking
+ the result from <code>xmkmf</code>, to work with Mac OS X (report
+ by Jeremy Huddleston).
+
+ <li>correct initialization of bold- and wide-, wide-bold fonts which
+ may be set via the <code>utf8Fonts</code> subresource (Debian
+ #347790).
+</ul>
+
+<H1><A NAME="xterm_234">Patch #234 - 2008/03/02</A></H1>
<ul>
<li>modify <code>sinstall.sh</code> to use POSIX locale to
bypass GNU ls changes to date-format.
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index e47a5c060..c2e540caa 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.406 2008/02/24 19:09:31 Alan.Coopersmith Exp $
+.\" $XTermId: xterm.man,v 1.408 2008/04/20 21:16:40 tom Exp $
.\"
.\" Copyright 1996-2007,2008 by Thomas E. Dickey
.\"
@@ -1833,9 +1833,15 @@ The default is ``false.''
.B "cursorColor (\fPclass\fB CursorColor)"
Specifies the color to use for the text cursor.
The default is ``XtDefaultForeground.''
-\fIXterm\fP attempts to keep this color from being the same as the background
+By default,
+\fIxterm\fP attempts to keep this color from being the same as the background
color, since it draws the cursor by filling the background of a text cell.
The same restriction applies to control sequences which may change this color.
+.IP
+Setting this resource overrides
+most of \fIxterm\fP's adjustments to cursor color.
+It will still use reverse-video to disallow some cases, such as a black
+cursor on a black background.
.TP 8
.B "cursorOffTime (\fPclass\fB CursorOffTime)"
Specifies the duration of the "off" part of the cursor blink cycle-time
@@ -2051,7 +2057,19 @@ that would normally appear in the text color change color.
The default
is ``XtDefaultForeground.''
.TP 8
-.B "freeBoldBox (\fPclass\fB freeBoldBox)"
+.B "formatOtherKeys (\fPclass\fB FormatOtherKeys)"
+Overrides the format of the escape sequence used to report modified keys
+with the \fImodifyOtherKeys\fP resource.
+.RS
+.TP 3
+0
+send modified keys as parameters for function-key 27 (default).
+.TP 3
+1
+send modified keys as parameters for CSI\ u.
+.RE
+.TP 8
+.B "freeBoldBox (\fPclass\fB FreeBoldBox)"
Specifies whether \fIxterm\fP should assume the bounding boxes for
normal and bold fonts are compatible.
If ``false'', \fIxterm\fP compares them and will reject choices of
diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c
index b1730fedd..e337b5dcd 100644
--- a/app/xterm/xtermcap.c
+++ b/app/xterm/xtermcap.c
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcap.c,v 1.5 2007/03/18 22:34:20 tom Exp $ */
+/* $XTermId: xtermcap.c,v 1.13 2008/07/27 15:18:56 tom Exp $ */
/*
* Copyright 2007 by Thomas E. Dickey
@@ -40,6 +40,20 @@
#include <xstrings.h>
+#ifndef HAVE_TIGETSTR
+#undef USE_TERMINFO
+#endif
+
+#ifndef USE_TERMINFO
+#define USE_TERMINFO 0
+#endif
+
+#if USE_TERMINFO && defined(NCURSES_VERSION) && defined(HAVE_USE_EXTENDED_NAMES)
+#define USE_EXTENDED_NAMES 1
+#else
+#define USE_EXTENDED_NAMES 0
+#endif
+
#if OPT_TCAP_QUERY || OPT_TCAP_FKEYS
typedef struct {
@@ -51,111 +65,136 @@ typedef struct {
/* *INDENT-OFF* */
#define DATA(tc,ti,x,y) { tc, ti, x, y }
static TCAPINFO table[] = {
- /* tcap terminfo code state */
- DATA( "%1", "khlp", XK_Help, 0 ),
- DATA( "#1", "kHLP", XK_Help, ShiftMask ),
- DATA( "@0", "kfnd", XK_Find, 0 ),
- DATA( "*0", "kFND", XK_Find, ShiftMask ),
- DATA( "*6", "kslt", XK_Select, 0 ),
- DATA( "#6", "kSLT", XK_Select, ShiftMask ),
-
- DATA( "kh", "khome", XK_Home, 0 ),
- DATA( "#2", "kHOM", XK_Home, ShiftMask ),
- DATA( "@7", "kend", XK_End, 0 ),
- DATA( "*7", "kEND", XK_End, ShiftMask ),
-
- DATA( "kl", "kcub1", XK_Left, 0 ),
- DATA( "kr", "kcuf1", XK_Right, 0 ),
- DATA( "ku", "kcuu1", XK_Up, 0 ),
- DATA( "kd", "kcud1", XK_Down, 0 ),
-
- DATA( "#4", "kLFT", XK_Left, ShiftMask ),
- DATA( "%i", "kRIT", XK_Right, ShiftMask ),
- DATA( "%e", "kPRV", XK_Up, ShiftMask ),
- DATA( "%c", "kNXT", XK_Down, ShiftMask ),
-
- DATA( "k1", "kf1", XK_Fn(1), 0 ),
- DATA( "k2", "kf2", XK_Fn(2), 0 ),
- DATA( "k3", "kf3", XK_Fn(3), 0 ),
- DATA( "k4", "kf4", XK_Fn(4), 0 ),
- DATA( "k5", "kf5", XK_Fn(5), 0 ),
- DATA( "k6", "kf6", XK_Fn(6), 0 ),
- DATA( "k7", "kf7", XK_Fn(7), 0 ),
- DATA( "k8", "kf8", XK_Fn(8), 0 ),
- DATA( "k9", "kf9", XK_Fn(9), 0 ),
- DATA( "k;", "kf10", XK_Fn(10), 0 ),
-
- DATA( "F1", "kf11", XK_Fn(11), 0 ),
- DATA( "F2", "kf12", XK_Fn(12), 0 ),
- DATA( "F3", "kf13", XK_Fn(13), 0 ),
- DATA( "F4", "kf14", XK_Fn(14), 0 ),
- DATA( "F5", "kf15", XK_Fn(15), 0 ),
- DATA( "F6", "kf16", XK_Fn(16), 0 ),
- DATA( "F7", "kf17", XK_Fn(17), 0 ),
- DATA( "F8", "kf18", XK_Fn(18), 0 ),
- DATA( "F9", "kf19", XK_Fn(19), 0 ),
- DATA( "FA", "kf20", XK_Fn(20), 0 ),
- DATA( "FB", "kf21", XK_Fn(21), 0 ),
- DATA( "FC", "kf22", XK_Fn(22), 0 ),
- DATA( "FD", "kf23", XK_Fn(23), 0 ),
- DATA( "FE", "kf24", XK_Fn(24), 0 ),
- DATA( "FF", "kf25", XK_Fn(25), 0 ),
- DATA( "FG", "kf26", XK_Fn(26), 0 ),
- DATA( "FH", "kf27", XK_Fn(27), 0 ),
- DATA( "FI", "kf28", XK_Fn(28), 0 ),
- DATA( "FJ", "kf29", XK_Fn(29), 0 ),
- DATA( "FK", "kf30", XK_Fn(30), 0 ),
- DATA( "FL", "kf31", XK_Fn(31), 0 ),
- DATA( "FM", "kf32", XK_Fn(32), 0 ),
- DATA( "FN", "kf33", XK_Fn(33), 0 ),
- DATA( "FO", "kf34", XK_Fn(34), 0 ),
- DATA( "FP", "kf35", XK_Fn(35), 0 ),
-
- DATA( "FQ", "kf36", -36, 0 ),
- DATA( "FR", "kf37", -37, 0 ),
- DATA( "FS", "kf38", -38, 0 ),
- DATA( "FT", "kf39", -39, 0 ),
- DATA( "FU", "kf40", -40, 0 ),
- DATA( "FV", "kf41", -41, 0 ),
- DATA( "FW", "kf42", -42, 0 ),
- DATA( "FX", "kf43", -43, 0 ),
- DATA( "FY", "kf44", -44, 0 ),
- DATA( "FZ", "kf45", -45, 0 ),
- DATA( "Fa", "kf46", -46, 0 ),
- DATA( "Fb", "kf47", -47, 0 ),
- DATA( "Fc", "kf48", -48, 0 ),
- DATA( "Fd", "kf49", -49, 0 ),
- DATA( "Fe", "kf50", -50, 0 ),
- DATA( "Ff", "kf51", -51, 0 ),
- DATA( "Fg", "kf52", -52, 0 ),
- DATA( "Fh", "kf53", -53, 0 ),
- DATA( "Fi", "kf54", -54, 0 ),
- DATA( "Fj", "kf55", -55, 0 ),
- DATA( "Fk", "kf56", -56, 0 ),
- DATA( "Fl", "kf57", -57, 0 ),
- DATA( "Fm", "kf58", -58, 0 ),
- DATA( "Fn", "kf59", -59, 0 ),
- DATA( "Fo", "kf60", -60, 0 ),
- DATA( "Fp", "kf61", -61, 0 ),
- DATA( "Fq", "kf62", -62, 0 ),
- DATA( "Fr", "kf63", -63, 0 ),
-
- DATA( "K1", "ka1", XK_KP_Home, 0 ),
- DATA( "K4", "kc1", XK_KP_End, 0 ),
+ /* tcap terminfo code param */
+ DATA( "%1", "khlp", XK_Help, 0 ),
+ DATA( "#1", "kHLP", XK_Help, 2 ),
+ DATA( "@0", "kfnd", XK_Find, 0 ),
+ DATA( "*0", "kFND", XK_Find, 2 ),
+ DATA( "*6", "kslt", XK_Select, 0 ),
+ DATA( "#6", "kSLT", XK_Select, 2 ),
+
+ DATA( "kh", "khome", XK_Home, 0 ),
+ DATA( "#2", "kHOM", XK_Home, 2 ),
+ DATA( "@7", "kend", XK_End, 0 ),
+ DATA( "*7", "kEND", XK_End, 2 ),
+
+ DATA( "kl", "kcub1", XK_Left, 0 ),
+ DATA( "kr", "kcuf1", XK_Right, 0 ),
+ DATA( "ku", "kcuu1", XK_Up, 0 ),
+ DATA( "kd", "kcud1", XK_Down, 0 ),
+
+ DATA( "#4", "kLFT", XK_Left, 2 ),
+ DATA( "%i", "kRIT", XK_Right, 2 ),
+ DATA( "%e", "kPRV", XK_Up, 2 ),
+ DATA( "%c", "kNXT", XK_Down, 2 ),
+
+ DATA( "k1", "kf1", XK_Fn(1), 0 ),
+ DATA( "k2", "kf2", XK_Fn(2), 0 ),
+ DATA( "k3", "kf3", XK_Fn(3), 0 ),
+ DATA( "k4", "kf4", XK_Fn(4), 0 ),
+ DATA( "k5", "kf5", XK_Fn(5), 0 ),
+ DATA( "k6", "kf6", XK_Fn(6), 0 ),
+ DATA( "k7", "kf7", XK_Fn(7), 0 ),
+ DATA( "k8", "kf8", XK_Fn(8), 0 ),
+ DATA( "k9", "kf9", XK_Fn(9), 0 ),
+ DATA( "k;", "kf10", XK_Fn(10), 0 ),
+
+ DATA( "F1", "kf11", XK_Fn(11), 0 ),
+ DATA( "F2", "kf12", XK_Fn(12), 0 ),
+ DATA( "F3", "kf13", XK_Fn(13), 0 ),
+ DATA( "F4", "kf14", XK_Fn(14), 0 ),
+ DATA( "F5", "kf15", XK_Fn(15), 0 ),
+ DATA( "F6", "kf16", XK_Fn(16), 0 ),
+ DATA( "F7", "kf17", XK_Fn(17), 0 ),
+ DATA( "F8", "kf18", XK_Fn(18), 0 ),
+ DATA( "F9", "kf19", XK_Fn(19), 0 ),
+ DATA( "FA", "kf20", XK_Fn(20), 0 ),
+ DATA( "FB", "kf21", XK_Fn(21), 0 ),
+ DATA( "FC", "kf22", XK_Fn(22), 0 ),
+ DATA( "FD", "kf23", XK_Fn(23), 0 ),
+ DATA( "FE", "kf24", XK_Fn(24), 0 ),
+ DATA( "FF", "kf25", XK_Fn(25), 0 ),
+ DATA( "FG", "kf26", XK_Fn(26), 0 ),
+ DATA( "FH", "kf27", XK_Fn(27), 0 ),
+ DATA( "FI", "kf28", XK_Fn(28), 0 ),
+ DATA( "FJ", "kf29", XK_Fn(29), 0 ),
+ DATA( "FK", "kf30", XK_Fn(30), 0 ),
+ DATA( "FL", "kf31", XK_Fn(31), 0 ),
+ DATA( "FM", "kf32", XK_Fn(32), 0 ),
+ DATA( "FN", "kf33", XK_Fn(33), 0 ),
+ DATA( "FO", "kf34", XK_Fn(34), 0 ),
+ DATA( "FP", "kf35", XK_Fn(35), 0 ),
+
+ DATA( "FQ", "kf36", -36, 0 ),
+ DATA( "FR", "kf37", -37, 0 ),
+ DATA( "FS", "kf38", -38, 0 ),
+ DATA( "FT", "kf39", -39, 0 ),
+ DATA( "FU", "kf40", -40, 0 ),
+ DATA( "FV", "kf41", -41, 0 ),
+ DATA( "FW", "kf42", -42, 0 ),
+ DATA( "FX", "kf43", -43, 0 ),
+ DATA( "FY", "kf44", -44, 0 ),
+ DATA( "FZ", "kf45", -45, 0 ),
+ DATA( "Fa", "kf46", -46, 0 ),
+ DATA( "Fb", "kf47", -47, 0 ),
+ DATA( "Fc", "kf48", -48, 0 ),
+ DATA( "Fd", "kf49", -49, 0 ),
+ DATA( "Fe", "kf50", -50, 0 ),
+ DATA( "Ff", "kf51", -51, 0 ),
+ DATA( "Fg", "kf52", -52, 0 ),
+ DATA( "Fh", "kf53", -53, 0 ),
+ DATA( "Fi", "kf54", -54, 0 ),
+ DATA( "Fj", "kf55", -55, 0 ),
+ DATA( "Fk", "kf56", -56, 0 ),
+ DATA( "Fl", "kf57", -57, 0 ),
+ DATA( "Fm", "kf58", -58, 0 ),
+ DATA( "Fn", "kf59", -59, 0 ),
+ DATA( "Fo", "kf60", -60, 0 ),
+ DATA( "Fp", "kf61", -61, 0 ),
+ DATA( "Fq", "kf62", -62, 0 ),
+ DATA( "Fr", "kf63", -63, 0 ),
+
+ DATA( "K1", "ka1", XK_KP_Home, 0 ),
+ DATA( "K4", "kc1", XK_KP_End, 0 ),
#ifdef XK_ISO_Left_Tab
- DATA( "kB", "kcbt", XK_ISO_Left_Tab, 0 ),
+ DATA( "kB", "kcbt", XK_ISO_Left_Tab, 0 ),
#endif
- DATA( "kC", "kclr", XK_Clear, 0 ),
- DATA( "kD", "kdch1", XK_Delete, 0 ),
- DATA( "kI", "kich1", XK_Insert, 0 ),
- DATA( "kN", "knp", XK_Next, 0 ),
- DATA( "kP", "kpp", XK_Prior, 0 ),
- DATA( "kb", "kbs", XK_BackSpace, 0 ),
+ DATA( "kC", "kclr", XK_Clear, 0 ),
+ DATA( "kD", "kdch1", XK_Delete, 0 ),
+ DATA( "kI", "kich1", XK_Insert, 0 ),
+ DATA( "kN", "knp", XK_Next, 0 ),
+ DATA( "kP", "kpp", XK_Prior, 0 ),
+ DATA( "kb", "kbs", XK_BackSpace, 0 ),
# if OPT_TCAP_QUERY && OPT_ISO_COLORS
/* XK_COLORS is a fake code. */
- DATA( "Co", "colors", XK_COLORS, 0 ),
+ DATA( "Co", "colors", XK_COLORS, 0 ),
# endif
+#if USE_EXTENDED_NAMES
+#define DEXT(name, parm, code) DATA("", name, code, parm)
+#define D1ST(name, parm, code) DEXT("k" #name, parm, code)
+#define DMOD(name, parm, code) DEXT("k" #name #parm, parm, code)
+
+#define DGRP(name, code) \
+ D1ST(name, 2, code), \
+ DMOD(name, 3, code), \
+ DMOD(name, 4, code), \
+ DMOD(name, 5, code), \
+ DMOD(name, 6, code), \
+ DMOD(name, 7, code), \
+ DMOD(name, 8, code)
+
+ DGRP(DN, XK_Down),
+ DGRP(LFT, XK_Left),
+ DGRP(RIT, XK_Right),
+ DGRP(UP, XK_Up),
+ DGRP(DC, XK_Delete),
+ DGRP(END, XK_End),
+ DGRP(HOM, XK_Home),
+ DGRP(IC, XK_Insert),
+ DGRP(NXT, XK_Next),
+ DGRP(PRV, XK_Prior),
+#endif
};
#undef DATA
/* *INDENT-ON* */
@@ -179,10 +218,12 @@ lookupTcapByName(const char *name)
TCAPINFO *result = 0;
Cardinal n;
- for (n = 0; n < XtNumber(table); n++) {
- if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) {
- result = table + n;
- break;
+ if (name != 0 && *name != '\0') {
+ for (n = 0; n < XtNumber(table); n++) {
+ if (!strcmp(table[n].ti, name) || !strcmp(table[n].tc, name)) {
+ result = table + n;
+ break;
+ }
}
}
return result;
@@ -224,7 +265,7 @@ xtermcapKeycode(XtermWidget xw, char **params, unsigned *state, Bool * fkey)
if (*p == 0 || *p == ';') {
if ((data = lookupTcapByName(name)) != 0) {
code = data->code;
- *state = data->state;
+ *state = xtermParamToState(xw, data->state);
if (IsFunctionKey(code)) {
*fkey = True;
} else if (code < 0) {
@@ -270,6 +311,7 @@ lookupTcapByCode(int code, unsigned mask)
TCAPINFO *result = 0;
Cardinal n;
+ TRACE(("lookupTcapByCode %d:%#x\n", code, mask));
for (n = 0; n < XtNumber(table); n++) {
if (table[n].code == code &&
table[n].state == mask) {
@@ -281,12 +323,16 @@ lookupTcapByCode(int code, unsigned mask)
return result;
}
+#define NO_STRING (char *)(-1)
+
int
xtermcapString(XtermWidget xw, int keycode, unsigned mask)
{
+ int result = 0;
TCAPINFO *data;
+ unsigned param = xtermStateToParam(xw, mask);
- if ((data = lookupTcapByCode(keycode, mask)) != 0) {
+ if ((data = lookupTcapByCode(keycode, param)) != 0) {
TScreen *screen = TScreenOf(xw);
Cardinal which = data - table;
char *fkey;
@@ -294,22 +340,37 @@ xtermcapString(XtermWidget xw, int keycode, unsigned mask)
if (screen->tcap_fkeys == 0) {
Cardinal want = XtNumber(table);
Cardinal have;
+#if !(USE_TERMINFO && defined(HAVE_TIGETSTR))
char *area = screen->tcap_area;
+#endif
- if ((screen->tcap_fkeys = TypeCallocN(char *, want)) == 0)
- return 0;
- for (have = 0; have < want; ++have) {
- if ((fkey = tgetstr(table[have].tc, &area)) != 0) {
- screen->tcap_fkeys[have] = x_strdup(fkey);
+ if ((screen->tcap_fkeys = TypeCallocN(char *, want)) != 0) {
+ for (have = 0; have < want; ++have) {
+#if USE_TERMINFO && defined(HAVE_TIGETSTR)
+ fkey = tigetstr(table[have].ti);
+#else
+ fkey = tgetstr(table[have].tc, &area);
+#endif
+ if (fkey != 0 && fkey != NO_STRING) {
+ screen->tcap_fkeys[have] = x_strdup(fkey);
+ } else {
+ screen->tcap_fkeys[have] = NO_STRING;
+ }
}
}
}
- if ((fkey = screen->tcap_fkeys[which]) != 0) {
- StringInput(xw, (Char *) fkey, strlen(fkey));
- return 1;
+ if (screen->tcap_fkeys != 0) {
+ if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) {
+ StringInput(xw, (Char *) fkey, strlen(fkey));
+ result = 1;
+ }
}
}
- return 0;
+
+ TRACE(("xtermcapString(keycode=%#x, mask=%#x) ->%d\n",
+ keycode, mask, result));
+
+ return result;
}
#endif /* OPT_TCAP_FKEYS */
@@ -323,6 +384,9 @@ get_termcap(char *name, char *buffer)
{
*buffer = 0; /* initialize, in case we're using terminfo's tgetent */
+#if USE_EXTENDED_NAMES
+ use_extended_names(TRUE);
+#endif
if (name != 0) {
if (tgetent(buffer, name) == 1) {
TRACE(("get_termcap(%s) succeeded (%s)\n", name,
diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin
index 07317da85..c0395aeae 100644
--- a/app/xterm/xtermcfg.hin
+++ b/app/xterm/xtermcfg.hin
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcfg.hin,v 1.169 2008/02/24 21:47:48 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.171 2008/07/27 15:17:07 tom Exp $ */
/*
* $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.61 2006/06/19 00:36:52 dickey Exp $
@@ -37,6 +37,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#undef ALLOWLOGFILEEXEC /* CF_ARG_ENABLE(enable-logfile-exec) */
#undef ALLOWLOGGING /* CF_ARG_ENABLE(enable-logging) */
#undef CC_HAS_PROTOS /* CF_ANSI_CC */
+#undef CSRG_BASED /* CF_TYPE_FD_MASK */
#undef DECL_ERRNO /* CF_ERRNO */
#undef DFT_COLORMODE /* AC_ARG_WITH(default-color-mode) */
#undef DFT_DECID /* AC_ARG_WITH(default-terminal-id) */
@@ -71,6 +72,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#undef HAVE_TERM_H /* AC_CHECK_HEADERS(term.h) */
#undef HAVE_TIGETSTR /* AC_CHECK_FUNCS(tigetstr) */
#undef HAVE_UNISTD_H /* AC_CHECK_HEADERS(unistd.h) */
+#undef HAVE_USE_EXTENDED_NAMES /* AC_CHECK_FUNCS(use_extended_names) */
#undef HAVE_UTMP /* CF_UTMP */
#undef HAVE_UTMP_UT_HOST /* CF_UTMP_UT_HOST */
#undef HAVE_UTMP_UT_SESSION /* CF_UTMP_UT_SESSION */