summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-04-14 09:02:47 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-04-14 09:02:47 +0000
commitd842c1980a3ba45a1f4ceb8b1634243925af1d1b (patch)
tree891e3a79cf94fc51c962b639b596e20e66117de9
parent1efdc33441c7ed493e975730da70dbf2dbbb5333 (diff)
Update to xterm 278. Tested by mpi@, shadchin@
-rw-r--r--app/xterm/INSTALL7
-rw-r--r--app/xterm/Imakefile7
-rw-r--r--app/xterm/MANIFEST2
-rw-r--r--app/xterm/Tekproc.c8
-rw-r--r--app/xterm/VTPrsTbl.c22
-rw-r--r--app/xterm/VTparse.def10
-rw-r--r--app/xterm/VTparse.h10
-rw-r--r--app/xterm/button.c832
-rw-r--r--app/xterm/charproc.c501
-rw-r--r--app/xterm/configure.in26
-rw-r--r--app/xterm/ctlseqs.ms105
-rw-r--r--app/xterm/ctlseqs.txt99
-rw-r--r--app/xterm/fontutils.c20
-rw-r--r--app/xterm/input.c23
-rw-r--r--app/xterm/main.c467
-rw-r--r--app/xterm/main.h8
-rw-r--r--app/xterm/menu.c4
-rw-r--r--app/xterm/misc.c381
-rw-r--r--app/xterm/os2main.c43
-rw-r--r--app/xterm/package/debian/changelog13
-rw-r--r--app/xterm/package/xterm.spec4
-rw-r--r--app/xterm/ptyx.h63
-rw-r--r--app/xterm/screen.c4
-rw-r--r--app/xterm/trace.c4
-rw-r--r--app/xterm/util.c81
-rw-r--r--app/xterm/version.h4
-rw-r--r--app/xterm/vttests/16colors.sh35
-rw-r--r--app/xterm/vttests/8colors.sh35
-rw-r--r--app/xterm/vttests/acolors.sh35
-rw-r--r--app/xterm/vttests/doublechars.sh35
-rw-r--r--app/xterm/vttests/dynamic.sh35
-rw-r--r--app/xterm/vttests/dynamic2.sh35
-rw-r--r--app/xterm/vttests/fonts.sh35
-rw-r--r--app/xterm/vttests/resize.sh35
-rw-r--r--app/xterm/vttests/title.sh35
-rw-r--r--app/xterm/xcharmouse.h7
-rw-r--r--app/xterm/xterm.h25
-rw-r--r--app/xterm/xterm.log.html123
-rw-r--r--app/xterm/xterm.man460
-rw-r--r--app/xterm/xterm_io.h4
-rw-r--r--app/xterm/xtermcfg.h7
-rw-r--r--app/xterm/xtermcfg.hin9
42 files changed, 2776 insertions, 922 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL
index c8f28eba9..0d0a4decc 100644
--- a/app/xterm/INSTALL
+++ b/app/xterm/INSTALL
@@ -1,4 +1,4 @@
--- $XTermId: INSTALL,v 1.126 2011/08/30 09:51:01 tom Exp $
+-- $XTermId: INSTALL,v 1.127 2011/12/22 01:59:16 tom Exp $
-------------------------------------------------------------------------------
-- Copyright 1997-2010,2011 by Thomas E. Dickey
--
@@ -281,6 +281,11 @@ The options (in alphabetic order):
Do not compile-in code that suppresses redundant updates to the
titlebar when the text has not changed.
+ --disable-selection-ops disable selection operations
+
+ Do not compile-in code to support the actions which allow users
+ to bind keys that use the selection or extract data from the screen.
+
--disable-session-mgt enable support for session management
Do not compile-in code which adds simple session management hooks
diff --git a/app/xterm/Imakefile b/app/xterm/Imakefile
index f65c30054..fcfacedf2 100644
--- a/app/xterm/Imakefile
+++ b/app/xterm/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XTermId: Imakefile,v 1.104 2011/07/02 00:48:49 tom Exp $
+XCOMM $XTermId: Imakefile,v 1.105 2011/11/29 10:19:20 Thorsten.Glaser Exp $
XCOMM
XCOMM Attention xterm porters
XCOMM
@@ -253,6 +253,11 @@ SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClien
NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB))
#endif
+#if defined(OpenBSDArchitecture) || defined(MirBSDArchitecture)
+/* On OpenBSD xterm is now setgid utmp */
+INSTUIDFLAGS= -m 2555 -g utmp
+#endif
+
#if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5)
#if AlternateUsrLibDir
#if ((OSMajorVersion == 4) && (OSMinorVersion >= 1))
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index b17561bd0..30e5fd378 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-276, version xterm-276
+MANIFEST for xterm-278, version xterm-278
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index d55998899..d86f08b26 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.190 2011/09/03 12:13:42 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.191 2011/12/27 10:19:51 tom Exp $ */
/*
* Copyright 2001-2010,2011 by Thomas E. Dickey
@@ -397,7 +397,7 @@ TekPtyData(void)
if (Tpushb == 0) {
if ((Tpushb = TypeMallocN(Char, 10)) == NULL
|| (Tline = TypeMallocN(XSegment, MAX_VTX)) == NULL) {
- fprintf(stderr, "%s: Not enough core for Tek mode\n", ProgramName);
+ xtermWarning("Not enough core for Tek mode\n");
if (Tpushb)
free(Tpushb);
Tfailed = True;
@@ -1573,8 +1573,8 @@ TekRealize(Widget gw,
else if (TestGIN(GIN_TERM_EOT_STR) == 0)
tekscr->gin_terminator = GIN_TERM_EOT;
else
- fprintf(stderr, "%s: illegal GIN terminator setting \"%s\"\n",
- ProgramName, tw->tek.gin_terminator_str);
+ xtermWarning("illegal GIN terminator setting \"%s\"\n",
+ tw->tek.gin_terminator_str);
gcv.graphics_exposures = True; /* default */
gcv.font = tw->tek.Tfont[tekscr->cur.fontsize]->fid;
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index 9c2cfdf36..35e0bc780 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,4 +1,4 @@
-/* $XTermId: VTPrsTbl.c,v 1.60 2011/09/11 15:00:46 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.63 2011/12/04 19:46:52 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -1786,8 +1786,8 @@ CASE_CSI_IGNORE,
CASE_CSI_IGNORE,
CASE_CSI_IGNORE,
/* @ A B C */
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_SL,
+CASE_SR,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* D E F G */
@@ -2188,8 +2188,8 @@ CASE_DECELR,
CASE_DECSLE,
/* | } ~ DEL */
CASE_DECRQLP,
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECIC,
+CASE_DECDC,
CASE_IGNORE,
/* 0x80 0x81 0x82 0x83 */
CASE_GROUND_STATE,
@@ -2348,8 +2348,8 @@ CASE_DECELR,
CASE_DECSLE,
/* udiaeresis yacute thorn ydiaeresis */
CASE_DECRQLP,
-CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECIC,
+CASE_DECDC,
CASE_IGNORE,
};
#endif /* OPT_DEC_LOCATOR */
@@ -5020,11 +5020,11 @@ CASE_GROUND_STATE,
/* 4 5 6 7 */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECBI,
CASE_DECSC,
/* 8 9 : ; */
CASE_DECRC,
-CASE_GROUND_STATE,
+CASE_DECFI,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* < = > ? */
@@ -5180,11 +5180,11 @@ CASE_GROUND_STATE,
/* acute mu paragraph periodcentered */
CASE_GROUND_STATE,
CASE_GROUND_STATE,
-CASE_GROUND_STATE,
+CASE_DECBI,
CASE_DECSC,
/* cedilla onesuperior masculine guillemotright */
CASE_DECRC,
-CASE_GROUND_STATE,
+CASE_DECFI,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* onequarter onehalf threequarters questiondown */
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index da9b5c7db..67254d142 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,10 +1,10 @@
-# $XTermId: VTparse.def,v 1.40 2010/08/24 21:26:42 tom Exp $
+# $XTermId: VTparse.def,v 1.42 2011/12/04 18:29:33 tom Exp $
#
# vile:confmode rs=lf
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1996-2009,2010 by Thomas E. Dickey
+# Copyright 1996-2010,2011 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -185,3 +185,9 @@ CASE_DECLL
CASE_DECRQM
CASE_RQM
CASE_CSI_DEC_DOLLAR_STATE
+CASE_SL
+CASE_SR
+CASE_DECDC
+CASE_DECIC
+CASE_DECBI
+CASE_DECFI
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index cafbbe3e2..bf9350f31 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,7 +1,7 @@
-/* $XTermId: VTparse.h,v 1.53 2010/08/24 21:27:13 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.55 2011/12/04 18:30:20 tom Exp $ */
/*
- * Copyright 2002-2009,2010 by Thomas E. Dickey
+ * Copyright 2002-2010,2011 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -266,5 +266,11 @@ extern Const PARSE_T esc_pct_table[];
#define CASE_DECRQM 144
#define CASE_RQM 145
#define CASE_CSI_DEC_DOLLAR_STATE 146
+#define CASE_SL 147
+#define CASE_SR 148
+#define CASE_DECDC 149
+#define CASE_DECIC 150
+#define CASE_DECBI 151
+#define CASE_DECFI 152
#endif /* included_VTparse_h */
diff --git a/app/xterm/button.c b/app/xterm/button.c
index c8678d0ff..d3c44e4fb 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.399 2011/08/19 00:09:26 Marco.Peereboom Exp $ */
+/* $XTermId: button.c,v 1.430 2012/01/07 02:00:35 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -62,6 +62,7 @@ button.c Handles button events in the terminal emulator.
#include <xterm.h>
#include <stdio.h>
+#include <ctype.h>
#include <assert.h>
#include <X11/Xatom.h>
@@ -119,6 +120,7 @@ button.c Handles button events in the terminal emulator.
#define KeyModifiers(event) (event->xbutton.state & OurModifiers)
#define IsBtnEvent(event) ((event)->type == ButtonPress || (event)->type == ButtonRelease)
+#define IsKeyEvent(event) ((event)->type == KeyPress || (event)->type == KeyRelease)
#define KeyState(x) (((int) ((x) & (ShiftMask|ControlMask))) \
+ (((x) & Mod1Mask) ? 2 : 0))
@@ -156,8 +158,7 @@ static void EndExtend(XtermWidget w, XEvent * event, String * params, Cardinal
static void ExtendExtend(XtermWidget xw, const CELL * cell);
static void PointToCELL(TScreen * screen, int y, int x, CELL * cell);
static void ReHiliteText(XtermWidget xw, CELL * first, CELL * last);
-static void SaltTextAway(XtermWidget xw, CELL * cellc, CELL * cell,
- String * params, Cardinal num_params);
+static void SaltTextAway(XtermWidget xw, CELL * cellc, CELL * cell);
static void SelectSet(XtermWidget xw, XEvent * event, String * params, Cardinal num_params);
static void SelectionReceived PROTO_XT_SEL_CB_ARGS;
static void StartSelect(XtermWidget xw, const CELL * cell);
@@ -173,12 +174,30 @@ static void do_select_end(XtermWidget xw, XEvent * event, String * params,
#define EXT_MOUSE_LIMIT (2047 - 32)
#define EXT_MOUSE_START (127 - 32)
+static int
+MouseLimit(TScreen * screen)
+{
+ int mouse_limit;
+
+ switch (screen->extend_coords) {
+ default:
+ mouse_limit = MOUSE_LIMIT;
+ break;
+ case SET_EXT_MODE_MOUSE:
+ mouse_limit = EXT_MOUSE_LIMIT;
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ case SET_URXVT_EXT_MODE_MOUSE:
+ mouse_limit = -1;
+ break;
+ }
+ return mouse_limit;
+}
+
static unsigned
EmitMousePosition(TScreen * screen, Char line[], unsigned count, int value)
{
- int mouse_limit = (screen->ext_mode_mouse
- ? EXT_MOUSE_LIMIT
- : MOUSE_LIMIT);
+ int mouse_limit = MouseLimit(screen);
/*
* Add pointer position to key sequence
@@ -190,14 +209,42 @@ EmitMousePosition(TScreen * screen, Char line[], unsigned count, int value)
* it's also somewhat useful as a past-end marker. We preserve
* this behavior for both normal and extended mouse modes.
*/
- if (value == mouse_limit) {
- line[count++] = CharOf(0);
- } else if (!screen->ext_mode_mouse || value < EXT_MOUSE_START) {
- line[count++] = CharOf(' ' + value + 1);
- } else {
- value += ' ' + 1;
- line[count++] = CharOf(0xC0 + (value >> 6));
- line[count++] = CharOf(0x80 + (value & 0x3F));
+ switch (screen->extend_coords) {
+ default:
+ if (value == mouse_limit) {
+ line[count++] = CharOf(0);
+ } else {
+ line[count++] = CharOf(' ' + value + 1);
+ }
+ break;
+ case SET_EXT_MODE_MOUSE:
+ if (value == mouse_limit) {
+ line[count++] = CharOf(0);
+ } else if (value < EXT_MOUSE_START) {
+ line[count++] = CharOf(' ' + value + 1);
+ } else {
+ value += ' ' + 1;
+ line[count++] = CharOf(0xC0 + (value >> 6));
+ line[count++] = CharOf(0x80 + (value & 0x3F));
+ }
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ count += (unsigned) sprintf((char *) line + count, "%d", value + 1);
+ break;
+ }
+ return count;
+}
+
+static unsigned
+EmitMousePositionSeparator(TScreen * screen, Char line[], unsigned count)
+{
+ switch (screen->extend_coords) {
+ case SET_SGR_EXT_MODE_MOUSE:
+ case SET_URXVT_EXT_MODE_MOUSE:
+ line[count++] = ';';
+ break;
}
return count;
}
@@ -1030,6 +1077,8 @@ HandleSelectExtend(Widget w,
TScreen *screen = TScreenOf(xw);
CELL cell;
+ TRACE(("HandleSelectExtend\n"));
+
screen->selection_time = event->xmotion.time;
switch (screen->eventMode) {
/* If not in one of the DEC mouse-reporting modes */
@@ -1062,6 +1111,8 @@ HandleKeyboardSelectExtend(Widget w,
if ((xw = getXtermWidget(w)) != 0) {
TScreen *screen = TScreenOf(xw);
+
+ TRACE(("HandleKeyboardSelectExtend\n"));
ExtendExtend(xw, &screen->cursorp);
}
}
@@ -1099,6 +1150,7 @@ HandleSelectEnd(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleSelectEnd\n"));
do_select_end(xw, event, params, num_params, False);
}
}
@@ -1112,6 +1164,7 @@ HandleKeyboardSelectEnd(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleKeyboardSelectEnd\n"));
do_select_end(xw, event, params, num_params, True);
}
}
@@ -1128,6 +1181,7 @@ HandleCopySelection(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleCopySelection\n"));
SelectSet(xw, event, params, *num_params);
}
}
@@ -1996,7 +2050,19 @@ SelectionReceived(Widget w,
#endif
for (i = 0; i < text_list_count; i++) {
size_t len = strlen(text_list[i]);
- _WriteSelectionData(screen, (Char *) text_list[i], len);
+ if (screen->selectToBuffer) {
+ size_t have = (screen->internal_select
+ ? strlen(screen->internal_select)
+ : 0);
+ size_t need = have + len + 1;
+ char *buffer = realloc(screen->internal_select, need);
+ if (buffer != 0) {
+ strcpy(buffer + have, text_list[i]);
+ screen->internal_select = buffer;
+ }
+ } else {
+ _WriteSelectionData(screen, (Char *) text_list[i], len);
+ }
}
#if OPT_PASTE64
if (screen->base64_paste) {
@@ -2042,6 +2108,7 @@ HandleInsertSelection(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleInsertSelection\n"));
if (!SendMousePosition(xw, event)) {
#if OPT_READLINE
int ldelta;
@@ -2129,6 +2196,7 @@ HandleSelectStart(Widget w,
TScreen *screen = TScreenOf(xw);
CELL cell;
+ TRACE(("HandleSelectStart\n"));
screen->firstValidRow = 0;
screen->lastValidRow = screen->max_row;
PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell);
@@ -2152,6 +2220,8 @@ HandleKeyboardSelectStart(Widget w,
if ((xw = getXtermWidget(w)) != 0) {
TScreen *screen = TScreenOf(xw);
+
+ TRACE(("HandleKeyboardSelectStart\n"));
do_select_start(xw, event, &screen->cursorp);
}
}
@@ -2242,7 +2312,7 @@ EndExtend(XtermWidget xw,
CELL cell;
unsigned count;
TScreen *screen = TScreenOf(xw);
- Char line[20];
+ Char line[64];
if (use_cursor_loc) {
cell = screen->cursorp;
@@ -2264,18 +2334,58 @@ EndExtend(XtermWidget xw,
if (isSameCELL(&(screen->rawPos), &(screen->startSel))
&& isSameCELL(&cell, &(screen->endSel))) {
/* Use short-form emacs select */
- line[count++] = 't';
+
+ switch (screen->extend_coords) {
+ case 0:
+ case SET_EXT_MODE_MOUSE:
+ line[count++] = 't';
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ line[count++] = '<';
+ break;
+ }
+
count = EmitMousePosition(screen, line, count, screen->endSel.col);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, screen->endSel.row);
+
+ switch (screen->extend_coords) {
+ case SET_SGR_EXT_MODE_MOUSE:
+ case SET_URXVT_EXT_MODE_MOUSE:
+ line[count++] = 't';
+ break;
+ }
} else {
/* long-form, specify everything */
- line[count++] = 'T';
+
+ switch (screen->extend_coords) {
+ case 0:
+ case SET_EXT_MODE_MOUSE:
+ line[count++] = 'T';
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ line[count++] = '<';
+ break;
+ }
+
count = EmitMousePosition(screen, line, count, screen->startSel.col);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, screen->startSel.row);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, screen->endSel.col);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, screen->endSel.row);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, cell.col);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, cell.row);
+
+ switch (screen->extend_coords) {
+ case SET_SGR_EXT_MODE_MOUSE:
+ case SET_URXVT_EXT_MODE_MOUSE:
+ line[count++] = 'T';
+ break;
+ }
}
v_write(screen->respond, line, count);
TrackText(xw, &zeroCELL, &zeroCELL);
@@ -2294,6 +2404,7 @@ HandleSelectSet(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleSelectSet\n"));
SelectSet(xw, event, params, *num_params);
}
}
@@ -2310,7 +2421,8 @@ SelectSet(XtermWidget xw,
TRACE(("SelectSet\n"));
/* Only do select stuff if non-null select */
if (!isSameCELL(&(screen->startSel), &(screen->endSel))) {
- SaltTextAway(xw, &(screen->startSel), &(screen->endSel), params, num_params);
+ SaltTextAway(xw, &(screen->startSel), &(screen->endSel));
+ _OwnSelection(xw, params, num_params);
} else {
ScrnDisownSelection(xw);
}
@@ -2429,6 +2541,7 @@ HandleStartExtend(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleStartExtend\n"));
do_start_extend(xw, event, params, num_params, False);
}
}
@@ -2442,6 +2555,7 @@ HandleKeyboardStartExtend(Widget w,
XtermWidget xw;
if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleKeyboardStartExtend\n"));
do_start_extend(xw, event, params, num_params, True);
}
}
@@ -2707,7 +2821,7 @@ class_of(LineData * ld, CELL * cell)
}
#endif
- assert(temp.col < ld->lineSize);
+ assert(temp.col < (int) ld->lineSize);
return CharacterClass((int) (ld->charData[temp.col]));
}
@@ -2842,7 +2956,7 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed)
Char *next = last;
unsigned data = ld->charData[col];
- assert(col < ld->lineSize);
+ assert(col < (int) ld->lineSize);
/* some internal points may not be drawn */
if (data == 0)
data = ' ';
@@ -3281,9 +3395,14 @@ TrackText(XtermWidget xw,
old_start = screen->startH;
old_end = screen->endH;
+ TRACE(("...previous(first=%d,%d, last=%d,%d)\n",
+ old_start.row, old_start.col,
+ old_end.row, old_end.col));
if (isSameCELL(&first, &old_start) &&
- isSameCELL(&last, &old_end))
+ isSameCELL(&last, &old_end)) {
return;
+ }
+
screen->startH = first;
screen->endH = last;
from = Coordinate(screen, &screen->startH);
@@ -3362,9 +3481,7 @@ ReHiliteText(XtermWidget xw,
static void
SaltTextAway(XtermWidget xw,
CELL * cellc,
- CELL * cell,
- String * params, /* selections */
- Cardinal num_params)
+ CELL * cell)
{
TScreen *screen = TScreenOf(xw);
int i, j = 0;
@@ -3435,7 +3552,6 @@ SaltTextAway(XtermWidget xw,
visibleChars(line, (unsigned) (lp - line))));
screen->selection_length = (unsigned long) (lp - line);
- _OwnSelection(xw, params, num_params);
}
#if OPT_PASTE64
@@ -3836,9 +3952,8 @@ _OwnSelection(XtermWidget xw,
if (screen->selection_length > limit) {
TRACE(("selection too big (%lu bytes), not storing in CUT_BUFFER%d\n",
screen->selection_length, cutbuffer));
- fprintf(stderr,
- "%s: selection too big (%lu bytes), not storing in CUT_BUFFER%d\n",
- ProgramName, screen->selection_length, cutbuffer);
+ xtermWarning("selection too big (%lu bytes), not storing in CUT_BUFFER%d\n",
+ screen->selection_length, cutbuffer);
} else {
/* This used to just use the UTF-8 data, which was totally
* broken as not even the corresponding paste code in Xterm
@@ -3974,7 +4089,7 @@ SaveText(TScreen * screen,
#endif
*eol = !LineTstWrapped(ld);
for (i = scol; i < ecol; i++) {
- assert(i < ld->lineSize);
+ assert(i < (int) ld->lineSize);
c = E2A(ld->charData[i]);
#if OPT_WIDE_CHARS
/* We want to strip out every occurrence of HIDDEN_CHAR AFTER a
@@ -4066,26 +4181,52 @@ BtnCode(XButtonEvent * event, int button)
}
static unsigned
-EmitButtonCode(TScreen * screen, Char * line, unsigned count, XButtonEvent * event)
+EmitButtonCode(TScreen * screen,
+ Char * line,
+ unsigned count,
+ XButtonEvent * event,
+ int button)
{
- int value = BtnCode(event, screen->mouse_button);
+ int value;
- if (!screen->ext_mode_mouse || value < 128) {
- line[count++] = CharOf(value);
+ if (screen->send_mouse_pos == X10_MOUSE) {
+ value = CharOf(' ' + button);
} else {
- line[count++] = CharOf(0xC0 + (value >> 6));
- line[count++] = CharOf(0x80 + (value & 0x3F));
+ value = BtnCode(event, button);
+ }
+
+ switch (screen->extend_coords) {
+ default:
+ line[count++] = CharOf(value);
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ value -= 32; /* encoding starts at zero */
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ count += (unsigned) sprintf((char *) line + count, "%d", value);
+ break;
+ case SET_EXT_MODE_MOUSE:
+ if (value < 128) {
+ line[count++] = CharOf(value);
+ } else {
+ line[count++] = CharOf(0xC0 + (value >> 6));
+ line[count++] = CharOf(0x80 + (value & 0x3F));
+ }
+ break;
}
return count;
}
+#define EMIT_BUTTON(button) EmitButtonCode(screen, line, count, event, button)
+
static void
EditorButton(XtermWidget xw, XButtonEvent * event)
{
TScreen *screen = TScreenOf(xw);
int pty = screen->respond;
- int mouse_limit = screen->ext_mode_mouse ? EXT_MOUSE_LIMIT : MOUSE_LIMIT;
- Char line[10];
+ int mouse_limit = MouseLimit(screen);
+ Char line[32];
+ Char final = 'M';
int row, col;
int button;
unsigned count = 0;
@@ -4111,11 +4252,13 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
else if (col > screen->max_col)
col = screen->max_col;
- /* Limit to representable mouse dimensions */
- if (row > mouse_limit)
- row = mouse_limit;
- if (col > mouse_limit)
- col = mouse_limit;
+ if (mouse_limit > 0) {
+ /* Limit to representable mouse dimensions */
+ if (row > mouse_limit)
+ row = mouse_limit;
+ if (col > mouse_limit)
+ col = mouse_limit;
+ }
/* Build key sequence starting with \E[M */
if (screen->control_eight_bits) {
@@ -4124,37 +4267,54 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
line[count++] = ANSI_ESC;
line[count++] = '[';
}
+ switch (screen->extend_coords) {
+ case 0:
+ case SET_EXT_MODE_MOUSE:
#if OPT_SCO_FUNC_KEYS
- if (xw->keyboard.type == keyboardIsSCO) {
- /*
- * SCO function key F1 is \E[M, which would conflict with xterm's
- * normal kmous.
- */
- line[count++] = '>';
- }
+ if (xw->keyboard.type == keyboardIsSCO) {
+ /*
+ * SCO function key F1 is \E[M, which would conflict with xterm's
+ * normal kmous.
+ */
+ line[count++] = '>';
+ }
#endif
- line[count++] = 'M';
+ line[count++] = final;
+ break;
+ case SET_SGR_EXT_MODE_MOUSE:
+ line[count++] = '<';
+ break;
+ }
/* Add event code to key sequence */
if (screen->send_mouse_pos == X10_MOUSE) {
- line[count++] = CharOf(' ' + button);
+ count = EMIT_BUTTON(button);
} else {
/* Button-Motion events */
switch (event->type) {
case ButtonPress:
screen->mouse_button = button;
- count = EmitButtonCode(screen, line, count, event);
+ count = EMIT_BUTTON(button);
break;
case ButtonRelease:
/*
* Wheel mouse interface generates release-events for buttons
* 4 and 5, coded here as 3 and 4 respectively. We change the
- * release for buttons 1..3 to a -1.
+ * release for buttons 1..3 to a -1, which will be later mapped
+ * into a "0" (some button was released).
*/
- if (button < 3)
- button = -1;
+ if (button < 3) {
+ switch (screen->extend_coords) {
+ case SET_SGR_EXT_MODE_MOUSE:
+ final = 'm';
+ break;
+ default:
+ button = -1;
+ break;
+ }
+ }
screen->mouse_button = button;
- count = EmitButtonCode(screen, line, count, event);
+ count = EMIT_BUTTON(button);
break;
case MotionNotify:
/* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion
@@ -4164,7 +4324,7 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
&& (col == screen->mouse_col)) {
changed = False;
} else {
- count = EmitButtonCode(screen, line, count, event);
+ count = EMIT_BUTTON(screen->mouse_button);
}
break;
default:
@@ -4180,9 +4340,18 @@ EditorButton(XtermWidget xw, XButtonEvent * event)
TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, line[count - 1]));
/* Add pointer position to key sequence */
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, col);
+ count = EmitMousePositionSeparator(screen, line, count);
count = EmitMousePosition(screen, line, count, row);
+ switch (screen->extend_coords) {
+ case SET_SGR_EXT_MODE_MOUSE:
+ case SET_URXVT_EXT_MODE_MOUSE:
+ line[count++] = final;
+ break;
+ }
+
/* Transmit key sequence to process running under xterm */
v_write(pty, line, count);
}
@@ -4212,3 +4381,550 @@ SendFocusButton(XtermWidget xw, XFocusChangeEvent * event)
return;
}
#endif /* OPT_FOCUS_EVENT */
+
+#if OPT_SELECTION_OPS
+/*
+ * Get the event-time, needed to process selections.
+ */
+static Time
+getEventTime(XEvent * event)
+{
+ Time result;
+
+ if (IsBtnEvent(event)) {
+ result = ((XButtonEvent *) event)->time;
+ } else if (IsKeyEvent(event)) {
+ result = ((XKeyEvent *) event)->time;
+ } else {
+ result = 0;
+ }
+
+ return result;
+}
+
+/* obtain the selection string, passing the endpoints to caller's parameters */
+static char *
+getSelectionString(XtermWidget xw,
+ Widget w,
+ XEvent * event,
+ String * params,
+ Cardinal *num_params,
+ CELL * start, CELL * finish)
+{
+ TScreen *screen = TScreenOf(xw);
+#if OPT_PASTE64
+ int base64_paste = (int) screen->base64_paste;
+#endif
+#if OPT_READLINE
+ int paste_brackets = (int) SCREEN_FLAG(screen, paste_brackets);
+#endif
+
+ /* override flags so that SelectionReceived only updates a buffer */
+#if OPT_PASTE64
+ screen->base64_paste = 0;
+#endif
+#if OPT_READLINE
+ SCREEN_FLAG_unset(screen, paste_brackets);
+#endif
+
+ screen->selectToBuffer = True;
+ screen->internal_select = 0;
+ xtermGetSelection(w, getEventTime(event), params + 1, *num_params - 1, NULL);
+ screen->selectToBuffer = False;
+
+ if (screen->internal_select != 0) {
+ TRACE(("getSelectionString %d:%s\n",
+ (int) strlen(screen->internal_select),
+ screen->internal_select));
+ *start = screen->startSel;
+ *finish = screen->endSel;
+ } else {
+ memset(start, 0, sizeof(*start));
+ memset(finish, 0, sizeof(*finish));
+ }
+#if OPT_PASTE64
+ screen->base64_paste = (Cardinal) base64_paste;
+#endif
+#if OPT_READLINE
+ if (paste_brackets)
+ SCREEN_FLAG_set(screen, paste_brackets);
+#endif
+ return screen->internal_select;
+}
+
+/* obtain data from the screen, passing the endpoints to caller's parameters */
+static char *
+getDataFromScreen(XtermWidget xw, String method, CELL * start, CELL * finish)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ CELL save_old_start = screen->startH;
+ CELL save_old_end = screen->endH;
+
+ CELL save_startSel = screen->startSel;
+ CELL save_startRaw = screen->startRaw;
+ CELL save_finishSel = screen->endSel;
+ CELL save_finishRaw = screen->endRaw;
+
+ int save_firstValidRow = screen->firstValidRow;
+ int save_lastValidRow = screen->lastValidRow;
+
+ SelectUnit saveUnits = screen->selectUnit;
+ SelectUnit saveMap = screen->selectMap[0];
+#if OPT_SELECT_REGEX
+ char *saveExpr = screen->selectExpr[0];
+#endif
+
+ Char *save_selection_data = screen->selection_data;
+ int save_selection_size = screen->selection_size;
+ unsigned long save_selection_length = screen->selection_length;
+
+ char *result = 0;
+
+ TRACE(("getDataFromScreen %s\n", method));
+
+ screen->selection_data = 0;
+ screen->selection_size = 0;
+ screen->selection_length = 0;
+
+ lookupSelectUnit(xw, 0, method);
+ screen->selectUnit = screen->selectMap[0];
+
+ start->row = screen->cur_row;
+ start->col = screen->cur_col;
+ *finish = *start;
+
+ ComputeSelect(xw, start, finish, False);
+ SaltTextAway(xw, &(screen->startSel), &(screen->endSel));
+
+ if (screen->selection_length && screen->selection_data) {
+ TRACE(("...getDataFromScreen selection_data %.*s\n",
+ (int) screen->selection_length,
+ screen->selection_data));
+ result = malloc(screen->selection_length + 1);
+ if (result) {
+ memcpy(result, screen->selection_data, screen->selection_length);
+ result[screen->selection_length] = 0;
+ }
+ free(screen->selection_data);
+ }
+
+ TRACE(("...getDataFromScreen restoring previous selection\n"));
+
+ screen->startSel = save_startSel;
+ screen->startRaw = save_startRaw;
+ screen->endSel = save_finishSel;
+ screen->endRaw = save_finishRaw;
+
+ screen->firstValidRow = save_firstValidRow;
+ screen->lastValidRow = save_lastValidRow;
+
+ screen->selectUnit = saveUnits;
+ screen->selectMap[0] = saveMap;
+#if OPT_SELECT_REGEX
+ screen->selectExpr[0] = saveExpr;
+#endif
+
+ screen->selection_data = save_selection_data;
+ screen->selection_size = save_selection_size;
+ screen->selection_length = save_selection_length;
+
+ TrackText(xw, &save_old_start, &save_old_end);
+
+ TRACE(("...getDataFromScreen done\n"));
+ return result;
+}
+
+/*
+ * Split-up the format before substituting data, to avoid quoting issues.
+ * The resource mechanism has a limited ability to handle escapes. We take
+ * the result as if it were an sh-type string and parse it into a regular
+ * argv array.
+ */
+static char **
+tokenizeFormat(String format)
+{
+ char **result = 0;
+ int pass;
+ int argc;
+ int n;
+
+ format = x_skip_blanks(format);
+ if (*format != '\0') {
+ char *blob = x_strdup(format);
+
+ for (pass = 0; pass < 2; ++pass) {
+ int used = 0;
+ int first = 1;
+ int escaped = 0;
+ int squoted = 0;
+ int dquoted = 0;
+
+ argc = 0;
+ for (n = 0; format[n] != '\0'; ++n) {
+ if (escaped) {
+ blob[used++] = format[n];
+ escaped = 0;
+ } else if (format[n] == '"') {
+ if (!squoted) {
+ if (!dquoted)
+ blob[used++] = format[n];
+ dquoted = !dquoted;
+ }
+ } else if (format[n] == '\'') {
+ if (!dquoted) {
+ if (!squoted)
+ blob[used++] = format[n];
+ squoted = !squoted;
+ }
+ } else if (format[n] == '\\') {
+ blob[used++] = format[n];
+ escaped = 1;
+ } else {
+ if (first) {
+ first = 0;
+ if (pass) {
+ result[argc] = &blob[n];
+ }
+ ++argc;
+ }
+ if (isspace((Char) format[n])) {
+ first = !isspace((Char) format[n + 1]);
+ if (squoted || dquoted) {
+ blob[used++] = format[n];
+ } else if (first) {
+ blob[used++] = '\0';
+ }
+ } else {
+ blob[used++] = format[n];
+ }
+ }
+ }
+ blob[used] = '\0';
+ assert(strlen(blob) <= strlen(format));
+ if (!pass) {
+ result = TypeCallocN(char *, argc + 1);
+ if (result == 0) {
+ break;
+ }
+ }
+ }
+ }
+#if OPT_TRACE
+ if (result) {
+ TRACE(("tokenizeFormat %s\n", format));
+ for (argc = 0; result[argc]; ++argc) {
+ TRACE(("argv[%d] = %s\n", argc, result[argc]));
+ }
+ }
+#endif
+
+ return result;
+}
+
+static void
+formatVideoAttrs(XtermWidget xw, char *buffer, CELL * cell)
+{
+ TScreen *screen = TScreenOf(xw);
+ LineData *ld = GET_LINEDATA(screen, cell->row);
+
+ *buffer = '\0';
+ if (ld != 0 && cell->col < (int) ld->lineSize) {
+ Char attribs = ld->attribs[cell->col];
+ const char *delim = "";
+
+ if (attribs & INVERSE) {
+ buffer += sprintf(buffer, "7");
+ delim = ";";
+ }
+ if (attribs & UNDERLINE) {
+ buffer += sprintf(buffer, "%s4", delim);
+ delim = ";";
+ }
+ if (attribs & BOLD) {
+ buffer += sprintf(buffer, "%s1", delim);
+ delim = ";";
+ }
+ if (attribs & BLINK) {
+ buffer += sprintf(buffer, "%s5", delim);
+ delim = ";";
+ }
+#if OPT_ISO_COLORS
+ if (attribs & FG_COLOR) {
+ unsigned fg = extract_fg(xw, ld->color[cell->col], attribs);
+ if (fg < 8) {
+ fg += 30;
+ } else if (fg < 16) {
+ fg += 90;
+ } else {
+ buffer += sprintf(buffer, "%s38;5", delim);
+ delim = ";";
+ }
+ buffer += sprintf(buffer, "%s%u", delim, fg);
+ delim = ";";
+ }
+ if (attribs & BG_COLOR) {
+ unsigned bg = extract_bg(xw, ld->color[cell->col], attribs);
+ if (bg < 8) {
+ bg += 40;
+ } else if (bg < 16) {
+ bg += 100;
+ } else {
+ buffer += sprintf(buffer, "%s48;5", delim);
+ delim = ";";
+ }
+ buffer += sprintf(buffer, "%s%u", delim, bg);
+ delim = ";";
+ }
+#endif
+ }
+}
+
+/* substitute data into format, reallocating the result */
+static char *
+expandFormat(XtermWidget xw,
+ const char *format,
+ char *data,
+ CELL * start,
+ CELL * finish)
+{
+ char *result = 0;
+ if (!IsEmpty(format)) {
+ static char empty[1];
+ int pass;
+ int n;
+ char numbers[80];
+
+ if (data == 0)
+ data = empty;
+
+ for (pass = 0; pass < 2; ++pass) {
+ size_t need = 0;
+
+ for (n = 0; format[n] != '\0'; ++n) {
+ char *value = 0;
+
+ if (format[n] == '%') {
+ switch (format[++n]) {
+ case '%':
+ if (pass) {
+ result[need] = format[n];
+ }
+ ++need;
+ break;
+ case 'P':
+ sprintf(numbers, "%d;%d",
+ TScreenOf(xw)->topline + start->row + 1,
+ start->col + 1);
+ value = numbers;
+ break;
+ case 'p':
+ sprintf(numbers, "%d;%d",
+ TScreenOf(xw)->topline + finish->row + 1,
+ finish->col + 1);
+ value = numbers;
+ break;
+ case 'S':
+ sprintf(numbers, "%u", (unsigned) strlen(data));
+ value = numbers;
+ break;
+ case 's':
+ value = data;
+ break;
+ case 'T':
+ if ((value = x_strtrim(data)) != 0) {
+ sprintf(numbers, "%u", (unsigned) strlen(value));
+ free(value);
+ } else {
+ strcpy(numbers, "0");
+ }
+ value = numbers;
+ break;
+ case 't':
+ value = x_strtrim(data);
+ break;
+ case 'V':
+ formatVideoAttrs(xw, numbers, start);
+ value = numbers;
+ break;
+ case 'v':
+ formatVideoAttrs(xw, numbers, finish);
+ value = numbers;
+ break;
+ default:
+ if (pass) {
+ result[need] = format[n];
+ }
+ --n;
+ ++need;
+ break;
+ }
+ if (value != 0) {
+ if (pass) {
+ strcpy(result + need, value);
+ }
+ need += strlen(value);
+ if (value != numbers && value != data) {
+ free(value);
+ }
+ }
+ } else {
+ if (pass) {
+ result[need] = format[n];
+ }
+ ++need;
+ }
+ }
+ if (pass) {
+ result[need] = '\0';
+ } else {
+ ++need;
+ result = malloc(need);
+ if (result == 0) {
+ break;
+ }
+ }
+ }
+ }
+ TRACE(("expandFormat(%s) = %s\n", NonNull(format), NonNull(result)));
+ return result;
+}
+
+/* execute the command after forking. The main process frees its data */
+static void
+executeCommand(char **argv)
+{
+ if (fork() == 0) {
+ execvp(argv[0], argv);
+ exit(EXIT_FAILURE);
+ }
+}
+
+static void
+freeArgv(char *blob, char **argv)
+{
+ int n;
+
+ if (blob) {
+ free(blob);
+ if (argv) {
+ for (n = 0; argv[n]; ++n)
+ free(argv[n]);
+ free(argv);
+ }
+ }
+}
+
+void
+HandleExecFormatted(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params, /* selections */
+ Cardinal *num_params)
+{
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleExecFormatted(%d)\n", *num_params));
+
+ if (*num_params > 1) {
+ CELL start, finish;
+ char *data;
+ char **argv;
+ char *blob;
+ int argc;
+
+ data = getSelectionString(xw, w, event, params, num_params,
+ &start, &finish);
+ argv = tokenizeFormat(params[0]);
+ blob = argv[0];
+ for (argc = 0; argv[argc] != 0; ++argc) {
+ argv[argc] = expandFormat(xw, argv[argc], data, &start, &finish);
+ }
+ executeCommand(argv);
+ freeArgv(blob, argv);
+ }
+ }
+}
+
+void
+HandleExecSelectable(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params, /* selections */
+ Cardinal *num_params)
+{
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleExecSelectable(%d)\n", *num_params));
+
+ if (*num_params == 2) {
+ CELL start, finish;
+ char *data;
+ char **argv;
+ char *blob;
+ int argc;
+
+ data = getDataFromScreen(xw, params[1], &start, &finish);
+ argv = tokenizeFormat(params[0]);
+ blob = argv[0];
+ for (argc = 0; argv[argc] != 0; ++argc) {
+ argv[argc] = expandFormat(xw, argv[argc], data, &start, &finish);
+ }
+ executeCommand(argv);
+ freeArgv(blob, argv);
+ free(data);
+ }
+ }
+}
+
+void
+HandleInsertFormatted(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params, /* selections */
+ Cardinal *num_params)
+{
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleInsertFormatted(%d)\n", *num_params));
+
+ if (*num_params > 1) {
+ CELL start, finish;
+ char *data;
+ char *temp = x_strdup(params[0]);
+
+ data = getSelectionString(xw, w, event, params, num_params,
+ &start, &finish);
+ temp = expandFormat(xw, temp, data, &start, &finish);
+ unparseputs(xw, temp);
+ free(data);
+ free(temp);
+ }
+ }
+}
+
+void
+HandleInsertSelectable(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params, /* selections */
+ Cardinal *num_params)
+{
+ XtermWidget xw;
+
+ if ((xw = getXtermWidget(w)) != 0) {
+ TRACE(("HandleInsertSelectable(%d)\n", *num_params));
+
+ if (*num_params == 2) {
+ CELL start, finish;
+ char *data;
+ char *temp = x_strdup(params[0]);
+
+ data = getDataFromScreen(xw, params[1], &start, &finish);
+ temp = expandFormat(xw, temp, data, &start, &finish);
+ unparseputs(xw, temp);
+ free(data);
+ free(temp);
+ }
+ }
+}
+#endif /* OPT_SELECTION_OPS */
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index c5697a082..ec5f498d7 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1132 2011/09/04 18:18:16 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1161 2012/01/19 00:22:08 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -173,8 +173,8 @@ static void StopBlinking(TScreen * /* screen */ );
#define StopBlinking(screen) /* nothing */
#endif
-#if OPT_INPUT_METHOD
-static void PreeditPosition(TScreen * screen);
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+static void PreeditPosition(XtermWidget /* xw */ );
#endif
#define DEFAULT -1
@@ -341,6 +341,12 @@ static XtActionsRec actionsList[] = {
#if OPT_SCROLL_LOCK
{ "scroll-lock", HandleScrollLock },
#endif
+#if OPT_SELECTION_OPS
+ { "exec-formatted", HandleExecFormatted },
+ { "exec-selectable", HandleExecSelectable },
+ { "insert-formatted", HandleInsertFormatted },
+ { "insert-selectable", HandleInsertSelectable },
+#endif
#if OPT_SHIFT_FONTS
{ "larger-vt-font", HandleLargerFont },
{ "smaller-vt-font", HandleSmallerFont },
@@ -434,6 +440,7 @@ static XtResource xterm_resources[] =
Bres(XtNtrimSelection, XtCTrimSelection, screen.trim_selection, False),
Bres(XtNunderLine, XtCUnderLine, screen.underline, True),
Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, False),
+ Bres(XtNvisualBellLine, XtCVisualBellLine, screen.flash_line, False),
Dres(XtNscaleHeight, XtCScaleHeight, screen.scale_height, "1.0"),
@@ -473,6 +480,7 @@ static XtResource xterm_resources[] =
screen.disallowedTcapOps, DEF_DISALLOWED_TCAP),
Sres(XtNdisallowedWindowOps, XtCDisallowedWindowOps,
screen.disallowedWinOps, DEF_DISALLOWED_WINDOW),
+ Sres(XtNeightBitMeta, XtCEightBitMeta, screen.eight_bit_meta_s, DEF_8BIT_META),
Sres(XtNeightBitSelectTypes, XtCEightBitSelectTypes,
screen.eightbit_select_types, NULL),
Sres(XtNfont, XtCFont, misc.default_font.f_n, DEFFONT),
@@ -1067,7 +1075,7 @@ set_ansi_conformance(TScreen * screen, int level)
/* FALLTHRU */
case 2:
screen->gsets[0] = 'B'; /* G0 is ASCII */
- screen->gsets[1] = 'B'; /* G1 is ISO Latin-1 (FIXME) */
+ screen->gsets[1] = 'B'; /* G1 is ISO Latin-1 */
screen->curgl = 0;
screen->curgr = 1;
break;
@@ -1289,15 +1297,6 @@ select_charset(struct ParseState *sp, int type, int size)
}
static int
-minus_if_default(int which)
-{
- int result = (nparam > which) ? param[which] : -1;
- if (result <= 0)
- result = -1;
- return result;
-}
-
-static int
zero_if_default(int which)
{
int result = (nparam > which) ? param[which] : 0;
@@ -1570,9 +1569,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (sp->nextstate == CASE_PRINT) {
SafeAlloc(IChar, sp->print_area, sp->print_used, sp->print_size);
if (new_string == 0) {
- fprintf(stderr,
- "Cannot allocate %lu bytes for printable text\n",
- (unsigned long) new_length);
+ xtermWarning("Cannot allocate %lu bytes for printable text\n",
+ (unsigned long) new_length);
continue;
}
#if OPT_VT52_MODE
@@ -1608,9 +1606,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (sp->parsestate == sos_table) {
SafeAlloc(Char, sp->string_area, sp->string_used, sp->string_size);
if (new_string == 0) {
- fprintf(stderr,
- "Cannot allocate %lu bytes for string mode %d\n",
- (unsigned long) new_length, sp->string_mode);
+ xtermWarning("Cannot allocate %lu bytes for string mode %d\n",
+ (unsigned long) new_length, sp->string_mode);
continue;
}
#if OPT_WIDE_CHARS
@@ -2764,6 +2761,58 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
ResetState(sp);
break;
+ case CASE_SL: /* ISO 6429, non-DEC */
+ TRACE(("CASE_SL - scroll left\n"));
+ if ((count = param[0]) < 1)
+ count = 1;
+ xtermScrollLR(xw, count, True);
+ ResetState(sp);
+ break;
+
+ case CASE_SR: /* ISO 6429, non-DEC */
+ TRACE(("CASE_SR - scroll right\n"));
+ if ((count = param[0]) < 1)
+ count = 1;
+ xtermScrollLR(xw, count, False);
+ ResetState(sp);
+ break;
+
+ case CASE_DECDC:
+ TRACE(("CASE_DC - delete column\n"));
+ if (screen->terminal_id >= 400) {
+ if ((count = param[0]) < 1)
+ count = 1;
+ xtermColScroll(xw, count, True, screen->cur_col);
+ }
+ ResetState(sp);
+ break;
+
+ case CASE_DECIC:
+ TRACE(("CASE_IC - insert column\n"));
+ if (screen->terminal_id >= 400) {
+ if ((count = param[0]) < 1)
+ count = 1;
+ xtermColScroll(xw, count, False, screen->cur_col);
+ }
+ ResetState(sp);
+ break;
+
+ case CASE_DECBI:
+ TRACE(("CASE_BI - back index\n"));
+ if (screen->terminal_id >= 400) {
+ xtermColIndex(xw, True);
+ }
+ ResetState(sp);
+ break;
+
+ case CASE_DECFI:
+ TRACE(("CASE_FI - forward index\n"));
+ if (screen->terminal_id >= 400) {
+ xtermColIndex(xw, False);
+ }
+ ResetState(sp);
+ break;
+
case CASE_IND:
TRACE(("CASE_IND - index\n"));
xtermIndex(xw, 1);
@@ -3370,8 +3419,7 @@ v_write(int f, const Char * data, unsigned len)
v_bufend = v_bufptr + len;
} else {
/* no memory: ignore entire write request */
- fprintf(stderr, "%s: cannot allocate buffer space\n",
- ProgramName);
+ xtermWarning("cannot allocate buffer space\n");
v_buffer = v_bufstr; /* restore clobbered pointer */
}
}
@@ -3543,8 +3591,8 @@ in_put(XtermWidget xw)
if (screen->cursor_state)
HideCursor();
ShowCursor();
-#if OPT_INPUT_METHOD
- PreeditPosition(screen);
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+ PreeditPosition(xw);
#endif
} else {
updateCursor(screen);
@@ -3644,8 +3692,8 @@ in_put(XtermWidget xw)
if (screen->cursor_state)
HideCursor();
ShowCursor();
-#if OPT_INPUT_METHOD
- PreeditPosition(screen);
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+ PreeditPosition(xw);
#endif
} else {
updateCursor(screen);
@@ -3736,27 +3784,29 @@ doinput(void)
return nextPtyData(screen, VTbuffer);
}
-#if OPT_INPUT_METHOD
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
/*
* For OverTheSpot, client has to inform the position for XIM preedit.
*/
static void
-PreeditPosition(TScreen * screen)
+PreeditPosition(XtermWidget xw)
{
+ TInput *input = lookupTInput(xw, (Widget) xw);
+ TScreen *screen = TScreenOf(xw);
LineData *ld;
XPoint spot;
XVaNestedList list;
- if (screen->xic
+ if (input->xic
&& (ld = getLineData(screen, screen->cur_row)) != 0) {
spot.x = (short) LineCursorX(screen, ld, screen->cur_col);
- spot.y = (short) (CursorY(screen, screen->cur_row) + screen->fs_ascent);
+ spot.y = (short) (CursorY(screen, screen->cur_row) + xw->misc.xim_fs_ascent);
list = XVaCreateNestedList(0,
XNSpotLocation, &spot,
XNForeground, T_COLOR(screen, TEXT_FG),
XNBackground, T_COLOR(screen, TEXT_BG),
- NULL);
- XSetICValues(screen->xic, XNPreeditAttributes, list, NULL);
+ (void *) 0);
+ XSetICValues(input->xic, XNPreeditAttributes, list, (void *) 0);
XFree(list);
}
}
@@ -4012,8 +4062,8 @@ HandleStructNotify(Widget w GCC_UNUSED,
save.menu_border));
/*
- * FIXME: Window manager still may be using the old
- * values. Try to fool it.
+ * Window manager still may be using the old values.
+ * Try to fool it.
*/
REQ_RESIZE((Widget) xw,
screen->fullVwin.fullwidth,
@@ -4358,7 +4408,20 @@ dpmodes(XtermWidget xw, BitFunc func)
break;
#endif
case SET_EXT_MODE_MOUSE:
- set_bool_mode(screen->ext_mode_mouse);
+ /* FALLTHRU */
+ case SET_SGR_EXT_MODE_MOUSE:
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ /*
+ * Rather than choose an arbitrary precedence among the coordinate
+ * modes, they are mutually exclusive. For consistency, a reset is
+ * only effective against the matching mode.
+ */
+ if (IsSM()) {
+ screen->extend_coords = param[i];
+ } else if (screen->extend_coords == param[i]) {
+ screen->extend_coords = 0;
+ }
break;
case 1010: /* rxvt */
set_bool_mode(screen->scrollttyoutput);
@@ -4369,8 +4432,9 @@ dpmodes(XtermWidget xw, BitFunc func)
update_scrollkey();
break;
case 1034:
- set_bool_mode(screen->input_eight_bits);
- update_alt_esc();
+ if (screen->eight_bit_meta != ebNever) {
+ set_bool_mode(screen->eight_bit_meta);
+ }
break;
#if OPT_NUM_LOCK
case 1035:
@@ -4563,7 +4627,11 @@ savemodes(XtermWidget xw)
break;
#endif
case SET_EXT_MODE_MOUSE:
- DoSM(DP_X_EXT_MOUSE, screen->ext_mode_mouse);
+ /* FALLTHRU */
+ case SET_SGR_EXT_MODE_MOUSE:
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ DoSM(DP_X_EXT_MOUSE, screen->extend_coords);
break;
case 1048:
if (!xw->misc.titeInhibit) {
@@ -4734,7 +4802,11 @@ restoremodes(XtermWidget xw)
break;
#endif
case SET_EXT_MODE_MOUSE:
- DoRM(DP_X_EXT_MOUSE, screen->ext_mode_mouse);
+ /* FALLTHRU */
+ case SET_SGR_EXT_MODE_MOUSE:
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ DoRM(DP_X_EXT_MOUSE, screen->extend_coords);
break;
case 1048:
if (!xw->misc.titeInhibit) {
@@ -4933,7 +5005,7 @@ window_ops(XtermWidget xw)
case ewSetWinSizePixels: /* Resize the window to given size in pixels */
if (AllowWindowOps(xw, ewSetWinSizePixels)) {
- RequestResize(xw, minus_if_default(1), minus_if_default(2), False);
+ RequestResize(xw, param[1], param[2], False);
}
break;
@@ -4960,7 +5032,7 @@ window_ops(XtermWidget xw)
case ewSetWinSizeChars: /* Resize the text-area, in characters */
if (AllowWindowOps(xw, ewSetWinSizeChars)) {
- RequestResize(xw, minus_if_default(1), minus_if_default(2), True);
+ RequestResize(xw, param[1], param[2], True);
}
break;
@@ -5843,8 +5915,8 @@ VTInitialize_locale(XtermWidget xw)
}
#endif
-static void
-ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item)
+void
+lookupSelectUnit(XtermWidget xw, Cardinal item, String value)
{
/* *INDENT-OFF* */
static struct {
@@ -5863,18 +5935,18 @@ ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item)
};
/* *INDENT-ON* */
- String res = TScreenOf(wreq)->onClick[item];
- String next = x_skip_nonblanks(res);
+ TScreen *screen = TScreenOf(xw);
+ String next = x_skip_nonblanks(value);
Cardinal n;
- TScreenOf(wnew)->selectMap[item] = NSELECTUNITS;
+ screen->selectMap[item] = NSELECTUNITS;
for (n = 0; n < XtNumber(table); ++n) {
- if (!x_strncasecmp(table[n].name, res, (unsigned) (next - res))) {
- TScreenOf(wnew)->selectMap[item] = table[n].code;
+ if (!x_strncasecmp(table[n].name, value, (unsigned) (next - value))) {
+ screen->selectMap[item] = table[n].code;
#if OPT_SELECT_REGEX
if (table[n].code == Select_REGEX) {
- TScreenOf(wnew)->selectExpr[item] = x_strtrim(next);
- TRACE(("Parsed regex \"%s\"\n", TScreenOf(wnew)->selectExpr[item]));
+ screen->selectExpr[item] = x_strtrim(next);
+ TRACE(("Parsed regex \"%s\"\n", screen->selectExpr[item]));
}
#endif
break;
@@ -5882,6 +5954,12 @@ ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item)
}
}
+static void
+ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item)
+{
+ lookupSelectUnit(wnew, item, TScreenOf(wreq)->onClick[item]);
+}
+
/*
* Parse a comma-separated list, returning a string which the caller must
* free, and updating the source pointer.
@@ -5937,7 +6015,7 @@ set_flags_from_list(char *target,
value = (int) strtol(next, &temp, 0);
if (!IsEmpty(temp)) {
- fprintf(stderr, "Expected a number: %s\n", next);
+ xtermWarning("Expected a number: %s\n", next);
} else {
for (n = 0; n < limit; ++n) {
if (list[n].code == value) {
@@ -5958,7 +6036,7 @@ set_flags_from_list(char *target,
}
}
if (!found) {
- fprintf(stderr, "Unrecognized keyword: %s\n", next);
+ xtermWarning("Unrecognized keyword: %s\n", next);
} else {
TRACE(("...found %s (%d)\n", next, value));
}
@@ -6056,6 +6134,14 @@ VTInitialize(Widget wrequest,
#undef DATA
#endif
+#define DATA(name) { #name, eb##name }
+ static FlagList tbl8BitMeta[] =
+ {
+ DATA(Never)
+ ,DATA(Locale)
+ };
+#undef DATA
+
XtermWidget request = (XtermWidget) wrequest;
XtermWidget wnew = (XtermWidget) new_arg;
Widget my_parent = SHELL_OF(wnew);
@@ -6221,6 +6307,7 @@ VTInitialize(Widget wrequest,
init_Ires(screen.title_modes);
init_Bres(screen.visualbell);
+ init_Bres(screen.flash_line);
init_Ires(screen.visualBellDelay);
init_Bres(screen.poponbell);
init_Ires(misc.limit_resize);
@@ -6699,6 +6786,22 @@ VTInitialize(Widget wrequest,
xtermSaveVTFonts(wnew);
#endif /* OPT_WIDE_CHARS */
+ init_Sres(screen.eight_bit_meta_s);
+ wnew->screen.eight_bit_meta =
+ extendedBoolean(request->screen.eight_bit_meta_s, tbl8BitMeta, uLast);
+ if (wnew->screen.eight_bit_meta == ebLocale) {
+#if OPT_WIDE_CHARS
+ if (xtermEnvUTF8()) {
+ wnew->screen.eight_bit_meta = ebFalse;
+ TRACE(("...eightBitMeta is false due to locale\n"));
+ } else
+#endif /* OPT_WIDE_CHARS */
+ {
+ wnew->screen.eight_bit_meta = ebTrue;
+ TRACE(("...eightBitMeta is true due to locale\n"));
+ }
+ }
+
init_Bres(screen.always_bold_mode);
init_Bres(screen.bold_mode);
init_Bres(screen.underline);
@@ -6843,13 +6946,15 @@ releaseWindowGCs(XtermWidget xw, VTwin * win)
name = 0; \
}
-#if OPT_INPUT_METHOD
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
static void
-cleanupInputMethod(TScreen * screen)
+cleanupInputMethod(XtermWidget xw)
{
- if (screen->xim) {
- XCloseIM(screen->xim);
- screen->xim = 0;
+ TInput *input = lookupTInput(xw, (Widget) xw);
+
+ if (input->xim) {
+ XCloseIM(input->xim);
+ input->xim = 0;
TRACE(("freed screen->xim\n"));
}
}
@@ -6881,6 +6986,12 @@ VTDestroy(Widget w GCC_UNUSED)
free(last->windowName);
free(last);
}
+#if OPT_ISO_COLORS
+ TRACE_FREE_LEAK(screen->cmap_data);
+ for (n = 0; n < MAXCOLORS; n++) {
+ TRACE_FREE_LEAK(screen->Acolors[n].resource);
+ }
+#endif
TRACE_FREE_LEAK(screen->save_ptr);
TRACE_FREE_LEAK(screen->saveBuf_data);
TRACE_FREE_LEAK(screen->saveBuf_index);
@@ -6896,8 +7007,11 @@ VTDestroy(Widget w GCC_UNUSED)
TRACE_FREE_LEAK(xw->misc.localefilter);
#endif
#endif
+ TRACE_FREE_LEAK(xw->misc.T_geometry);
+ TRACE_FREE_LEAK(xw->misc.geo_metry);
+ TRACE_FREE_LEAK(xw->screen.term_id);
#if OPT_INPUT_METHOD
- cleanupInputMethod(screen);
+ cleanupInputMethod(xw);
#endif
releaseCursorGCs(xw);
releaseWindowGCs(xw, &(screen->fullVwin));
@@ -6916,6 +7030,15 @@ VTDestroy(Widget w GCC_UNUSED)
xtermCloseFonts(xw, screen->fnts);
noleaks_cachedCgs(xw);
+ TRACE_FREE_LEAK(screen->selection_targets_8bit);
+#if OPT_SELECT_REGEX
+ for (n = 0; n < NSELECTUNITS; ++n) {
+ if (screen->selectMap[n] == Select_REGEX) {
+ TRACE_FREE_LEAK(screen->selectExpr[n]);
+ }
+ }
+#endif
+
#if OPT_RENDERFONT
for (n = 0; n < NMENUFONTS; ++n) {
xtermCloseXft(screen, &(screen->renderFontNorm[n]));
@@ -6960,6 +7083,7 @@ VTDestroy(Widget w GCC_UNUSED)
#if OPT_RENDERFONT
TRACE_FREE_LEAK(xw->misc.face_name);
TRACE_FREE_LEAK(xw->misc.face_wide_name);
+ TRACE_FREE_LEAK(xw->misc.render_font_s);
#endif
#if OPT_SELECT_REGEX
@@ -7028,9 +7152,8 @@ VTRealize(Widget w,
screen->menu_font_number)) {
if (XmuCompareISOLatin1(myfont->f_n, DEFFONT) != 0) {
char *use_font = x_strdup(DEFFONT);
- fprintf(stderr,
- "%s: unable to open font \"%s\", trying \"%s\"....\n",
- ProgramName, myfont->f_n, use_font);
+ xtermWarning("unable to open font \"%s\", trying \"%s\"....\n",
+ myfont->f_n, use_font);
(void) xtermLoadFont(xw,
xtermFontName(use_font),
False,
@@ -7041,8 +7164,7 @@ VTRealize(Widget w,
/* really screwed if we couldn't open default font */
if (!screen->fnts[fNorm].fs) {
- fprintf(stderr, "%s: unable to locate a suitable font\n",
- ProgramName);
+ xtermWarning("unable to locate a suitable font\n");
Exit(1);
}
#if OPT_WIDE_CHARS
@@ -7295,8 +7417,6 @@ VTRealize(Widget w,
#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
VTInitI18N(xw);
-#else
- screen->xic = NULL;
#endif
#if OPT_NUM_LOCK
VTInitModifiers(xw);
@@ -7369,10 +7489,11 @@ xim_instantiate_cb(Display * display,
XPointer client_data GCC_UNUSED,
XPointer call_data GCC_UNUSED)
{
- if (display != XtDisplay(term))
- return;
+ TRACE(("xim_instantiate_cb client=%p, call=%p\n", client_data, call_data));
- VTInitI18N(term);
+ if (display == XtDisplay(term)) {
+ VTInitI18N(term);
+ }
}
static void
@@ -7380,19 +7501,67 @@ xim_destroy_cb(XIM im GCC_UNUSED,
XPointer client_data GCC_UNUSED,
XPointer call_data GCC_UNUSED)
{
- TScreenOf(term)->xic = NULL;
+ XtermWidget xw = term;
+ TInput *input = lookupTInput(xw, (Widget) xw);
- XRegisterIMInstantiateCallback(XtDisplay(term), NULL, NULL, NULL,
+ TRACE(("xim_destroy_cb im=%lx, client=%p, call=%p\n",
+ (long) im, client_data, call_data));
+
+ input->xic = NULL;
+ XRegisterIMInstantiateCallback(XtDisplay(xw), NULL, NULL, NULL,
xim_instantiate_cb, NULL);
}
#endif /* X11R6+ */
+static Boolean
+xim_create_fs(XtermWidget xw)
+{
+ XFontStruct **fonts;
+ char **font_name_list;
+ char **missing_charset_list;
+ char *def_string;
+ int missing_charset_count;
+ unsigned i, j;
+
+ if (xw->misc.xim_fs == 0) {
+ xw->misc.xim_fs = XCreateFontSet(XtDisplay(xw),
+ xw->misc.f_x,
+ &missing_charset_list,
+ &missing_charset_count,
+ &def_string);
+ if (xw->misc.xim_fs == NULL) {
+ xtermWarning("Preparation of font set "
+ "\"%s\" for XIM failed.\n", xw->misc.f_x);
+ xw->misc.xim_fs = XCreateFontSet(XtDisplay(xw),
+ DEFXIMFONT,
+ &missing_charset_list,
+ &missing_charset_count,
+ &def_string);
+ }
+ }
+ if (xw->misc.xim_fs == NULL) {
+ xtermWarning("Preparation of default font set "
+ "\"%s\" for XIM failed.\n", DEFXIMFONT);
+ cleanupInputMethod(xw);
+ xw->misc.cannot_im = True;
+ } else {
+ (void) XExtentsOfFontSet(xw->misc.xim_fs);
+ j = (unsigned) XFontsOfFontSet(xw->misc.xim_fs, &fonts, &font_name_list);
+ for (i = 0, xw->misc.xim_fs_ascent = 0; i < j; i++) {
+ if (xw->misc.xim_fs_ascent < (*fonts)->ascent)
+ xw->misc.xim_fs_ascent = (*fonts)->ascent;
+ }
+ }
+ return (Boolean) ! (xw->misc.cannot_im);
+}
+
static void
-xim_real_init(XtermWidget xw)
+xim_create_xic(XtermWidget xw, Widget theInput)
{
- TScreen *screen = TScreenOf(xw);
+ Display *myDisplay = XtDisplay(theInput);
+ Window myWindow = XtWindow(theInput);
unsigned i, j;
- char *p, *s, *t, *ns, *end, buf[32];
+ char *p = NULL, *s, *t, *ns, *end, buf[32];
XIMStyles *xim_styles;
XIMStyle input_style = 0;
Bool found;
@@ -7410,16 +7579,33 @@ xim_real_init(XtermWidget xw)
"Root", (XIMPreeditNothing | XIMStatusNothing)
},
};
-
- screen->xic = NULL;
+ TInput *input = lookupTInput(xw, theInput);
if (xw->misc.cannot_im) {
return;
}
- if (!xw->misc.input_method || !*xw->misc.input_method) {
- if ((p = XSetLocaleModifiers("")) != NULL && *p)
- screen->xim = XOpenIM(XtDisplay(xw), NULL, NULL, NULL);
+ if (input == 0) {
+ for (i = 0; i < NINPUTWIDGETS; ++i) {
+ if (xw->misc.inputs[i].w == 0) {
+ input = xw->misc.inputs + i;
+ input->w = theInput;
+ break;
+ }
+ }
+ }
+
+ if (input == 0) {
+ xtermWarning("attempted to add too many input widgets\n");
+ return;
+ }
+
+ TRACE(("xim_real_init\n"));
+
+ if (IsEmpty(xw->misc.input_method)) {
+ if ((p = XSetLocaleModifiers("")) != NULL && *p) {
+ input->xim = XOpenIM(myDisplay, NULL, NULL, NULL);
+ }
} else {
s = xw->misc.input_method;
i = 5 + (unsigned) strlen(s);
@@ -7444,11 +7630,12 @@ xim_real_init(XtermWidget xw)
strncat(t, s, (size_t) (end - s));
if ((p = XSetLocaleModifiers(t)) != 0 && *p
- && (screen->xim = XOpenIM(XtDisplay(xw),
- NULL,
- NULL,
- NULL)) != 0)
+ && (input->xim = XOpenIM(myDisplay,
+ NULL,
+ NULL,
+ NULL)) != 0) {
break;
+ }
}
s = ns + 1;
@@ -7457,23 +7644,23 @@ xim_real_init(XtermWidget xw)
}
}
- if (screen->xim == NULL
+ if (input->xim == NULL
&& (p = XSetLocaleModifiers("@im=none")) != NULL
&& *p) {
- screen->xim = XOpenIM(XtDisplay(xw), NULL, NULL, NULL);
+ input->xim = XOpenIM(myDisplay, NULL, NULL, NULL);
}
- if (!screen->xim) {
- fprintf(stderr, "Failed to open input method\n");
+ if (!input->xim) {
+ xtermWarning("Failed to open input method\n");
return;
}
- TRACE(("VTInitI18N opened input method\n"));
+ TRACE(("VTInitI18N opened input method:%s\n", NonNull(p)));
- if (XGetIMValues(screen->xim, XNQueryInputStyle, &xim_styles, NULL)
+ if (XGetIMValues(input->xim, XNQueryInputStyle, &xim_styles, (void *) 0)
|| !xim_styles
|| !xim_styles->count_styles) {
- fprintf(stderr, "input method doesn't support any style\n");
- cleanupInputMethod(screen);
+ xtermWarning("input method doesn't support any style\n");
+ cleanupInputMethod(xw);
xw->misc.cannot_im = True;
return;
}
@@ -7514,10 +7701,9 @@ xim_real_init(XtermWidget xw)
XFree(xim_styles);
if (!found) {
- fprintf(stderr,
- "input method doesn't support my preedit type (%s)\n",
- xw->misc.preedit_type);
- cleanupInputMethod(screen);
+ xtermWarning("input method doesn't support my preedit type (%s)\n",
+ xw->misc.preedit_type);
+ cleanupInputMethod(xw);
xw->misc.cannot_im = True;
return;
}
@@ -7527,9 +7713,8 @@ xim_real_init(XtermWidget xw)
*/
TRACE(("input_style %#lx\n", input_style));
if (input_style == (XIMPreeditArea | XIMStatusArea)) {
- fprintf(stderr,
- "This program doesn't support the 'OffTheSpot' preedit type\n");
- cleanupInputMethod(screen);
+ xtermWarning("This program doesn't support the 'OffTheSpot' preedit type\n");
+ cleanupInputMethod(xw);
xw->misc.cannot_im = True;
return;
}
@@ -7542,62 +7727,32 @@ xim_real_init(XtermWidget xw)
* same font cannot be used for XIM preedit.
*/
if (input_style != (XIMPreeditNothing | XIMStatusNothing)) {
- char **missing_charset_list;
- int missing_charset_count;
- char *def_string;
XVaNestedList p_list;
XPoint spot =
{0, 0};
- XFontStruct **fonts;
- char **font_name_list;
-
- screen->fs = XCreateFontSet(XtDisplay(xw),
- xw->misc.f_x,
- &missing_charset_list,
- &missing_charset_count,
- &def_string);
- if (screen->fs == NULL) {
- fprintf(stderr, "Preparation of font set "
- "\"%s\" for XIM failed.\n", xw->misc.f_x);
- screen->fs = XCreateFontSet(XtDisplay(xw),
- DEFXIMFONT,
- &missing_charset_list,
- &missing_charset_count,
- &def_string);
- }
- if (screen->fs == NULL) {
- fprintf(stderr, "Preparation of default font set "
- "\"%s\" for XIM failed.\n", DEFXIMFONT);
- cleanupInputMethod(screen);
- xw->misc.cannot_im = True;
- return;
+
+ if (xim_create_fs(xw)) {
+ p_list = XVaCreateNestedList(0,
+ XNSpotLocation, &spot,
+ XNFontSet, xw->misc.xim_fs,
+ (void *) 0);
+ input->xic = XCreateIC(input->xim,
+ XNInputStyle, input_style,
+ XNClientWindow, myWindow,
+ XNFocusWindow, myWindow,
+ XNPreeditAttributes, p_list,
+ (void *) 0);
}
- (void) XExtentsOfFontSet(screen->fs);
- j = (unsigned) XFontsOfFontSet(screen->fs, &fonts, &font_name_list);
- for (i = 0, screen->fs_ascent = 0; i < j; i++) {
- if (screen->fs_ascent < (*fonts)->ascent)
- screen->fs_ascent = (*fonts)->ascent;
- }
- p_list = XVaCreateNestedList(0,
- XNSpotLocation, &spot,
- XNFontSet, screen->fs,
- NULL);
- screen->xic = XCreateIC(screen->xim,
- XNInputStyle, input_style,
- XNClientWindow, XtWindow(xw),
- XNFocusWindow, XtWindow(xw),
- XNPreeditAttributes, p_list,
- NULL);
} else {
- screen->xic = XCreateIC(screen->xim, XNInputStyle, input_style,
- XNClientWindow, XtWindow(xw),
- XNFocusWindow, XtWindow(xw),
- NULL);
+ input->xic = XCreateIC(input->xim, XNInputStyle, input_style,
+ XNClientWindow, myWindow,
+ XNFocusWindow, myWindow,
+ (void *) 0);
}
- if (!screen->xic) {
- fprintf(stderr, "Failed to create input context\n");
- cleanupInputMethod(screen);
+ if (!input->xic) {
+ xtermWarning("Failed to create input context\n");
+ cleanupInputMethod(xw);
}
#if defined(USE_XIM_INSTANTIATE_CB)
else {
@@ -7605,8 +7760,12 @@ xim_real_init(XtermWidget xw)
destroy_cb.callback = xim_destroy_cb;
destroy_cb.client_data = NULL;
- if (XSetIMValues(screen->xim, XNDestroyCallback, &destroy_cb, NULL))
- fprintf(stderr, "Could not set destroy callback to IM\n");
+ if (XSetIMValues(input->xim,
+ XNDestroyCallback,
+ &destroy_cb,
+ (void *) 0)) {
+ xtermWarning("Could not set destroy callback to IM\n");
+ }
}
#endif
@@ -7614,13 +7773,19 @@ xim_real_init(XtermWidget xw)
}
static void
+xim_real_init(XtermWidget xw)
+{
+ xim_create_xic(xw, (Widget) xw);
+}
+
+static void
VTInitI18N(XtermWidget xw)
{
if (xw->misc.open_im) {
xim_real_init(xw);
#if defined(USE_XIM_INSTANTIATE_CB)
- if (TScreenOf(xw)->xic == NULL
+ if (lookupTInput(xw, (Widget) xw) == NULL
&& !xw->misc.cannot_im
&& xw->misc.retry_im-- > 0) {
sleep(3);
@@ -7630,6 +7795,22 @@ VTInitI18N(XtermWidget xw)
#endif
}
}
+
+TInput *
+lookupTInput(XtermWidget xw, Widget w)
+{
+ TInput *result = 0;
+ unsigned n;
+
+ for (n = 0; n < NINPUTWIDGETS; ++n) {
+ if (xw->misc.inputs[n].w == w) {
+ result = xw->misc.inputs + n;
+ break;
+ }
+ }
+
+ return result;
+}
#endif /* OPT_I18N_SUPPORT && OPT_INPUT_METHOD */
static void
@@ -8384,7 +8565,7 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
/* reset the mouse mode */
screen->send_mouse_pos = MOUSE_OFF;
screen->send_focus_pos = OFF;
- screen->ext_mode_mouse = OFF;
+ screen->extend_coords = 0;
screen->waitingForTrackInfo = False;
screen->eventMode = NORMAL;
@@ -8485,6 +8666,7 @@ VTReset(XtermWidget xw, Bool full, Bool saved)
static int
set_character_class(char *s)
{
+#define FMT "%s in range string \"%s\" (position %d)\n"
int i; /* iterator, index into s */
int len; /* length of s */
int acc; /* accumulator */
@@ -8492,7 +8674,6 @@ set_character_class(char *s)
int base; /* 8, 10, 16 (octal, decimal, hex) */
int numbers; /* count of numbers per range */
int digits; /* count of digits in a number */
- static const char errfmt[] = "%s: %s in range string \"%s\" (position %d)\n";
if (!s || !s[0])
return -1;
@@ -8514,7 +8695,7 @@ set_character_class(char *s)
low = acc;
acc = 0;
if (digits == 0) {
- fprintf(stderr, errfmt, ProgramName, "missing number", s, i);
+ xtermWarning(FMT, "missing number", s, i);
return (-1);
}
digits = 0;
@@ -8526,8 +8707,7 @@ set_character_class(char *s)
else if (numbers == 1)
high = acc;
else {
- fprintf(stderr, errfmt, ProgramName, "too many numbers",
- s, i);
+ xtermWarning(FMT, "too many numbers", s, i);
return (-1);
}
digits = 0;
@@ -8544,10 +8724,9 @@ set_character_class(char *s)
numbers++;
}
if (numbers != 2) {
- fprintf(stderr, errfmt, ProgramName, "bad value number",
- s, i);
+ xtermWarning(FMT, "bad value number", s, i);
} else if (SetCharacterClassRange(low, high, acc) != 0) {
- fprintf(stderr, errfmt, ProgramName, "bad range", s, i);
+ xtermWarning(FMT, "bad range", s, i);
}
low = high = -1;
@@ -8556,7 +8735,7 @@ set_character_class(char *s)
numbers = 0;
continue;
} else {
- fprintf(stderr, errfmt, ProgramName, "bad character", s, i);
+ xtermWarning(FMT, "bad character", s, i);
return (-1);
} /* end if else if ... else */
@@ -8572,12 +8751,13 @@ set_character_class(char *s)
if (high < 0)
high = low;
if (numbers < 1 || numbers > 2) {
- fprintf(stderr, errfmt, ProgramName, "bad value number", s, i);
+ xtermWarning(FMT, "bad value number", s, i);
} else if (SetCharacterClassRange(low, high, acc) != 0) {
- fprintf(stderr, errfmt, ProgramName, "bad range", s, i);
+ xtermWarning(FMT, "bad range", s, i);
}
return (0);
+#undef FMT
}
/* ARGSUSED */
@@ -8664,7 +8844,8 @@ HandleIgnore(Widget w,
{
XtermWidget xw;
- TRACE(("Handle ignore for %p\n", (void *) w));
+ TRACE(("Handle ignore for %p %s\n",
+ (void *) w, visibleEventType(event->type)));
if ((xw = getXtermWidget(w)) != 0) {
/* do nothing, but check for funny escape sequences */
(void) SendMousePosition(xw, event);
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index dd907a73b..d44ab11e7 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.279 2011/09/04 21:27:24 tom Exp $
+dnl $XTermId: configure.in,v 1.285 2012/01/05 10:27:54 tom Exp $
dnl
dnl -----------------------------------------------------------------------------
dnl this file is part of xterm
@@ -76,7 +76,7 @@ AC_CHECK_HEADERS( \
ncurses/curses.h \
ncurses/term.h \
stdlib.h \
-sys/ttydefaults.h \
+sys/ptem.h sys/ttydefaults.h \
term.h \
termios.h \
unistd.h \
@@ -89,6 +89,7 @@ AM_LANGINFO_CODESET
CF_SIG_ATOMIC_T
CF_SIZE_T
AC_CHECK_TYPE(time_t, long)
+CF_TYPE_CC_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_UID_T
@@ -103,6 +104,7 @@ AC_CHECK_FUNCS( \
putenv \
unsetenv \
sched_yield \
+ setpgid \
strerror \
strftime \
tcgetattr \
@@ -258,17 +260,7 @@ CF_TERMIO_C_ISPEED
LIBS="$LIBS $X_EXTRA_LIBS"
-# Check for openpty() in -lutil if the UNIX98-style pty functions are not
-# available. E.g. for GNU libc 2.0.
-case $host_os in #(vi
-freebsd*|netbsd*|dragonfly*) # 2004/8/15 - revisit this if/when grantpt is known to work.
- AC_CHECK_LIB(util,openpty)
- ;;
-*)
- AC_CHECK_FUNCS(grantpt, [], AC_CHECK_LIB(util,openpty))
- ;;
-esac
-
+CF_FUNC_GRANTPT
AC_CHECK_FUNCS(XkbQueryExtension)
CF_XKB_BELL_EXT
@@ -725,6 +717,14 @@ CF_ARG_DISABLE(samename,
AC_MSG_RESULT($enable_samename)
test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0)
+AC_MSG_CHECKING(if you want support for selection-actions)
+CF_ARG_DISABLE(selection-ops,
+ [ --disable-selection-ops disable selection-action operations],
+ [enable_selection_ops=no],
+ [enable_selection_ops=yes])
+AC_MSG_RESULT($enable_selection_ops)
+test "$enable_selection_ops" = no && AC_DEFINE(OPT_SELECTION_OPS,0)
+
AC_MSG_CHECKING(if you want support for session management)
CF_ARG_DISABLE(session-mgt,
[ --disable-session-mgt disable support for session management],
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index e0c48584a..bb96d92c4 100644
--- a/app/xterm/ctlseqs.ms
+++ b/app/xterm/ctlseqs.ms
@@ -1,6 +1,6 @@
.\"#! troff -ms $1 -*- Nroff -*-
.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.244 2011/09/04 18:14:33 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.253 2011/12/11 19:18:48 tom Exp $
.\"
.\"
.\" Copyright 1996-2010,2011 by Thomas E. Dickey
@@ -238,6 +238,7 @@
.[] ]] ]
.[] bS \\e
.[] { {
+.[] ~ ~
.[] ] ]
.[] & &
.[] ^ ^
@@ -538,12 +539,18 @@ These work for 96-character sets only.
.\" \*(Cc = \*M \(-> ISO Latin-5 Supplemental
.\" \*(Cc = \*L \(-> ISO Latin-Cyrillic
.
+.IP \\*(Es\\*6
+Back Index (DECBI), VT420 and up.
+.
.IP \\*(Es\\*7
Save Cursor (DECSC).
.
.IP \\*(Es\\*8
Restore Cursor (DECRC).
.
+.IP \\*(Es\\*9
+Forward Index (DECFI), VT420 and up.
+.
.IP \\*(Es\\*=
Application Keypad (DECPAM).
.
@@ -1201,11 +1208,15 @@ Valid values for the first (and any additional parameters) are:
\*(Ps = \*1 \(-> De-iconify window.
\*(Ps = \*2 \(-> Iconify window.
\*(Ps = \*3\*s\*;\*s\fIx\*s\*;\*sy\fP \(-> Move window to [x, y].
- \*(Ps = \*4\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the \fIxterm\fP window to height and width in pixels.
+ \*(Ps = \*4\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the \fIxterm\fP window to given height and width in pixels.
+Omitted parameters reuse the current height or width.
+Zero parameters use the display's height or width.
\*(Ps = \*5 \(-> Raise the \fIxterm\fP window to the front of the stacking order.
\*(Ps = \*6 \(-> Lower the \fIxterm\fP window to the bottom of the stacking order.
\*(Ps = \*7 \(-> Refresh the \fIxterm\fP window.
- \*(Ps = \*8\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the text area to [height;width] in characters.
+ \*(Ps = \*8\*s\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the text area to given height and width in characters.
+Omitted parameters reuse the current height or width.
+Zero parameters use the display's height or width.
\*(Ps = \*9\*s\*;\*s\*0 \(-> Restore maximized window.
\*(Ps = \*9\*s\*;\*s\*1 \(-> Maximize window (i.e., resize to screen size).
\*(Ps = \*1\*0\*s\*;\*s\*0 \(-> Undo full-screen mode.
@@ -1383,6 +1394,12 @@ position in the xterm window, encoded as ASCII decimal.
.br
The ``page'' parameter is not used by xterm, and will be omitted.
.
+.IP \\*(Cs\\*(Pm\\*s\\*(Sp\\*}
+Insert \*(Ps Column(s) (default = 1) (DECIC), VT420 and up.
+.
+.IP \\*(Cs\\*(Pm\\*s\\*(Sp\\*~
+Delete \*(Ps Column(s) (default = 1) (DECDC), VT420 and up.
+.
.Ed
.
.St
@@ -1578,7 +1595,7 @@ 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 \fBaltIsNotMeta\fP is set:
-.ne 18
+.ne 23
.TS
center;
lf3 lf3 lf3 lf3
@@ -1620,6 +1637,7 @@ or by the "DECSET \*1\*0\*3\*5" control sequence.
.lP
The cursor keys transmit the following escape sequences depending on the
mode specified via the \fBDECCKM\fP escape sequence.
+.ne 10
.TS
center;
cf3 cf3 cf3
@@ -1636,6 +1654,7 @@ The home- and end-keys
(unlike PageUp and other keys also on the 6-key editing keypad)
are considered "cursor keys" by \fIxterm\fP.
Their mode is also controlled by the \fBDECCKM\fP escape sequence:
+.ne 8
.TS
center;
cf3 cf3 cf3
@@ -1688,7 +1707,7 @@ _
.TE
.br
They also provide 12 function keys, as well as a few other special-purpose keys:
-.ne 16
+.ne 18
.TS
center;
cf3 cf3
@@ -1714,7 +1733,7 @@ Older versions of \fIxterm\fP implement different escape sequences for F1 throug
These can be activated by setting the \fBoldXtermFKeys\fP resource.
However, since they do not correspond to any hardware terminal, they have been deprecated.
(The DEC VT220 reserves F1 through F5 for local functions such as \fBSetup\fP).
-.ne 6
+.ne 10
.TS
center;
cf3 cf3
@@ -1732,6 +1751,7 @@ when the \fBsunKeyboard\fP resource is false,
\fIxterm\fP recognizes function key modifiers
which are parameters appended before the final character
of the control sequence.
+.ne 13
.TS
center;
cf3 lf3
@@ -1760,7 +1780,7 @@ to act like a VT220 keyboard.
.lP
The VT102/VT220 application keypad transmits unique escape sequences in
application mode, which are distinct from the cursor and scrolling keypad:
-.ne 31
+.ne 32
.TS
center;
cf3 cf3 cf3
@@ -1796,7 +1816,7 @@ _
The VT220 provides a 6-key editing keypad,
which is analogous to that on the PC keyboard.
It is not affected by \fBDECCKM\fP or \fBDECPNM\fP/\fBDECPAM\fP:
-.ne 10
+.ne 12
.TS
center;
cf3 cf3 cf3
@@ -1836,7 +1856,7 @@ _
A VT52 does not have function keys, but it does have a numeric keypad and cursor keys.
They differ from the other emulations by the prefix.
Also, the cursor keys do not change:
-.ne 10
+.ne 13
.TS
center;
cf3 cf3
@@ -1850,6 +1870,7 @@ Cursor Left \*(Es\*D
_
.TE
The keypad is similar:
+.ne 33
.TS
center;
cf3 cf3 cf3
@@ -1985,13 +2006,19 @@ These modes are typically used by
editors and other full-screen applications that want to make use of
the mouse.
.lP
-There are six mutually exclusive modes.
-One is DEC Locator mode, enabled by the
+There are two sets of mutually exclusive modes:
+.bP
+mouse protocol
+.bP
+protocol encoding
+.lP
+The mouse protocols include
+DEC Locator mode, enabled by the
DECELR \*(Cs\*(Ps\*s\*;\*(Ps\*s\*s\*(qu\*s\*z
control sequence, and is not described here
(control sequences are summarized above).
-The remaining five
-modes are each enabled (or disabled) by a different parameter in
+The remaining five modes of the mouse protocols
+are each enabled (or disabled) by a different parameter in
the "DECSET \*(Cs\*?\*(Pm\*s\*h"
or
"DECRST \*(Cs\*?\*(Pm\*s\*l"
@@ -2010,18 +2037,23 @@ are defined in \fBxcharmouse.h\fP as follows:
#define SET_FOCUS_EVENT_MOUSE 1004
#define SET_EXT_MODE_MOUSE 1005
+#define SET_SGR_EXT_MODE_MOUSE 1006
+#define SET_URXVT_EXT_MODE_MOUSE 1015
.DE
.br
The motion reporting modes are strictly \fIxterm\fP extensions, and are not
part of any standard, though they are analogous to the DEC VT200 DECELR
locator reports.
.lP
-Parameters (such as pointer position and button number) for all mouse
+Normally,
+parameters (such as pointer position and button number) for all mouse
tracking escape sequences generated by \fIxterm\fP
encode numeric parameters in a single character as
\fIvalue\fP+32.
For example, \*! specifies the value 1.
The upper left character position on the terminal is denoted as 1,1.
+This scheme dates back to X10,
+though the normal mouse-tracking (from X11) is more elaborate.
.lP
X10 compatibility mode sends an escape sequence only on button press,
encoding the location and the mouse button pressed.
@@ -2138,7 +2170,12 @@ When set, it causes \fIxterm\fP to send
\*(Cs\*I when the terminal gains focus, and
\*(Cs\*O when it loses focus.
.lP
-Extended mouse mode enables UTF-8 encoding for \*(Cx and \*(Cy under
+The original X10 mouse protocol limits the \*(Cx and \*(Cy ordinates
+to 223 (=255\ -\ 32).
+\fIXterm\fP supports more than one scheme for extending this range,
+by changing the protocol encoding:
+.IP "UTF-8 (1005)"
+This enables UTF-8 encoding for \*(Cx and \*(Cy under
all tracking modes, expanding the maximum encodable position from 223 to 2015.
For positions less than 95, the resulting output is identical under both modes.
Under extended mouse mode, positions greater than 95
@@ -2146,12 +2183,46 @@ generate "extra" bytes which will confuse applications which do not treat
their input as a UTF-8 stream.
Likewise, \*(Cb will be UTF-8 encoded,
to reduce confusion with wheel mouse events.
-.lP
-NOTE: Under normal mouse mode, positions outside (160,94) result in
+.IP
+Under normal mouse mode, positions outside (160,94) result in
byte pairs which can be interpreted as a single UTF-8 character;
applications
which do treat their input as UTF-8 will almost certainly be confused
unless extended mouse mode is active.
+.IP
+This scheme has the drawback that the encoded coordinates will not
+pass through \fIluit\fP unchanged, e.g., for locales using non-UTF-8 encoding.
+.IP "SGR (1006)"
+The normal mouse response is altered to use \*(Cs\*<
+followed by semicolon-separated
+encoded button value,
+the \*(Cx and \*(Cy ordinates and a final character which
+is \*M for button press
+and \*m for button release.
+.IP
+The encoded button value in this case does not add 32 since
+that was useful only in the X10 scheme for ensuring that the
+byte containing the button value is a printable code.
+The modifiers are encoded in the same way.
+A different final character is used for button release
+to resolve the X10 ambiguity regarding which button was released.
+.IP
+The highlight tracking responses are also modified to an SGR-like format,
+using the same SGR-style scheme and button-encodings.
+.IP "URXVT (1015)"
+The normal mouse response is altered to use \*(Cs
+followed by semicolon-separated
+encoded button value,
+the \*(Cx and \*(Cy ordinates and final character \*M.
+.IP
+This uses the same button encoding as X10, but printing it as
+a decimal integer rather than as a single byte.
+.IP
+However, \*(Cs\*M can be mistaken for DL (delete lines),
+while the highlight tracking \*(Cs\*T can be mistaken for SD (scroll down),
+and the Window manipulation controls.
+For these reasons, the 1015 control is not recommended;
+it is not an improvement over 1005.
.
.Sh "Tektronix 4014 Mode"
.LP
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index b8a8fdda0..9dd945c98 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -155,8 +155,10 @@ 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 6 Back Index (DECBI), VT420 and up.
ESC 7 Save Cursor (DECSC).
ESC 8 Restore Cursor (DECRC).
+ESC 9 Forward Index (DECFI), VT420 and up.
ESC = Application Keypad (DECPAM).
ESC > Normal Keypad (DECPNM).
ESC F Cursor to lower left corner of screen. This is enabled by the
@@ -673,14 +675,18 @@ CSI Ps ; Ps ; Ps t
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.
+ given height and width in pixels. Omitted parameters reuse
+ the current height or width. Zero parameters use the dis-
+ play's height or width.
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 = 8 ; height ; width -> Resize the text area to given
+ height and width in characters. Omitted parameters reuse the
+ current height or width. Zero parameters use the display's
+ height or width.
Ps = 9 ; 0 -> Restore maximized window.
Ps = 9 ; 1 -> Maximize window (i.e., resize to screen
size).
@@ -839,6 +845,10 @@ CSI Ps ' |
mal.
The ``page'' parameter is not used by xterm, and will be omit-
ted.
+CSI Pm SP }
+ Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
+CSI Pm SP ~
+ Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
Operating System Controls
OSC Ps ; Pt ST
@@ -1337,11 +1347,15 @@ The VT widget can be set to send the mouse position and other informa-
tion on button presses. These modes are typically used by editors and
other full-screen applications that want to make use of the mouse.
-There are six mutually exclusive modes. One is DEC Locator mode,
-enabled by the DECELR CSI Ps ; Ps ' z control sequence, and is not
-described here (control sequences are summarized above). The remaining
-five modes are each enabled (or disabled) by a different parameter in
-the "DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
+There are two sets of mutually exclusive modes:
+o mouse protocol
+o protocol encoding
+
+The mouse protocols include DEC Locator mode, enabled by the DECELR CSI
+Ps ; Ps ' z control sequence, and is not described here (control
+sequences are summarized above). The remaining five modes of the mouse
+protocols are each enabled (or disabled) by a different parameter in the
+"DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
Manifest constants for the parameter values are defined in xcharmouse.h
as follows:
@@ -1355,15 +1369,19 @@ as follows:
#define SET_FOCUS_EVENT_MOUSE 1004
#define SET_EXT_MODE_MOUSE 1005
+ #define SET_SGR_EXT_MODE_MOUSE 1006
+ #define SET_URXVT_EXT_MODE_MOUSE 1015
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.
-Parameters (such as pointer position and button number) for all mouse
-tracking escape sequences generated by xterm encode numeric parameters
-in a single character as value+32. For example, ! specifies the value
-1. The upper left character position on the terminal is denoted as 1,1.
+Normally, parameters (such as pointer position and button number) for
+all mouse tracking escape sequences generated by xterm encode numeric
+parameters in a single character as value+32. For example, ! specifies
+the value 1. The upper left character position on the terminal is
+denoted as 1,1. This scheme dates back to X10, though the normal mouse-
+tracking (from X11) is more elaborate.
X10 compatibility mode sends an escape sequence only on button press,
encoding the location and the mouse button pressed. It is enabled by
@@ -1447,18 +1465,51 @@ 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.
-Extended mouse mode enables UTF-8 encoding for Cx and Cy under all
-tracking modes, expanding the maximum encodable position from 223 to
-2015. For positions less than 95, the resulting output is identical
-under both modes. Under extended mouse mode, positions greater than 95
-generate "extra" bytes which will confuse applications which do not
-treat their input as a UTF-8 stream. Likewise, Cb will be UTF-8
-encoded, to reduce confusion with wheel mouse events.
-
-NOTE: Under normal mouse mode, positions outside (160,94) result in byte
-pairs which can be interpreted as a single UTF-8 character; applications
-which do treat their input as UTF-8 will almost certainly be confused
-unless extended mouse mode is active.
+The original X10 mouse protocol limits the Cx and Cy ordinates to 223
+(=255 - 32). Xterm supports more than one scheme for extending this
+range, by changing the protocol encoding:
+UTF-8 (1005)
+ This enables UTF-8 encoding for Cx and Cy under all tracking
+ modes, expanding the maximum encodable position from 223 to
+ 2015. For positions less than 95, the resulting output is
+ identical under both modes. Under extended mouse mode, posi-
+ tions greater than 95 generate "extra" bytes which will con-
+ fuse applications which do not treat their input as a UTF-8
+ stream. Likewise, Cb will be UTF-8 encoded, to reduce confu-
+ sion with wheel mouse events.
+ Under normal mouse mode, positions outside (160,94) result in
+ byte pairs which can be interpreted as a single UTF-8 charac-
+ ter; applications which do treat their input as UTF-8 will
+ almost certainly be confused unless extended mouse mode is
+ active.
+ This scheme has the drawback that the encoded coordinates will
+ not pass through luit unchanged, e.g., for locales using non-
+ UTF-8 encoding.
+SGR (1006)
+ The normal mouse response is altered to use CSI < followed by
+ semicolon-separated encoded button value, the Cx and Cy ordi-
+ nates and a final character which is M for button press and m
+ for button release.
+ The encoded button value in this case does not add 32 since
+ that was useful only in the X10 scheme for ensuring that the
+ byte containing the button value is a printable code. The
+ modifiers are encoded in the same way. A different final
+ character is used for button release to resolve the X10 ambi-
+ guity regarding which button was released.
+ The highlight tracking responses are also modified to an SGR-
+ like format, using the same SGR-style scheme and button-encod-
+ ings.
+URXVT (1015)
+ The normal mouse response is altered to use CSI followed by
+ semicolon-separated encoded button value, the Cx and Cy ordi-
+ nates and final character M .
+ This uses the same button encoding as X10, but printing it as
+ a decimal integer rather than as a single byte.
+ However, CSI M can be mistaken for DL (delete lines), while
+ the highlight tracking CSI T can be mistaken for SD (scroll
+ down), and the Window manipulation controls. For these rea-
+ sons, the 1015 control is not recommended; it is not an
+ improvement over 1005.
Tektronix 4014 Mode
Most of these sequences are standard Tektronix 4014 control sequences.
diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c
index a689b910d..88ad585ac 100644
--- a/app/xterm/fontutils.c
+++ b/app/xterm/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.378 2011/10/10 23:46:00 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.380 2011/12/27 10:20:50 tom Exp $ */
/*
* Copyright 1998-2010,2011 by Thomas E. Dickey
@@ -774,7 +774,7 @@ xtermOpenFont(XtermWidget xw,
#endif
) {
TRACE(("OOPS: cannot load font %s\n", name));
- fprintf(stderr, "%s: cannot load font '%s'\n", ProgramName, name);
+ xtermWarning("cannot load font '%s'\n", name);
#if OPT_RENDERFONT
/*
* Do a sanity check in case someone's mixed up xterm with
@@ -782,8 +782,7 @@ xtermOpenFont(XtermWidget xw,
* xterm's namespace.
*/
if (strchr(name, ':') != 0 || strchr(name, '=') != 0) {
- fprintf(stderr,
- "Use the \"-fa\" option for the Xft fonts\n");
+ xtermWarning("Use the \"-fa\" option for the Xft fonts\n");
}
#endif
} else {
@@ -1743,16 +1742,14 @@ xtermOpenXft(XtermWidget xw, const char *name, XftPattern * pat, const char *tag
XftPatternDestroy(match);
if (xw->misc.fontWarnings >= fwAlways) {
TRACE(("OOPS cannot open %s font \"%s\"\n", tag, name));
- fprintf(stderr, "%s: cannot open %s font \"%s\"\n",
- ProgramName, tag, name);
+ xtermWarning("cannot open %s font \"%s\"\n", tag, name);
}
}
} else {
TRACE(("...did not match %s font\n", tag));
if (xw->misc.fontWarnings >= fwResource) {
TRACE(("OOPS: cannot match %s font \"%s\"\n", tag, name));
- fprintf(stderr, "%s: cannot match %s font \"%s\"\n",
- ProgramName, tag, name);
+ xtermWarning("cannot match %s font \"%s\"\n", tag, name);
}
}
}
@@ -1842,8 +1839,7 @@ static void
checkFontInfo(int value, const char *tag)
{
if (value == 0) {
- fprintf(stderr,
- "Selected font has no non-zero %s for ISO-8859-1 encoding\n", tag);
+ xtermWarning("Selected font has no non-zero %s for ISO-8859-1 encoding\n", tag);
exit(1);
}
}
@@ -1886,8 +1882,8 @@ setFaceName(XtermWidget xw, const char *value)
{
TScreen *screen = TScreenOf(xw);
int n;
- Boolean changed = ((xw->misc.face_name == 0)
- || strcmp(xw->misc.face_name, value));
+ Boolean changed = (Boolean) ((xw->misc.face_name == 0)
+ || strcmp(xw->misc.face_name, value));
if (changed) {
xw->misc.face_name = x_strdup(value);
diff --git a/app/xterm/input.c b/app/xterm/input.c
index ffbddb72d..f049078ed 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,4 +1,4 @@
-/* $XTermId: input.c,v 1.327 2011/02/09 10:15:07 tom Exp $ */
+/* $XTermId: input.c,v 1.333 2012/01/07 02:01:05 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -830,18 +830,19 @@ Input(XtermWidget xw,
} else
#endif
{
-#if OPT_I18N_SUPPORT
- if (screen->xic) {
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+ TInput *input = lookupTInput(xw, (Widget) xw);
+ if (input->xic) {
Status status_return;
#if OPT_WIDE_CHARS
if (screen->utf8_mode) {
- kd.nbytes = Xutf8LookupString(screen->xic, event,
+ kd.nbytes = Xutf8LookupString(input->xic, event,
kd.strbuf, (int) sizeof(kd.strbuf),
&kd.keysym, &status_return);
} else
#endif
{
- kd.nbytes = XmbLookupString(screen->xic, event,
+ kd.nbytes = XmbLookupString(input->xic, event,
kd.strbuf, (int) sizeof(kd.strbuf),
&kd.keysym, &status_return);
}
@@ -957,6 +958,13 @@ Input(XtermWidget xw,
kd.strbuf[0] = '\t';
}
}
+#ifdef XK_ISO_Left_Tab
+ else if (IsTabKey(kd.keysym)
+ && kd.nbytes <= 1
+ && modify_parm == (MOD_NONE + MOD_SHIFT)) {
+ kd.keysym = XK_ISO_Left_Tab;
+ }
+#endif
#endif /* OPT_MOD_FKEYS */
/* VT300 & up: backarrow toggle */
@@ -1046,8 +1054,9 @@ Input(XtermWidget xw,
* Reevaluate the modifier parameter, stripping off the modifiers
* that we just used.
*/
- if (modify_parm)
+ if (modify_parm) {
modify_parm = xtermStateToParam(xw, evt_state);
+ }
#endif /* OPT_MOD_FKEYS */
}
@@ -1275,7 +1284,7 @@ Input(XtermWidget xw,
*/
if (eightbit && (kd.nbytes == 1) && screen->input_eight_bits) {
IChar ch = CharOf(kd.strbuf[0]);
- if (ch < 128) {
+ if ((ch < 128) && (screen->eight_bit_meta == ebTrue)) {
kd.strbuf[0] |= (char) 0x80;
TRACE(("...input shift from %d to %d (%#x to %#x)\n",
ch, CharOf(kd.strbuf[0]),
diff --git a/app/xterm/main.c b/app/xterm/main.c
index 4cff21bf0..294fbb6fa 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.669 2011/10/09 14:14:51 tom Exp $ */
+/* $XTermId: main.c,v 1.678 2012/01/06 22:04:40 tom Exp $ */
/*
* Copyright 2002-2010,2011 by Thomas E. Dickey
@@ -136,10 +136,6 @@
static void Syntax(char *) GCC_NORETURN;
static void HsSysError(int) GCC_NORETURN;
-#ifdef USE_ISPTS_FLAG
-static Bool IsPts = False;
-#endif
-
#if defined(__SCO__) || defined(SVR4) || defined(_POSIX_SOURCE)
#define USE_POSIX_SIGNALS
#endif
@@ -754,7 +750,7 @@ static const struct {
};
/* *INDENT-ON* */
-#define TMODE(ind,var) if (ttymodelist[ind].set) var = ttymodelist[ind].value
+#define TMODE(ind,var) if (ttymodelist[ind].set) var = (cc_t) ttymodelist[ind].value
static int parse_tty_modes(char *s, struct _xttymodes *modelist);
@@ -1529,11 +1525,10 @@ parseArg(int *num, char **argv, char **valuep)
*valuep = 0;
if (atbest >= 0) {
if (!exact && ambiguous1 >= 0 && ambiguous2 >= 0) {
- fprintf(stderr,
- "%s: ambiguous option \"%s\" vs \"%s\"\n",
- ProgramName,
- ITEM(ambiguous1)->option,
- ITEM(ambiguous2)->option);
+ xtermWarning(
+ "ambiguous option \"%s\" vs \"%s\"\n",
+ ITEM(ambiguous1)->option,
+ ITEM(ambiguous2)->option);
}
result = ITEM(atbest);
TRACE(("...result %s\n", result->option));
@@ -1563,8 +1558,7 @@ Syntax(char *badOption)
int col;
TRACE(("Syntax error at %s\n", badOption));
- fprintf(stderr, "%s: bad command line option \"%s\"\r\n\n",
- ProgramName, badOption);
+ xtermWarning("bad command line option \"%s\"\r\n\n", badOption);
fprintf(stderr, "usage: %s", ProgramName);
col = 8 + (int) strlen(ProgramName);
@@ -1866,7 +1860,7 @@ disableSetUid(void)
{
TRACE(("process %d disableSetUid\n", (int) getpid()));
if (setuid(save_ruid) == -1) {
- fprintf(stderr, "%s: unable to reset uid\n", ProgramName);
+ xtermWarning("unable to reset uid\n");
exit(1);
}
TRACE_IDS;
@@ -1881,7 +1875,7 @@ disableSetGid(void)
{
TRACE(("process %d disableSetGid\n", (int) getpid()));
if (setegid(save_rgid) == -1) {
- fprintf(stderr, "%s: unable to reset effective gid\n", ProgramName);
+ xtermWarning("unable to reset effective gid\n");
exit(1);
}
TRACE_IDS;
@@ -1901,8 +1895,7 @@ setEffectiveGroup(gid_t group)
if (!(errno == EMVSERR)) /* could happen if _BPX_SHAREAS=REUSE */
#endif
{
- (void) fprintf(stderr, "setegid(%d): %s\n",
- (int) group, strerror(errno));
+ xtermPerror("setegid(%d)", (int) group);
}
}
TRACE_IDS;
@@ -1919,8 +1912,7 @@ setEffectiveUser(uid_t user)
if (!(errno == EMVSERR))
#endif
{
- (void) fprintf(stderr, "seteuid(%d): %s\n",
- (int) user, strerror(errno));
+ xtermPerror("seteuid(%d)", (int) user);
}
}
TRACE_IDS;
@@ -1977,9 +1969,7 @@ main(int argc, char *argv[]ENVP_ARG)
if (!ttydev)
#endif
{
- fprintf(stderr,
- "%s: unable to allocate memory for ttydev or ptydev\n",
- ProgramName);
+ xtermWarning("unable to allocate memory for ttydev or ptydev\n");
exit(1);
}
strcpy(ttydev, TTYDEV);
@@ -2009,7 +1999,7 @@ main(int argc, char *argv[]ENVP_ARG)
if (isOption(argv[n])) {
Syntax(argv[n]);
} else if (explicit_shname != 0) {
- fprintf(stderr, "Explicit shell already was %s\n", explicit_shname);
+ xtermWarning("Explicit shell already was %s\n", explicit_shname);
Syntax(argv[n]);
}
explicit_shname = xtermFindShell(argv[n], True);
@@ -2077,7 +2067,7 @@ main(int argc, char *argv[]ENVP_ARG)
for (nn = 0; nn < XtNumber(known_ttyChars); ++nn) {
if (validTtyChar(d_tio, nn)) {
d_tio.c_cc[known_ttyChars[nn].sysMode] =
- known_ttyChars[nn].myDefault;
+ (cc_t) known_ttyChars[nn].myDefault;
}
}
}
@@ -2229,8 +2219,7 @@ main(int argc, char *argv[]ENVP_ARG)
if (resource.tty_modes) {
int n = parse_tty_modes(resource.tty_modes, ttymodelist);
if (n < 0) {
- fprintf(stderr, "%s: bad tty modes \"%s\"\n",
- ProgramName, resource.tty_modes);
+ xtermWarning("bad tty modes \"%s\"\n", resource.tty_modes);
} else if (n > 0) {
override_tty_modes = True;
}
@@ -2238,8 +2227,7 @@ main(int argc, char *argv[]ENVP_ARG)
#if OPT_ZICONBEEP
if (resource.zIconBeep > 100 || resource.zIconBeep < -100) {
resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */
- fprintf(stderr,
- "a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
+ xtermWarning("a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
}
#endif /* OPT_ZICONBEEP */
hold_screen = resource.hold_screen ? 1 : 0;
@@ -2615,7 +2603,20 @@ get_pty(int *pty, char *from GCC_UNUSED)
{
int result = 1;
-#if defined(PUCC_PTYD)
+#if defined(HAVE_POSIX_OPENPT) && defined(HAVE_PTSNAME)
+ if ((*pty = posix_openpt(O_RDWR)) >= 0) {
+ char *name = ptsname(*pty);
+ if (name != 0) {
+ strcpy(ttydev, name);
+ result = 0;
+ }
+ }
+#ifdef USE_PTY_SEARCH
+ if (result) {
+ result = pty_search(pty);
+ }
+#endif
+#elif defined(PUCC_PTYD)
result = ((*pty = openrpty(ttydev, ptydev,
(resource.utmpInhibit ? OPTY_NOP : OPTY_LOGIN),
@@ -2630,36 +2631,6 @@ get_pty(int *pty, char *from GCC_UNUSED)
result = pty_search(pty);
#else
-#if defined(USE_ISPTS_FLAG)
-
- /*
- The order of this code is *important*. On SYSV/386 we want to open
- a /dev/ttyp? first if at all possible. If none are available, then
- we'll try to open a /dev/pts??? device.
-
- The reason for this is because /dev/ttyp? works correctly, where
- as /dev/pts??? devices have a number of bugs, (won't update
- screen correcly, will hang -- it more or less works, but you
- really don't want to use it).
-
- Most importantly, for boxes of this nature, one of the major
- "features" is that you can emulate a 8086 by spawning off a UNIX
- program on 80386/80486 in v86 mode. In other words, you can spawn
- off multiple MS-DOS environments. On ISC the program that does
- this is named "vpix." The catcher is that "vpix" will *not* work
- with a /dev/pts??? device, will only work with a /dev/ttyp? device.
-
- Since we can open either a /dev/ttyp? or a /dev/pts??? device,
- the flag "IsPts" is set here so that we know which type of
- device we're dealing with in routine spawnXTerm(). That's the reason
- for the "if (IsPts)" statement in spawnXTerm(); we have two different
- device types which need to be handled differently.
- */
- result = pty_search(pty);
- if (!result)
- IsPts = 0;
-
-#endif
#if defined(USE_USG_PTYS) || defined(__CYGWIN__)
#ifdef __GLIBC__ /* if __GLIBC__ and USE_USG_PTYS, we know glibc >= 2.1 */
/* GNU libc 2 allows us to abstract away from having to know the
@@ -2674,18 +2645,11 @@ get_pty(int *pty, char *from GCC_UNUSED)
#elif defined(__MVS__)
result = pty_search(pty);
#else
-#if defined(USE_ISPTS_FLAG)
- if (result) {
-#endif
- result = ((*pty = open("/dev/ptmx", O_RDWR)) < 0);
-#endif
-#if defined(SVR4) || defined(__SCO__) || defined(USE_ISPTS_FLAG)
- if (!result)
- strcpy(ttydev, ptsname(*pty));
-#ifdef USE_ISPTS_FLAG
- IsPts = !result; /* true if we're successful */
- }
+ result = ((*pty = open("/dev/ptmx", O_RDWR)) < 0);
#endif
+#if defined(SVR4) || defined(__SCO__)
+ if (!result)
+ strcpy(ttydev, ptsname(*pty));
#endif
#elif defined(AIXV3)
@@ -3033,12 +2997,10 @@ HsSysError(int error)
(const char *) &handshake,
sizeof(handshake)));
} else {
- fprintf(stderr,
- "%s: fatal pty error errno=%d, error=%d device \"%s\"\n",
- ProgramName,
- handshake.error,
- handshake.fatal_error,
- handshake.buffer);
+ xtermWarning("fatal pty error errno=%d, error=%d device \"%s\"\n",
+ handshake.error,
+ handshake.fatal_error,
+ handshake.buffer);
fprintf(stderr, "%s\n", SysErrorMsg(handshake.error));
fprintf(stderr, "Reason: %s\n", SysReasonMsg(handshake.fatal_error));
}
@@ -3076,8 +3038,8 @@ first_map_occurred(void)
static void
HsSysError(int error)
{
- fprintf(stderr, "%s: fatal pty error %d (errno=%d) on tty %s\n",
- ProgramName, error, errno, ttydev);
+ xtermWarning("fatal pty error %d (errno=%d) on tty %s\n",
+ error, errno, ttydev);
exit(error);
}
#endif /* OPT_PTY_HANDSHAKE else !OPT_PTY_HANDSHAKE */
@@ -3096,9 +3058,8 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
why = errno;
if (why != ENOENT
&& save_ruid == 0) {
- fprintf(stderr, "Cannot chown %s to %ld,%ld: %s\n",
- device, (long) uid, (long) gid,
- strerror(why));
+ xtermPerror("Cannot chown %s to %ld,%ld",
+ device, (long) uid, (long) gid);
}
TRACE(("...chown failed: %s\n", strerror(why)));
} else if (chmod(device, mode) < 0) {
@@ -3106,16 +3067,13 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
if (why != ENOENT) {
struct stat sb;
if (stat(device, &sb) < 0) {
- fprintf(stderr, "Cannot chmod %s to %03o: %s\n",
- device, (unsigned) mode,
- strerror(why));
+ xtermPerror("Cannot chmod %s to %03o",
+ device, (unsigned) mode);
} else if (mode != (sb.st_mode & 0777U)) {
- fprintf(stderr,
- "Cannot chmod %s to %03lo currently %03lo: %s\n",
- device,
- (unsigned long) mode,
- (unsigned long) (sb.st_mode & 0777U),
- strerror(why));
+ xtermPerror("Cannot chmod %s to %03lo currently %03lo",
+ device,
+ (unsigned long) mode,
+ (unsigned long) (sb.st_mode & 0777U));
TRACE(("...stat uid=%d, gid=%d, mode=%#o\n",
sb.st_uid, sb.st_gid, (unsigned) sb.st_mode));
}
@@ -3317,19 +3275,18 @@ spawnXTerm(XtermWidget xw)
* necessary. ENXIO is what is normally returned if there is
* no controlling terminal, but some systems (e.g. SunOS 4.0)
* seem to return EIO. Solaris 2.3 is said to return EINVAL.
- * Cygwin returns ENOENT.
+ * Cygwin returns ENOENT. FreeBSD can return ENOENT, especially
+ * if xterm is run within a jail.
*/
#if USE_NO_DEV_TTY
no_dev_tty = False;
#endif
if (ttyfd < 0) {
if (tty_got_hung || errno == ENXIO || errno == EIO ||
+ errno == ENOENT ||
#ifdef ENODEV
errno == ENODEV ||
#endif
-#ifdef __CYGWIN__
- errno == ENOENT ||
-#endif
errno == EINVAL || errno == ENOTTY || errno == EACCES) {
#if USE_NO_DEV_TTY
no_dev_tty = True;
@@ -3573,6 +3530,17 @@ spawnXTerm(XtermWidget xw)
TTYSIZE_COLS(ts), i));
#endif /* TTYSIZE_STRUCT */
+#if defined(USE_USG_PTYS) || defined(HAVE_POSIX_OPENPT)
+ /*
+ * utempter checks the ownership of the device; some implementations
+ * set ownership in grantpt - do this first.
+ */
+ grantpt(screen->respond);
+#endif
+#if !defined(USE_USG_PTYS) && defined(HAVE_POSIX_OPENPT)
+ unlockpt(screen->respond);
+#endif
+
added_utmp_entry = False;
#if defined(USE_UTEMPTER)
#undef UTMP
@@ -3581,6 +3549,8 @@ spawnXTerm(XtermWidget xw)
/* Note: utempter may trim it anyway */
SetUtmpHost(dummy.ut_host, screen);
+ TRACE(("...calling addToUtmp(pty=%s, hostname=%s, master_fd=%d)\n",
+ ttydev, dummy.ut_host, screen->respond));
addToUtmp(ttydev, dummy.ut_host, screen->respond);
added_utmp_entry = True;
}
@@ -3611,204 +3581,197 @@ spawnXTerm(XtermWidget xw)
TRACE_CHILD
#ifdef USE_USG_PTYS
-#ifdef USE_ISPTS_FLAG
- if (IsPts) { /* SYSV386 supports both, which did we open? */
-#endif
+#ifdef HAVE_SETPGID
+ setpgid(0, 0);
+#else
setpgrp();
- grantpt(screen->respond);
- unlockpt(screen->respond);
- if ((pty_name = ptsname(screen->respond)) == 0) {
- SysError(ERROR_PTSNAME);
- } else if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
- SysError(ERROR_OPPTSNAME);
- }
+#endif
+ unlockpt(screen->respond);
+ if ((pty_name = ptsname(screen->respond)) == 0) {
+ SysError(ERROR_PTSNAME);
+ } else if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
+ SysError(ERROR_OPPTSNAME);
+ }
#ifdef I_PUSH
- else if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
- SysError(ERROR_PTEM);
- }
+ else if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
+ SysError(ERROR_PTEM);
+ }
#if !defined(SVR4) && !(defined(SYSV) && defined(i386))
- else if (!x_getenv("CONSEM")
- && ioctl(ptyfd, I_PUSH, "consem") < 0) {
- SysError(ERROR_CONSEM);
- }
+ else if (!x_getenv("CONSEM")
+ && ioctl(ptyfd, I_PUSH, "consem") < 0) {
+ SysError(ERROR_CONSEM);
+ }
#endif /* !SVR4 */
- else if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
- SysError(ERROR_LDTERM);
- }
+ else if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
+ SysError(ERROR_LDTERM);
+ }
#ifdef SVR4 /* from Sony */
- else if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
- SysError(ERROR_TTCOMPAT);
- }
+ else if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
+ SysError(ERROR_TTCOMPAT);
+ }
#endif /* SVR4 */
#endif /* I_PUSH */
- ttyfd = ptyfd;
+ ttyfd = ptyfd;
#ifndef __MVS__
- close_fd(screen->respond);
+ close_fd(screen->respond);
#endif /* __MVS__ */
#ifdef TTYSIZE_STRUCT
- /* tell tty how big window is */
+ /* tell tty how big window is */
#if OPT_TEK4014
- if (TEK4014_ACTIVE(xw)) {
- TTYSIZE_ROWS(ts) = 24;
- TTYSIZE_COLS(ts) = 80;
+ if (TEK4014_ACTIVE(xw)) {
+ TTYSIZE_ROWS(ts) = 24;
+ TTYSIZE_COLS(ts) = 80;
#ifdef USE_STRUCT_WINSIZE
- ts.ws_xpixel = TFullWidth(TekScreenOf(tekWidget));
- ts.ws_ypixel = TFullHeight(TekScreenOf(tekWidget));
+ ts.ws_xpixel = TFullWidth(TekScreenOf(tekWidget));
+ ts.ws_ypixel = TFullHeight(TekScreenOf(tekWidget));
#endif
- } else
+ } else
#endif /* OPT_TEK4014 */
- {
- TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
- TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
+ {
+ TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
+ TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
#ifdef USE_STRUCT_WINSIZE
- ts.ws_xpixel = (ttySize_t) FullWidth(screen);
- ts.ws_ypixel = (ttySize_t) FullHeight(screen);
+ ts.ws_xpixel = (ttySize_t) FullWidth(screen);
+ ts.ws_ypixel = (ttySize_t) FullHeight(screen);
#endif
- }
+ }
#endif /* TTYSIZE_STRUCT */
-#ifdef USE_ISPTS_FLAG
- } else { /* else pty, not pts */
-#endif
#endif /* USE_USG_PTYS */
- (void) pgrp; /* not all branches use this variable */
+ (void) pgrp; /* not all branches use this variable */
#if OPT_PTY_HANDSHAKE /* warning, goes for a long ways */
- if (resource.ptyHandshake) {
- /* close parent's sides of the pipes */
- close(cp_pipe[0]);
- close(pc_pipe[1]);
+ if (resource.ptyHandshake) {
+ /* close parent's sides of the pipes */
+ close(cp_pipe[0]);
+ close(pc_pipe[1]);
- /* Make sure that our sides of the pipes are not in the
- * 0, 1, 2 range so that we don't fight with stdin, out
- * or err.
- */
- if (cp_pipe[1] <= 2) {
- if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) {
- IGNORE_RC(close(cp_pipe[1]));
- cp_pipe[1] = i;
- }
+ /* Make sure that our sides of the pipes are not in the
+ * 0, 1, 2 range so that we don't fight with stdin, out
+ * or err.
+ */
+ if (cp_pipe[1] <= 2) {
+ if ((i = fcntl(cp_pipe[1], F_DUPFD, 3)) >= 0) {
+ IGNORE_RC(close(cp_pipe[1]));
+ cp_pipe[1] = i;
}
- if (pc_pipe[0] <= 2) {
- if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) {
- IGNORE_RC(close(pc_pipe[0]));
- pc_pipe[0] = i;
- }
+ }
+ if (pc_pipe[0] <= 2) {
+ if ((i = fcntl(pc_pipe[0], F_DUPFD, 3)) >= 0) {
+ IGNORE_RC(close(pc_pipe[0]));
+ pc_pipe[0] = i;
}
+ }
- /* we don't need the socket, or the pty master anymore */
- close(ConnectionNumber(screen->display));
+ /* we don't need the socket, or the pty master anymore */
+ close(ConnectionNumber(screen->display));
#ifndef __MVS__
- if (screen->respond >= 0)
- close(screen->respond);
+ if (screen->respond >= 0)
+ close(screen->respond);
#endif /* __MVS__ */
- /* Now is the time to set up our process group and
- * open up the pty slave.
- */
+ /* Now is the time to set up our process group and
+ * open up the pty slave.
+ */
#ifdef USE_SYSV_PGRP
#if defined(CRAY) && (OSMAJORVERSION > 5)
- IGNORE_RC(setsid());
+ IGNORE_RC(setsid());
#else
- IGNORE_RC(setpgrp());
+ IGNORE_RC(setpgrp());
#endif
#endif /* USE_SYSV_PGRP */
#if defined(__QNX__) && !defined(__QNXNTO__)
- qsetlogin(getlogin(), ttydev);
+ qsetlogin(getlogin(), ttydev);
#endif
- if (ttyfd >= 0) {
+ if (ttyfd >= 0) {
#ifdef __MVS__
- if (ttyGetAttr(ttyfd, &gio) == 0) {
- gio.c_cflag &= ~(HUPCL | PARENB);
- ttySetAttr(ttyfd, &gio);
- }
+ if (ttyGetAttr(ttyfd, &gio) == 0) {
+ gio.c_cflag &= ~(HUPCL | PARENB);
+ ttySetAttr(ttyfd, &gio);
+ }
#else /* !__MVS__ */
- close_fd(ttyfd);
+ close_fd(ttyfd);
#endif /* __MVS__ */
- }
+ }
- for (;;) {
+ for (;;) {
#if USE_NO_DEV_TTY
- if (!no_dev_tty
- && (ttyfd = open("/dev/tty", O_RDWR)) >= 0) {
- ioctl(ttyfd, TIOCNOTTY, (char *) NULL);
- close_fd(ttyfd);
- }
+ if (!no_dev_tty
+ && (ttyfd = open("/dev/tty", O_RDWR)) >= 0) {
+ ioctl(ttyfd, TIOCNOTTY, (char *) NULL);
+ close_fd(ttyfd);
+ }
#endif /* USE_NO_DEV_TTY */
#ifdef CSRG_BASED
- IGNORE_RC(revoke(ttydev));
+ IGNORE_RC(revoke(ttydev));
#endif
- if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {
+ if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {
#if defined(CRAY) && defined(TCSETCTTY)
- /* make /dev/tty work */
- ioctl(ttyfd, TCSETCTTY, 0);
+ /* make /dev/tty work */
+ ioctl(ttyfd, TCSETCTTY, 0);
#endif
#if ((defined(__GLIBC__) && defined(__FreeBSD_kernel__)) || defined(__GNU__)) && defined(TIOCSCTTY)
- /* make /dev/tty work */
- ioctl(ttyfd, TIOCSCTTY, 0);
+ /* make /dev/tty work */
+ ioctl(ttyfd, TIOCSCTTY, 0);
#endif
#ifdef USE_SYSV_PGRP
- /* We need to make sure that we are actually
- * the process group leader for the pty. If
- * we are, then we should now be able to open
- * /dev/tty.
- */
- if ((i = open("/dev/tty", O_RDWR)) >= 0) {
- /* success! */
- close(i);
- break;
- }
-#else /* USE_SYSV_PGRP */
+ /* We need to make sure that we are actually
+ * the process group leader for the pty. If
+ * we are, then we should now be able to open
+ * /dev/tty.
+ */
+ if ((i = open("/dev/tty", O_RDWR)) >= 0) {
+ /* success! */
+ close(i);
break;
-#endif /* USE_SYSV_PGRP */
}
- perror("open ttydev");
+#else /* USE_SYSV_PGRP */
+ break;
+#endif /* USE_SYSV_PGRP */
+ }
+ perror("open ttydev");
#ifdef TIOCSCTTY
- ioctl(ttyfd, TIOCSCTTY, 0);
+ ioctl(ttyfd, TIOCSCTTY, 0);
#endif
- /* let our master know that the open failed */
- handshake.status = PTY_BAD;
- handshake.error = errno;
- strcpy(handshake.buffer, ttydev);
- TRACE_HANDSHAKE("writing", &handshake);
- IGNORE_RC(write(cp_pipe[1],
- (const char *) &handshake,
- sizeof(handshake)));
-
- /* get reply from parent */
- i = (int) read(pc_pipe[0], (char *) &handshake,
- sizeof(handshake));
- if (i <= 0) {
- /* parent terminated */
- exit(1);
- }
-
- if (handshake.status == PTY_NOMORE) {
- /* No more ptys, let's shutdown. */
- exit(1);
- }
+ /* let our master know that the open failed */
+ handshake.status = PTY_BAD;
+ handshake.error = errno;
+ strcpy(handshake.buffer, ttydev);
+ TRACE_HANDSHAKE("writing", &handshake);
+ IGNORE_RC(write(cp_pipe[1],
+ (const char *) &handshake,
+ sizeof(handshake)));
- /* We have a new pty to try */
- free(ttydev);
- ttydev = x_strdup(handshake.buffer);
+ /* get reply from parent */
+ i = (int) read(pc_pipe[0], (char *) &handshake,
+ sizeof(handshake));
+ if (i <= 0) {
+ /* parent terminated */
+ exit(1);
}
- /* use the same tty name that everyone else will use
- * (from ttyname)
- */
- if ((ptr = ttyname(ttyfd)) != 0) {
- free(ttydev);
- ttydev = x_strdup(ptr);
+ if (handshake.status == PTY_NOMORE) {
+ /* No more ptys, let's shutdown. */
+ exit(1);
}
+
+ /* We have a new pty to try */
+ free(ttydev);
+ ttydev = x_strdup(handshake.buffer);
}
-#endif /* OPT_PTY_HANDSHAKE -- from near fork */
-#ifdef USE_ISPTS_FLAG
- } /* end of IsPts else clause */
-#endif
+ /* use the same tty name that everyone else will use
+ * (from ttyname)
+ */
+ if ((ptr = ttyname(ttyfd)) != 0) {
+ free(ttydev);
+ ttydev = x_strdup(ptr);
+ }
+ }
+#endif /* OPT_PTY_HANDSHAKE -- from near fork */
set_pty_permissions(screen->uid,
screen->gid,
@@ -3906,7 +3869,7 @@ spawnXTerm(XtermWidget xw)
}
}
#endif
- tio.c_cc[sysMode] = known_ttyChars[nn].myDefault;
+ tio.c_cc[sysMode] = (cc_t) known_ttyChars[nn].myDefault;
}
}
@@ -4012,14 +3975,12 @@ spawnXTerm(XtermWidget xw)
#ifdef TIOCCONS
int on = 1;
if (ioctl(ttyfd, TIOCCONS, (char *) &on) == -1)
- fprintf(stderr, "%s: cannot open console: %s\n",
- ProgramName, strerror(errno));
+ xtermPerror("cannot open console");
#endif
#ifdef SRIOCSREDIR
int fd = open("/dev/console", O_RDWR);
if (fd == -1 || ioctl(fd, SRIOCSREDIR, ttyfd) == -1)
- fprintf(stderr, "%s: cannot open console: %s\n",
- ProgramName, strerror(errno));
+ xtermPerror("cannot open console");
IGNORE_RC(close(fd));
#endif
}
@@ -4060,7 +4021,7 @@ spawnXTerm(XtermWidget xw)
#if OPT_TRACE
old_erase = tio.c_cc[VERASE];
#endif
- tio.c_cc[VERASE] = initial_erase;
+ tio.c_cc[VERASE] = (cc_t) initial_erase;
TRACE_RC(rc, ttySetAttr(ttyfd, &tio));
#else /* !TERMIO_STRUCT */
if (ioctl(ttyfd, TIOCGETP, (char *) &sg) == -1)
@@ -4343,7 +4304,7 @@ spawnXTerm(XtermWidget xw)
if (xw->misc.login_shell &&
(i = open(etc_lastlog, O_WRONLY)) >= 0) {
size_t size = sizeof(struct lastlog);
- off_t offset = (screen->uid * size);
+ off_t offset = (off_t) (screen->uid * size);
memset(&lastlog, 0, size);
(void) strncpy(lastlog.ll_line,
@@ -4546,11 +4507,8 @@ spawnXTerm(XtermWidget xw)
xtermFindShell(*command_to_exec_with_luit, False));
TRACE_ARGV("spawning luit command", command_to_exec_with_luit);
execvp(*command_to_exec_with_luit, command_to_exec_with_luit);
- /* print error message on screen */
- fprintf(stderr, "%s: Can't execvp %s: %s\n",
- ProgramName, *command_to_exec_with_luit, strerror(errno));
- fprintf(stderr, "%s: cannot support your locale.\n",
- ProgramName);
+ xtermPerror("Can't execvp %s", *command_to_exec_with_luit);
+ xtermWarning("cannot support your locale.\n");
}
#endif
if (command_to_exec) {
@@ -4560,9 +4518,7 @@ spawnXTerm(XtermWidget xw)
execvp(*command_to_exec, command_to_exec);
if (command_to_exec[1] == 0)
execlp(ptr, shname, "-c", command_to_exec[0], (void *) 0);
- /* print error message on screen */
- fprintf(stderr, "%s: Can't execvp %s: %s\n",
- ProgramName, *command_to_exec, strerror(errno));
+ xtermPerror("Can't execvp %s", *command_to_exec);
}
#ifdef USE_SYSV_SIGHUP
/* fix pts sh hanging around */
@@ -4598,8 +4554,7 @@ spawnXTerm(XtermWidget xw)
TRACE_ARGV("final luit command", command_to_exec_with_luit);
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));
+ xtermPerror("Can't execvp %s", *command_to_exec_with_luit);
}
#endif
execlp(ptr,
@@ -4607,8 +4562,7 @@ spawnXTerm(XtermWidget xw)
(void *) 0);
/* Exec failed. */
- fprintf(stderr, "%s: Could not exec %s: %s\n", ProgramName,
- ptr, strerror(errno));
+ xtermPerror("Could not exec %s", ptr);
IGNORE_RC(sleep(5));
exit(ERROR_EXEC);
}
@@ -4650,9 +4604,7 @@ spawnXTerm(XtermWidget xw)
IGNORE_RC(close(screen->respond));
if (get_pty(&screen->respond, XDisplayString(screen->display))) {
/* no more ptys! */
- fprintf(stderr,
- "%s: child process can find no available ptys: %s\n",
- ProgramName, strerror(errno));
+ xtermPerror("child process can find no available ptys");
handshake.status = PTY_NOMORE;
TRACE_HANDSHAKE("writing", &handshake);
IGNORE_RC(write(pc_pipe[1],
@@ -4691,9 +4643,8 @@ spawnXTerm(XtermWidget xw)
case UTMP_TTYSLOT:
case PTY_EXEC:
default:
- fprintf(stderr, "%s: unexpected handshake status %d\n",
- ProgramName,
- (int) handshake.status);
+ xtermWarning("unexpected handshake status %d\n",
+ (int) handshake.status);
}
}
/* close our sides of the pipes */
@@ -4765,8 +4716,10 @@ Exit(int n)
TScreen *screen = TScreenOf(xw);
#ifdef USE_UTEMPTER
- if (!resource.utmpInhibit && added_utmp_entry)
+ if (!resource.utmpInhibit && added_utmp_entry) {
+ TRACE(("...calling removeFromUtmp\n"));
removeFromUtmp();
+ }
#elif defined(HAVE_UTMP)
#ifdef USE_SYSV_UTMP
struct UTMP_STR utmp;
diff --git a/app/xterm/main.h b/app/xterm/main.h
index bf4e333d0..41dc8a9a4 100644
--- a/app/xterm/main.h
+++ b/app/xterm/main.h
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.56 2011/10/07 01:01:33 tom Exp $ */
+/* $XTermId: main.h,v 1.57 2011/12/14 22:43:02 tom Exp $ */
/*
* Copyright 2000-2010,2011 by Thomas E. Dickey
@@ -145,6 +145,10 @@
#define DEF_BACKARO_ERASE False
#endif
+#ifndef DEF_8BIT_META
+#define DEF_8BIT_META "true" /* eightBitMeta */
+#endif
+
#ifndef DEF_COLOR4
#define DEF_COLOR4 "blue2" /* see XTerm-col.ad */
#endif
@@ -206,4 +210,4 @@
*/
#define MAXRESOURCES 400
-#endif /* included_main_h */
+#endif /* included_main_h */
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index c66b63fa5..4cc3e2ece 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,4 +1,4 @@
-/* $XTermId: menu.c,v 1.300 2011/10/09 14:14:23 tom Exp $ */
+/* $XTermId: menu.c,v 1.301 2011/12/14 01:21:57 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -2215,7 +2215,7 @@ HandleAltEsc(Widget w,
String * params,
Cardinal *param_count)
{
- handle_vt_toggle(do_alt_esc, !TScreenOf(term)->input_eight_bits,
+ handle_vt_toggle(do_alt_esc, !TScreenOf(term)->alt_sends_esc,
params, *param_count, w);
}
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index d2c171794..32bbfbefb 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.550 2011/10/09 14:13:41 tom Exp $ */
+/* $XTermId: misc.c,v 1.576 2012/01/07 01:57:52 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -58,6 +58,7 @@
#include <sys/stat.h>
#include <stdio.h>
+#include <stdarg.h>
#include <signal.h>
#include <ctype.h>
#include <pwd.h>
@@ -118,6 +119,7 @@
(event.xcrossing.window == XtWindow(XtParent(xw))))
#endif
+static Boolean xtermAllocColor(XtermWidget, XColor *, const char *);
static Cursor make_hidden_cursor(XtermWidget);
#if OPT_EXEC_XTERM
@@ -160,12 +162,14 @@ Sleep(int msec)
}
static void
-selectwindow(TScreen * screen, int flag)
+selectwindow(XtermWidget xw, int flag)
{
+ TScreen *screen = TScreenOf(xw);
+
TRACE(("selectwindow(%d) flag=%d\n", screen->select, flag));
#if OPT_TEK4014
- if (TEK4014_ACTIVE(term)) {
+ if (TEK4014_ACTIVE(xw)) {
if (!Ttoggled)
TCursorToggle(tekWidget, TOGGLE);
screen->select |= flag;
@@ -174,8 +178,11 @@ selectwindow(TScreen * screen, int flag)
} else
#endif
{
- if (screen->xic)
- XSetICFocus(screen->xic);
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+ TInput *input = lookupTInput(xw, (Widget) xw);
+ if (input->xic)
+ XSetICFocus(input->xic);
+#endif
if (screen->cursor_state && CursorMoved(screen))
HideCursor();
@@ -187,18 +194,20 @@ selectwindow(TScreen * screen, int flag)
}
static void
-unselectwindow(TScreen * screen, int flag)
+unselectwindow(XtermWidget xw, int flag)
{
+ TScreen *screen = TScreenOf(xw);
+
TRACE(("unselectwindow(%d) flag=%d\n", screen->select, flag));
if (screen->hide_pointer) {
screen->hide_pointer = False;
- xtermDisplayCursor(term);
+ xtermDisplayCursor(xw);
}
if (!screen->always_highlight) {
#if OPT_TEK4014
- if (TEK4014_ACTIVE(term)) {
+ if (TEK4014_ACTIVE(xw)) {
if (!Ttoggled)
TCursorToggle(tekWidget, TOGGLE);
screen->select &= ~flag;
@@ -207,8 +216,11 @@ unselectwindow(TScreen * screen, int flag)
} else
#endif
{
- if (screen->xic)
- XUnsetICFocus(screen->xic);
+#if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
+ TInput *input = lookupTInput(xw, (Widget) xw);
+ if (input->xic)
+ XUnsetICFocus(input->xic);
+#endif
screen->select &= ~flag;
if (screen->cursor_state && CursorMoved(screen))
@@ -229,7 +241,7 @@ DoSpecialEnterNotify(XtermWidget xw, XEnterWindowEvent * ev)
if (((ev->detail) != NotifyInferior) &&
ev->focus &&
!(screen->select & FOCUS))
- selectwindow(screen, INWINDOW);
+ selectwindow(xw, INWINDOW);
}
static void
@@ -242,7 +254,7 @@ DoSpecialLeaveNotify(XtermWidget xw, XEnterWindowEvent * ev)
if (((ev->detail) != NotifyInferior) &&
ev->focus &&
!(screen->select & FOCUS))
- unselectwindow(screen, INWINDOW);
+ unselectwindow(xw, INWINDOW);
}
#ifndef XUrgencyHint
@@ -770,7 +782,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED,
&& strncmp(ProgramName, "../", (size_t) 3)) {
child_exe = xtermFindShell(ProgramName, True);
} else {
- fprintf(stderr, "Cannot exec-xterm given %s\n", ProgramName);
+ xtermWarning("Cannot exec-xterm given \"%s\"\n", ProgramName);
}
if (child_exe == 0)
return;
@@ -791,7 +803,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED,
/* The reaper will take care of cleaning up the child */
pid = fork();
if (pid == -1) {
- fprintf(stderr, "Could not fork: %s\n", SysErrorMsg(errno));
+ xtermWarning("Could not fork: %s\n", SysErrorMsg(errno));
} else if (!pid) {
/* We are the child */
if (child_cwd) {
@@ -800,7 +812,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED,
if (setuid(screen->uid) == -1
|| setgid(screen->gid) == -1) {
- fprintf(stderr, "Cannot reset uid/gid\n");
+ xtermWarning("Cannot reset uid/gid\n");
} else {
unsigned myargc = *nparams + 1;
char **myargv = TypeMallocN(char *, myargc + 1);
@@ -816,7 +828,7 @@ HandleSpawnTerminal(Widget w GCC_UNUSED,
execv(child_exe, myargv);
/* If we get here, we've failed */
- fprintf(stderr, "exec of '%s': %s\n", child_exe, SysErrorMsg(errno));
+ xtermWarning("exec of '%s': %s\n", child_exe, SysErrorMsg(errno));
}
_exit(0);
} else {
@@ -921,9 +933,9 @@ HandleFocusChange(Widget w GCC_UNUSED,
*/
if (event->detail == NotifyNonlinear
&& (screen->select & INWINDOW) != 0) {
- unselectwindow(screen, INWINDOW);
+ unselectwindow(xw, INWINDOW);
}
- selectwindow(screen,
+ selectwindow(xw,
((event->detail == NotifyPointer)
? INWINDOW
: FOCUS));
@@ -939,7 +951,7 @@ HandleFocusChange(Widget w GCC_UNUSED,
* ignore.
*/
if (event->mode != NotifyGrab) {
- unselectwindow(screen,
+ unselectwindow(xw,
((event->detail == NotifyPointer)
? INWINDOW
: FOCUS));
@@ -1088,10 +1100,17 @@ Bell(XtermWidget xw, int which, int percent)
static void
flashWindow(TScreen * screen, Window window, GC visualGC, unsigned width, unsigned height)
{
- XFillRectangle(screen->display, window, visualGC, 0, 0, width, height);
+ int y = 0;
+ int x = 0;
+
+ if (screen->flash_line) {
+ y = CursorY(screen, screen->cur_row);
+ height = (unsigned) FontHeight(screen);
+ }
+ XFillRectangle(screen->display, window, visualGC, x, y, width, height);
XFlush(screen->display);
Sleep(VB_DELAY);
- XFillRectangle(screen->display, window, visualGC, 0, 0, width, height);
+ XFillRectangle(screen->display, window, visualGC, x, y, width, height);
}
void
@@ -1139,6 +1158,34 @@ HandleBellPropertyChange(Widget w GCC_UNUSED,
}
}
+void
+xtermWarning(const char *fmt,...)
+{
+ va_list ap;
+
+ fprintf(stderr, "%s: ", ProgramName);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ (void) fflush(stderr);
+
+ va_end(ap);
+}
+
+void
+xtermPerror(const char *fmt,...)
+{
+ char *msg = strerror(errno);
+ va_list ap;
+
+ fprintf(stderr, "%s: ", ProgramName);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, ": %s\n", msg);
+ (void) fflush(stderr);
+
+ va_end(ap);
+}
+
Window
WMFrameWindow(XtermWidget xw)
{
@@ -1590,7 +1637,7 @@ timestamp_filename(char *dst, const char *src)
tstruct = localtime(&tstamp);
sprintf(dst, TIMESTAMP_FMT,
src,
- tstruct->tm_year + 1900,
+ (int) tstruct->tm_year + 1900,
tstruct->tm_mon + 1,
tstruct->tm_mday,
tstruct->tm_hour,
@@ -1607,11 +1654,10 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append)
#ifdef VMS
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) {
int the_error = errno;
- fprintf(stderr, "%s: cannot open %s: %d:%s\n",
- ProgramName,
- path,
- the_error,
- SysErrorMsg(the_error));
+ xtermWarning("cannot open %s: %d:%s\n",
+ path,
+ the_error,
+ SysErrorMsg(the_error));
return -1;
}
chown(path, uid, gid);
@@ -1620,11 +1666,10 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append)
|| (creat_as(uid, gid, append, path, 0644) <= 0)
|| ((fd = open(path, O_WRONLY | O_APPEND)) < 0)) {
int the_error = errno;
- fprintf(stderr, "%s: cannot open %s: %d:%s\n",
- ProgramName,
- path,
- the_error,
- SysErrorMsg(the_error));
+ xtermWarning("cannot open %s: %d:%s\n",
+ path,
+ the_error,
+ SysErrorMsg(the_error));
return -1;
}
#endif
@@ -1636,7 +1681,7 @@ open_userfile(uid_t uid, gid_t gid, char *path, Bool append)
if (fstat(fd, &sb) < 0
|| sb.st_uid != uid
|| (sb.st_mode & 022) != 0) {
- fprintf(stderr, "%s: you do not own %s\n", ProgramName, path);
+ xtermWarning("you do not own %s\n", path);
close(fd);
return -1;
}
@@ -1753,11 +1798,11 @@ xtermResetIds(TScreen * screen)
{
int result = 0;
if (setgid(screen->gid) == -1) {
- fprintf(stderr, "%s: unable to reset group-id\n", ProgramName);
+ xtermWarning("unable to reset group-id\n");
result = -1;
}
if (setuid(screen->uid) == -1) {
- fprintf(stderr, "%s: unable to reset user-id\n", ProgramName);
+ xtermWarning("unable to reset user-id\n");
result = -1;
}
return result;
@@ -1892,9 +1937,7 @@ StartLog(XtermWidget xw)
execl(shell, shell, "-c", &screen->logfile[1], (void *) 0);
- fprintf(stderr, "%s: Can't exec `%s'\n",
- ProgramName,
- &screen->logfile[1]);
+ xtermWarning("Can't exec `%s'\n", &screen->logfile[1]);
exit(ERROR_LOGEXEC);
}
close(p[0]);
@@ -1983,10 +2026,9 @@ ReportAnsiColorRequest(XtermWidget xw, int colornum, int final)
}
}
-static unsigned
-getColormapSize(Display * display)
+static void
+getColormapInfo(Display * display, unsigned *typep, unsigned *sizep)
{
- unsigned result;
int numFound;
XVisualInfo myTemplate, *visInfoPtr;
@@ -1994,9 +2036,44 @@ getColormapSize(Display * display)
XDefaultScreen(display)));
visInfoPtr = XGetVisualInfo(display, (long) VisualIDMask,
&myTemplate, &numFound);
- result = (numFound >= 1) ? (unsigned) visInfoPtr->colormap_size : 0;
+ *typep = (numFound >= 1) ? (unsigned) visInfoPtr->class : 0;
+ *sizep = (numFound >= 1) ? (unsigned) visInfoPtr->colormap_size : 0;
XFree((char *) visInfoPtr);
+
+ TRACE(("getColormapInfo type %d (%s), size %d\n",
+ *typep, ((*typep & 1) ? "dynamic" : "static"), *sizep));
+}
+
+#define MAX_COLORTABLE 4096
+
+/*
+ * Make only one call to XQueryColors(), since it can be slow.
+ */
+static Boolean
+loadColorTable(XtermWidget xw, unsigned length)
+{
+ Colormap cmap = xw->core.colormap;
+ TScreen *screen = TScreenOf(xw);
+ unsigned i;
+ Boolean result = False;
+
+ if (screen->cmap_data == 0
+ && length != 0
+ && length < MAX_COLORTABLE) {
+ screen->cmap_data = TypeMallocN(XColor, (size_t) length);
+ if (screen->cmap_data != 0) {
+ screen->cmap_size = length;
+
+ for (i = 0; i < screen->cmap_size; i++) {
+ screen->cmap_data[i].pixel = (unsigned long) i;
+ }
+ result = (Boolean) (XQueryColors(screen->display,
+ cmap,
+ screen->cmap_data,
+ (int) screen->cmap_size) != 0);
+ }
+ }
return result;
}
@@ -2018,31 +2095,27 @@ getColormapSize(Display * display)
* Return False if not able to find or allocate a color.
*/
static Boolean
-find_closest_color(Display * dpy, Colormap cmap, XColor * def)
+allocateClosestRGB(XtermWidget xw, Colormap cmap, XColor * def)
{
+ TScreen *screen = TScreenOf(xw);
Boolean result = False;
- XColor *colortable;
char *tried;
double diff, thisRGB, bestRGB;
unsigned attempts;
unsigned bestInx;
+ unsigned cmap_type;
unsigned cmap_size;
unsigned i;
- cmap_size = getColormapSize(dpy);
- if (cmap_size != 0) {
+ getColormapInfo(screen->display, &cmap_type, &cmap_size);
+
+ if ((cmap_type & 1) != 0) {
- colortable = TypeMallocN(XColor, (size_t) cmap_size);
- if (colortable != 0) {
+ if (loadColorTable(xw, cmap_size)) {
tried = TypeCallocN(char, (size_t) 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);
-
/*
* Try (possibly each entry in the color map) to find the best
* approximation to the requested color.
@@ -2063,7 +2136,7 @@ find_closest_color(Display * dpy, Colormap cmap, XColor * def)
* weights that correspond to the luminance.
*/
#define AddColorWeight(weight, color) \
- diff = weight * (int) ((def->color) - colortable[i].color); \
+ diff = weight * (int) ((def->color) - screen->cmap_data[i].color); \
thisRGB = diff * diff
AddColorWeight(0.30, red);
@@ -2077,8 +2150,11 @@ find_closest_color(Display * dpy, Colormap cmap, XColor * def)
}
}
}
- if (XAllocColor(dpy, cmap, &colortable[bestInx]) != 0) {
- *def = colortable[bestInx];
+ if (XAllocColor(screen->display, cmap,
+ &screen->cmap_data[bestInx]) != 0) {
+ *def = screen->cmap_data[bestInx];
+ TRACE(("...closest %x/%x/%x\n", def->red,
+ def->green, def->blue));
result = True;
break;
}
@@ -2091,12 +2167,115 @@ find_closest_color(Display * dpy, Colormap cmap, XColor * def)
}
free(tried);
}
- free(colortable);
}
}
return result;
}
+#ifndef ULONG_MAX
+#define ULONG_MAX (unsigned long)(~(0L))
+#endif
+
+static unsigned short
+searchColortable(XColor * colortable, unsigned length, unsigned color)
+{
+ unsigned result = 0;
+ unsigned n;
+ unsigned long best = ULONG_MAX;
+ unsigned long diff;
+
+ for (n = 0; n < length; ++n) {
+ diff = (color - colortable[n].blue);
+ diff *= diff;
+ if (diff < best) {
+#if 0
+ TRACE(("...%d:looking for %x, found %x/%x/%x (%lx)\n",
+ n, color,
+ colortable[n].red,
+ colortable[n].green,
+ colortable[n].blue,
+ diff));
+#endif
+ result = n;
+ best = diff;
+ }
+ }
+ return colortable[result].blue;
+}
+
+/*
+ * This is a workaround for a longstanding defect in the X libraries.
+ *
+ * According to
+ * http://www.unix.com/man-page/all/3x/XAllocColoA/
+ *
+ * XAllocColor() acts differently on static and dynamic visuals. On Pseu-
+ * doColor, DirectColor, and GrayScale visuals, XAllocColor() fails if
+ * there are no unallocated colorcells and no allocated read-only cell
+ * exactly matches the requested RGB values. On StaticColor, TrueColor,
+ * and StaticGray visuals, XAllocColor() returns the closest RGB values
+ * available in the colormap. The colorcell_in_out structure returns the
+ * actual RGB values allocated.
+ *
+ * That is, XAllocColor() should suffice unless the color map is full. In that
+ * case, allocateClosesRGB() is useful for the dynamic display classes such as
+ * PseudoColor. It is not useful for TrueColor, since XQueryColors() does not
+ * return regular RGB triples (unless a different scheme was used for
+ * specifying the pixel values); only the blue value is filled in. However, it
+ * is filled in with the colors that the server supports.
+ *
+ * Also (the reason for this function), XAllocColor() does not really work as
+ * described. For some TrueColor configurations it merely returns a close
+ * approximation, but not the closest.
+ */
+static Boolean
+allocateExactRGB(XtermWidget xw, Colormap cmap, XColor * def)
+{
+ XColor save = *def;
+ TScreen *screen = TScreenOf(xw);
+ Boolean result = (Boolean) (XAllocColor(screen->display, cmap, def) != 0);
+
+ /*
+ * If this is a statically allocated display, e.g., TrueColor, see if we
+ * can improve on the result by using the color values actually supported
+ * by the server.
+ */
+ if (result) {
+ unsigned cmap_type;
+ unsigned cmap_size;
+
+ getColormapInfo(screen->display, &cmap_type, &cmap_size);
+
+ if ((cmap_type & 1) == 0) {
+ XColor temp = *def;
+
+ if (loadColorTable(xw, cmap_size)) {
+ /*
+ * Note: the query will return only a value in the ".blue"
+ * member, leaving ".red" and ".green" as zeros.
+ */
+ temp.red = searchColortable(screen->cmap_data, cmap_size, save.red);
+ temp.green = searchColortable(screen->cmap_data, cmap_size, save.green);
+ temp.blue = searchColortable(screen->cmap_data, cmap_size, save.blue);
+ if (XAllocColor(screen->display, cmap, &temp) != 0) {
+#if OPT_TRACE
+ if (temp.red != save.red
+ || temp.green != save.green
+ || temp.blue != save.blue) {
+ TRACE(("...improved %x/%x/%x ->%x/%x/%x\n",
+ save.red, save.green, save.blue,
+ temp.red, temp.green, temp.blue));
+ }
+#endif
+ *def = temp;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
/*
* Allocate a color for the "ANSI" colors. That actually includes colors up
* to 256.
@@ -2113,12 +2292,8 @@ AllocateAnsiColor(XtermWidget xw,
{
int result;
XColor def;
- TScreen *screen = TScreenOf(xw);
- Colormap cmap = xw->core.colormap;
- if (XParseColor(screen->display, cmap, spec, &def)
- && (XAllocColor(screen->display, cmap, &def)
- || find_closest_color(screen->display, cmap, &def))) {
+ if (xtermAllocColor(xw, &def, spec)) {
if (
#if OPT_COLOR_RES
res->mode == True &&
@@ -2129,7 +2304,7 @@ AllocateAnsiColor(XtermWidget xw,
result = 1;
SET_COLOR_RES(res, def.pixel);
TRACE(("AllocateAnsiColor[%d] %s (pixel 0x%06lx)\n",
- (int) (res - screen->Acolors), spec, def.pixel));
+ (int) (res - TScreenOf(xw)->Acolors), spec, def.pixel));
#if OPT_COLOR_RES
if (!res->mode)
result = 0;
@@ -2161,10 +2336,8 @@ xtermGetColorRes(XtermWidget xw, ColorRes * res)
if (AllocateAnsiColor(xw, res, res->resource) < 0) {
res->value = TScreenOf(xw)->Tcolors[TEXT_FG].value;
res->mode = -True;
- fprintf(stderr,
- "%s: Cannot allocate color \"%s\"\n",
- ProgramName,
- NonNull(res->resource));
+ xtermWarning("Cannot allocate color \"%s\"\n",
+ NonNull(res->resource));
}
result = res->value;
} else {
@@ -2307,9 +2480,27 @@ ResetAnsiColorRequest(XtermWidget xw, char *buf, int start)
return repaint;
}
#else
-#define find_closest_color(display, cmap, def) 0
+#define allocateClosestRGB(xw, cmap, def) 0
+#define allocateExactRGB(xw, cmap, def) XAllocColor(TScreenOf(xw)->display, cmap, def)
#endif /* OPT_ISO_COLORS */
+static Boolean
+xtermAllocColor(XtermWidget xw, XColor * def, const char *spec)
+{
+ Boolean result = False;
+ TScreen *screen = TScreenOf(xw);
+ Colormap cmap = xw->core.colormap;
+
+ if (XParseColor(screen->display, cmap, spec, def)
+ && (allocateExactRGB(xw, cmap, def)
+ || allocateClosestRGB(xw, cmap, def))) {
+ TRACE(("xtermAllocColor -> %x/%x/%x\n",
+ def->red, def->green, def->blue));
+ result = True;
+ }
+ return result;
+}
+
#if OPT_PASTE64
static void
ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final)
@@ -2482,7 +2673,7 @@ GetOldColors(XtermWidget xw)
if (pOldColors == NULL) {
pOldColors = TypeXtMalloc(ScrnColors);
if (pOldColors == NULL) {
- fprintf(stderr, "allocation failure in GetOldColors\n");
+ xtermWarning("allocation failure in GetOldColors\n");
return (False);
}
pOldColors->which = 0;
@@ -3774,7 +3965,11 @@ do_decrpm(XtermWidget xw, int nparams, int *params)
break;
#endif
case SET_EXT_MODE_MOUSE:
- result = MdBool(screen->ext_mode_mouse);
+ /* FALLTHRU */
+ case SET_SGR_EXT_MODE_MOUSE:
+ /* FALLTHRU */
+ case SET_URXVT_EXT_MODE_MOUSE:
+ result = MdBool(screen->extend_coords == params[0]);
break;
case 1010: /* rxvt */
result = MdBool(screen->scrollttyoutput);
@@ -3783,7 +3978,7 @@ do_decrpm(XtermWidget xw, int nparams, int *params)
result = MdBool(screen->scrollkey);
break;
case 1034:
- result = MdBool(screen->input_eight_bits);
+ result = MdBool(screen->eight_bit_meta);
break;
#if OPT_NUM_LOCK
case 1035:
@@ -4044,7 +4239,7 @@ ChangeIconName(XtermWidget xw, char *name)
if (resource.zIconBeep && TScreenOf(xw)->zIconBeep_flagged) {
char *newname = CastMallocN(char, strlen(name) + 4);
if (!newname) {
- fprintf(stderr, "malloc failed in ChangeIconName\n");
+ xtermWarning("malloc failed in ChangeIconName\n");
return;
}
strcpy(newname, "*** ");
@@ -4141,8 +4336,6 @@ AllocateTermColor(XtermWidget xw,
if (always || AllowColorOps(xw, ecSetColor)) {
XColor def;
- TScreen *screen = TScreenOf(xw);
- Colormap cmap = xw->core.colormap;
char *newName;
result = True;
@@ -4150,11 +4343,7 @@ AllocateTermColor(XtermWidget xw,
def.pixel = xw->old_foreground;
} else if (!x_strcasecmp(name, XtDefaultBackground)) {
def.pixel = xw->old_background;
- } else if (XParseColor(screen->display, cmap, name, &def)
- && (XAllocColor(screen->display, cmap, &def)
- || find_closest_color(screen->display, cmap, &def))) {
- ; /*empty */
- } else {
+ } else if (!xtermAllocColor(xw, &def, name)) {
result = False;
}
@@ -4182,10 +4371,7 @@ Panic(const char *s GCC_UNUSED, int a GCC_UNUSED)
{
#ifdef DEBUG
if (debug) {
- fprintf(stderr, "%s: PANIC!\t", ProgramName);
- fprintf(stderr, s, a);
- fputs("\r\n", stderr);
- fflush(stderr);
+ xtermWarning(s, a);
}
#endif /* DEBUG */
}
@@ -4306,7 +4492,7 @@ Cleanup(int code)
if (resource.sessionMgt) {
XtVaSetValues(toplevel,
XtNjoinSession, False,
- NULL);
+ (void *) 0);
}
#endif
}
@@ -4382,7 +4568,7 @@ xtermFindShell(char *leaf, Bool warning)
|| strstr(result, "..") != 0
|| access(result, X_OK) != 0) {
if (warning)
- fprintf(stderr, "No absolute path found for shell: %s\n", result);
+ xtermWarning("No absolute path found for shell: %s\n", result);
result = 0;
}
return result;
@@ -4485,7 +4671,7 @@ xtermSetenv(const char *var, const char *value)
char **newenv;
newenv = TypeMallocN(char *, need);
if (newenv == 0) {
- fprintf(stderr, "Cannot increase environment\n");
+ xtermWarning("Cannot increase environment\n");
return;
}
memmove(newenv, environ, have * sizeof(*newenv));
@@ -4500,7 +4686,7 @@ xtermSetenv(const char *var, const char *value)
environ[found] = CastMallocN(char, 1 + len + strlen(value));
if (environ[found] == 0) {
- fprintf(stderr, "Cannot allocate environment %s\n", var);
+ xtermWarning("Cannot allocate environment %s\n", var);
return;
}
sprintf(environ[found], "%s=%s", var, value);
@@ -4531,7 +4717,7 @@ xtermUnsetenv(const char *var)
int
xerror(Display * d, XErrorEvent * ev)
{
- fprintf(stderr, "%s: warning, error event received:\n", ProgramName);
+ xtermWarning("warning, error event received:\n");
(void) XmuPrintDefaultErrorMessage(d, ev, stderr);
Exit(ERROR_XERROR);
return 0; /* appease the compiler */
@@ -4542,9 +4728,8 @@ ice_error(IceConn iceConn)
{
(void) iceConn;
- fprintf(stderr,
- "%s: ICE IO error handler doing an exit(), pid = %ld, errno = %d\n",
- ProgramName, (long) getpid(), errno);
+ xtermWarning("ICE IO error handler doing an exit(), pid = %ld, errno = %d\n",
+ (long) getpid(), errno);
Exit(ERROR_ICEERROR);
}
@@ -4555,10 +4740,9 @@ xioerror(Display * dpy)
{
int the_error = errno;
- (void) fprintf(stderr,
- "%s: fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n",
- ProgramName, the_error, SysErrorMsg(the_error),
- DisplayString(dpy));
+ xtermWarning("fatal IO error %d (%s) or KillClient on X server \"%s\"\r\n",
+ the_error, SysErrorMsg(the_error),
+ DisplayString(dpy));
Exit(ERROR_XIOERROR);
return 0; /* appease the compiler */
@@ -4567,13 +4751,13 @@ xioerror(Display * dpy)
void
xt_error(String message)
{
- (void) fprintf(stderr, "%s Xt error: %s\n", ProgramName, message);
+ xtermWarning("Xt error: %s\n", message);
/*
* Check for the obvious - Xt does a poor job of reporting this.
*/
if (x_getenv("DISPLAY") == 0) {
- fprintf(stderr, "%s: DISPLAY is not set\n", ProgramName);
+ xtermWarning("DISPLAY is not set\n");
}
exit(1);
}
@@ -5135,8 +5319,7 @@ validWindow(Display * dpy, Window win, XWindowAttributes * attrs)
if (result) {
TRACE_WIN_ATTRS(attrs);
} else {
- fprintf(stderr, "%s: invalid window-id %ld\n",
- ProgramName, (long) win);
+ xtermWarning("invalid window-id %ld\n", (long) win);
}
}
return result;
diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c
index 2148c23ff..6e6b4faab 100644
--- a/app/xterm/os2main.c
+++ b/app/xterm/os2main.c
@@ -1,4 +1,4 @@
-/* $XTermId: os2main.c,v 1.271 2011/07/10 22:19:51 tom Exp $ */
+/* $XTermId: os2main.c,v 1.273 2011/12/27 10:36:58 tom Exp $ */
/* removed all foreign stuff to get the code more clear (hv)
* and did some rewrite for the obscure OS/2 environment
@@ -801,8 +801,7 @@ Syntax(char *badOption)
OptionHelp *list = sortedOpts(xtermOptions, optionDescList, XtNumber(optionDescList));
int col;
- fprintf(stderr, "%s: bad command line option \"%s\"\r\n\n",
- ProgramName, badOption);
+ xtermWarning("bad command line option \"%s\"\r\n\n", badOption);
fprintf(stderr, "usage: %s", ProgramName);
col = 8 + (int) strlen(ProgramName);
@@ -1003,9 +1002,7 @@ main(int argc, char **argv ENVP_ARG)
ttydev = TypeMallocN(char, PTMS_BUFSZ);
ptydev = TypeMallocN(char, PTMS_BUFSZ);
if (!ttydev || !ptydev) {
- fprintf(stderr,
- "%s: unable to allocate memory for ttydev or ptydev\n",
- ProgramName);
+ xtermWarning("unable to allocate memory for ttydev or ptydev\n");
exit(1);
}
strcpy(ttydev, TTYDEV);
@@ -1067,8 +1064,7 @@ main(int argc, char **argv ENVP_ARG)
if (resource.tty_modes) {
int n = parse_tty_modes(resource.tty_modes, ttymodelist);
if (n < 0) {
- fprintf(stderr, "%s: bad tty modes \"%s\"\n",
- ProgramName, resource.tty_modes);
+ xtermWarning("bad tty modes \"%s\"\n", resource.tty_modes);
} else if (n > 0) {
override_tty_modes = True;
}
@@ -1076,8 +1072,7 @@ main(int argc, char **argv ENVP_ARG)
#if OPT_ZICONBEEP
if (resource.zIconBeep > 100 || resource.zIconBeep < -100) {
resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */
- fprintf(stderr,
- "a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
+ xtermWarning("a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
}
#endif /* OPT_ZICONBEEP */
hold_screen = resource.hold_screen ? 1 : 0;
@@ -1432,7 +1427,7 @@ pty_search(int *pty)
#endif
return 0;
} else {
- fprintf(stderr, "Unable to open %s, errno=%d\n", ptydev, errno);
+ xtermWarning("Unable to open %s, errno=%d\n", ptydev, errno);
}
}
return 1;
@@ -1537,9 +1532,8 @@ set_owner(char *device, uid_t uid, gid_t gid, mode_t mode)
why = errno;
if (why != ENOENT
&& save_ruid == 0) {
- fprintf(stderr, "Cannot chown %s to %ld,%ld: %s\n",
- device, (long) uid, (long) gid,
- strerror(why));
+ xtermPerror("Cannot chown %s to %ld,%ld",
+ device, (long) uid, (long) gid);
}
}
}
@@ -1777,7 +1771,7 @@ spawnXTerm(XtermWidget xw)
*/
if ((ttyfd = open(ttydev, O_RDWR)) < 0) {
/* dumm gelaufen */
- fprintf(stderr, "Cannot open slave side of PTY\n");
+ xtermWarning("Cannot open slave side of PTY\n");
exit(1);
}
@@ -1817,8 +1811,7 @@ spawnXTerm(XtermWidget xw)
if (Console) {
int on = 1;
if (ioctl(ttyfd, TIOCCONS, (char *) &on) == -1)
- fprintf(stderr, "%s: cannot open console: %s\n",
- ProgramName, strerror(errno));
+ xtermPerror("cannot open console");
}
}
@@ -1908,11 +1901,8 @@ spawnXTerm(XtermWidget xw)
xtermFindShell(*command_to_exec_with_luit, False));
TRACE(("spawning command \"%s\"\n", *command_to_exec_with_luit));
execvp(*command_to_exec_with_luit, command_to_exec_with_luit);
- /* print error message on screen */
- fprintf(stderr, "%s: Can't execvp %s: %s\n",
- ProgramName, *command_to_exec_with_luit, strerror(errno));
- fprintf(stderr, "%s: cannot support your locale.\n",
- ProgramName);
+ xtermPerror("Can't execvp %s", *command_to_exec_with_luit);
+ xtermWarning("cannot support your locale.\n");
}
#endif
if (command_to_exec) {
@@ -1922,8 +1912,7 @@ spawnXTerm(XtermWidget xw)
execvpe(*command_to_exec, command_to_exec, gblenvp);
/* print error message on screen */
- fprintf(stderr, "%s: Can't execvp %s\n",
- ProgramName, *command_to_exec);
+ xtermWarning("Can't execvp %s\n", *command_to_exec);
}
/* use a layered mechanism to find a shell */
@@ -1953,14 +1942,12 @@ spawnXTerm(XtermWidget xw)
execvpe(exargv[0], exargv, gblenvp);
/* print error message on screen */
- fprintf(stderr, "%s: Can't execvp %s\n",
- ProgramName, *command_to_exec);
+ xtermWarning("Can't execvp %s\n", *command_to_exec);
} else {
execlpe(ptr, shname, 0, gblenvp);
/* Exec failed. */
- fprintf(stderr, "%s: Could not exec %s!\n",
- ProgramName, ptr);
+ xtermWarning("Could not exec %s!\n", ptr);
}
sleep(5);
diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog
index 869a49b06..eaffb1897 100644
--- a/app/xterm/package/debian/changelog
+++ b/app/xterm/package/debian/changelog
@@ -1,3 +1,16 @@
+xterm-dev (278) unstable; urgency=low
+
+ * Fix regression in eightBitInput logic.
+ * Fix regression in Darwin 9.x
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Thu, 12 Jan 2012 08:10:50 -0500
+
+xterm-dev (277) unstable; urgency=low
+
+ * Minor keyboard fix.
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 11 Oct 2011 20:12:14 -0400
+
xterm-dev (276) unstable; urgency=low
* Regressions in #272, #274.
diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec
index c7566818d..7ee524cc2 100644
--- a/app/xterm/package/xterm.spec
+++ b/app/xterm/package/xterm.spec
@@ -1,7 +1,7 @@
-# $XTermId: xterm.spec,v 1.18 2011/09/28 21:33:43 tom Exp $
+# $XTermId: xterm.spec,v 1.20 2012/01/12 13:10:21 tom Exp $
Summary: A text-based Web browser
Name: xterm-dev
-Version: 276
+Version: 278
Release: 1
License: X11
Group: Applications/Internet
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index e8006a10b..9e127bd5e 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.704 2011/08/30 22:39:45 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.720 2012/01/05 23:58:19 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -174,26 +174,21 @@
#undef USE_PTY_SEARCH
#elif defined(PUCC_PTYD)
#undef USE_PTY_SEARCH
+#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__)
+#undef USE_PTY_SEARCH
#elif defined(__OpenBSD__)
#undef USE_PTY_SEARCH
#undef USE_PTY_DEVICE
-#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__)
-#undef USE_PTY_SEARCH
#endif
-#if defined(SYSV) && defined(i386) && !defined(SVR4)
-#define ATT
-#define USE_HANDSHAKE 1
-#define USE_ISPTS_FLAG 1
+#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
+#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */
#endif
#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
#define USE_USG_PTYS
-#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */
#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386))
#define USE_USG_PTYS
-#else
-#define USE_HANDSHAKE 1
#endif
/*
@@ -665,6 +660,10 @@ typedef struct {
#define OPT_SELECT_REGEX 0 /* true if xterm supports regular-expression selects */
#endif
+#ifndef OPT_SELECTION_OPS
+#define OPT_SELECTION_OPS 1 /* true if xterm supports operations on selection */
+#endif
+
#ifndef OPT_SESSION_MGT
#if defined(XtNdieCallback) && defined(XtNsaveCallback)
#define OPT_SESSION_MGT 1
@@ -1560,6 +1559,15 @@ typedef struct {
String menu_font_names[NMENUFONTS][fMAX];
} SubResourceRec;
+#if OPT_INPUT_METHOD
+#define NINPUTWIDGETS 3
+typedef struct {
+ Widget w;
+ XIM xim; /* input method attached to 'w' */
+ XIC xic; /* input context attached to 'xim' */
+} TInput;
+#endif
+
typedef struct {
/* These parameters apply to both windows */
Display *display; /* X display for screen */
@@ -1582,6 +1590,8 @@ typedef struct {
Boolean hilite_reverse; /* hilite overrides reverse */
#endif
#if OPT_ISO_COLORS
+ XColor * cmap_data; /* color table */
+ unsigned cmap_size;
ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */
int veryBoldColors; /* modifier for boldColors */
Boolean boldColors; /* can we make bold colors? */
@@ -1637,7 +1647,7 @@ typedef struct {
long event_mask;
unsigned send_mouse_pos; /* user wants mouse transition */
/* and position information */
- Boolean ext_mode_mouse; /* support large terminals */
+ int extend_coords; /* support large terminals */
Boolean send_focus_pos; /* user wants focus in/out info */
Boolean quiet_grab; /* true if no cursor change on focus */
#if OPT_PASTE64
@@ -1922,6 +1932,7 @@ typedef struct {
int bellSuppressTime; /* msecs after Bell before another allowed */
Boolean bellInProgress; /* still ringing/flashing prev bell? */
Boolean bellIsUrgent; /* set XUrgency WM hint on bell */
+ Boolean flash_line; /* show visualBell as current line */
/*
* Select/paste state.
*/
@@ -1970,6 +1981,9 @@ typedef struct {
int firstValidRow; /* Valid rows for selection clipping */
int lastValidRow; /* " " */
+ Boolean selectToBuffer; /* copy selection to buffer */
+ char * internal_select;
+
String default_string;
String eightbit_select_types;
Atom* selection_targets_8bit;
@@ -1978,7 +1992,7 @@ typedef struct {
Atom* selection_targets_utf8;
#endif
Atom* selection_atoms; /* which selections we own */
- Cardinal sel_atoms_size; /* how many atoms allocated */
+ Cardinal sel_atoms_size; /* how many atoms allocated */
Cardinal selection_count; /* how many atoms in use */
#if OPT_SELECT_REGEX
char * selectExpr[NSELECTUNITS];
@@ -1986,9 +2000,11 @@ typedef struct {
/*
* Input/output state.
*/
- Boolean input_eight_bits;/* use 8th bit instead of ESC prefix */
- Boolean output_eight_bits; /* honor all bits or strip */
- Boolean control_eight_bits; /* send CSI as 8-bits */
+ Boolean input_eight_bits; /* do not send ESC when meta pressed */
+ int eight_bit_meta; /* use 8th bit when meta pressed */
+ char * eight_bit_meta_s; /* ...resource eightBitMeta */
+ Boolean output_eight_bits; /* honor all bits or strip */
+ Boolean control_eight_bits; /* send CSI as 8-bits */
Boolean backarrow_key; /* backspace/delete */
Boolean alt_is_not_meta; /* use both Alt- and Meta-key */
Boolean alt_sends_esc; /* Alt-key sends ESC prefix */
@@ -2028,12 +2044,6 @@ typedef struct {
#endif
XftDraw * renderDraw;
#endif
-#if OPT_INPUT_METHOD
- XIM xim;
- XFontSet fs; /* fontset for XIM preedit */
- int fs_ascent; /* ascent of fs */
-#endif
- XIC xic; /* this is used even without XIM */
#if OPT_DABBREV
Boolean dabbrev_working; /* nonzero during dabbrev process */
unsigned char dabbrev_erase_char; /* used for deleting inserted completion */
@@ -2132,6 +2142,14 @@ typedef enum { /* legal values for screen.utf8_mode */
, uLast
} utf8ModeTypes;
+typedef enum { /* legal values for screen.eight_bit_meta */
+ ebFalse = 0
+ , ebTrue = 1
+ , ebNever = 2
+ , ebLocale = 3
+ , ebLast
+} ebMetaModeTypes;
+
#if OPT_HP_FUNC_KEYS
#define NAME_HP_KT " hp"
#else
@@ -2253,6 +2271,9 @@ typedef struct _Misc {
Boolean open_im; /* true if input-method is opened */
Boolean cannot_im; /* true if we cannot use input-method */
int retry_im;
+ XFontSet xim_fs; /* fontset for XIM preedit */
+ int xim_fs_ascent; /* ascent of fs */
+ TInput inputs[NINPUTWIDGETS];
#endif
Boolean dynamicColors;
Boolean shared_ic;
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index 7c657c1b7..d8bb8a4ff 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.439 2011/04/20 09:10:21 tom Exp $ */
+/* $XTermId: screen.c,v 1.440 2011/12/27 10:10:53 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -1426,7 +1426,7 @@ ScrnRefresh(XtermWidget xw,
col = leftcol;
}
} else {
- fprintf(stderr, "This should not happen. Why is it so?\n");
+ xtermWarning("This should not happen. Why is it so?\n");
}
});
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index c43b5f81c..f6ebfa221 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,4 +1,4 @@
-/* $XTermId: trace.c,v 1.132 2011/10/07 09:40:46 tom Exp $ */
+/* $XTermId: trace.c,v 1.133 2011/12/27 10:10:53 tom Exp $ */
/*
* Copyright 1997-2010,2011 by Thomas E. Dickey
@@ -107,7 +107,7 @@ Trace(const char *fmt,...)
TraceIds(NULL, 0);
}
if (!trace_fp) {
- fprintf(stderr, "Cannot open \"%s\"\n", name);
+ xtermWarning("Cannot open \"%s\"\n", name);
exit(EXIT_FAILURE);
}
}
diff --git a/app/xterm/util.c b/app/xterm/util.c
index ec10f0c0a..3b4f2bc6c 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.548 2011/10/09 22:10:45 tom Exp $ */
+/* $XTermId: util.c,v 1.554 2011/12/30 21:56:42 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -113,13 +113,13 @@ DamagedCells(TScreen * screen, unsigned n, int *klp, int *krp, int row, int col)
int kl = col;
int kr = col + nn;
- if (kr >= ld->lineSize) {
+ if (kr >= (int) ld->lineSize) {
nn = (ld->lineSize - col - 1);
kr = col + nn;
}
if (nn > 0) {
- assert(kl < ld->lineSize);
+ assert(kl < (int) ld->lineSize);
if (ld->charData[kl] == HIDDEN_CHAR) {
while (kl > 0) {
if (ld->charData[--kl] != HIDDEN_CHAR) {
@@ -581,6 +581,70 @@ xtermScroll(XtermWidget xw, int amount)
}
/*
+ * This is from ISO 6429, not found in any of DEC's terminals.
+ */
+void
+xtermScrollLR(XtermWidget xw, int amount, Bool toLeft)
+{
+ if (amount > 0) {
+ xtermColScroll(xw, amount, toLeft, 0);
+ }
+}
+
+/*
+ * Implement DECBI/DECFI (back/forward column index)
+ */
+void
+xtermColIndex(XtermWidget xw, Bool toLeft)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ if (toLeft) {
+ if (screen->cur_col) {
+ CursorBack(xw, 1);
+ } else {
+ xtermColScroll(xw, 1, False, 0);
+ }
+ } else {
+ if (screen->cur_col < screen->max_col) {
+ CursorForward(screen, 1);
+ } else {
+ xtermColScroll(xw, 1, True, 0);
+ }
+ }
+}
+
+/*
+ * Implement DECDC/DECIC (delete/insert column)
+ */
+void
+xtermColScroll(XtermWidget xw, int amount, Bool toLeft, int at_col)
+{
+ if (amount > 0) {
+ TScreen *screen = TScreenOf(xw);
+ int save_row = screen->cur_row;
+ int save_col = screen->cur_col;
+ int row;
+
+ screen->cur_col = at_col;
+ if (toLeft) {
+ for (row = 0; row <= screen->max_row; row++) {
+ screen->cur_row = row;
+ ScrnDeleteChar(xw, (unsigned) amount);
+ }
+ } else {
+ for (row = 0; row <= screen->max_row; row++) {
+ screen->cur_row = row;
+ ScrnInsertChar(xw, (unsigned) amount);
+ }
+ }
+ screen->cur_row = save_row;
+ screen->cur_col = save_col;
+ xtermRepaint(xw);
+ }
+}
+
+/*
* Reverse scrolls the screen by amount lines, erases top, doesn't alter
* cursor position (i.e. cursor moves up amount relative to text).
* All done within the scrolling region, of course.
@@ -3795,8 +3859,8 @@ init_keyboard_type(XtermWidget xw, xtermKeyboardType type, Bool set)
visibleKeyboardType(xw->keyboard.type)));
if (set) {
if (wasSet) {
- fprintf(stderr, "Conflicting keyboard type option (%u/%u)\n",
- xw->keyboard.type, type);
+ xtermWarning("Conflicting keyboard type option (%u/%u)\n",
+ xw->keyboard.type, type);
}
xw->keyboard.type = type;
wasSet = True;
@@ -3866,9 +3930,8 @@ decode_keyboard_type(XtermWidget xw, XTERM_RESOURCE * rp)
init_keyboard_type(xw, table[n].type, FLAG(n));
}
if (!found) {
- fprintf(stderr,
- "KeyboardType resource \"%s\" not found\n",
- rp->keyboardType);
+ xtermWarning("KeyboardType resource \"%s\" not found\n",
+ rp->keyboardType);
}
}
#undef DATA
@@ -4010,7 +4073,7 @@ extendedBoolean(const char *value, FlagList * table, Cardinal limit)
}
if (result < 0) {
- fprintf(stderr, "Unrecognized keyword: %s\n", value);
+ xtermWarning("Unrecognized keyword: %s\n", value);
result = False;
}
diff --git a/app/xterm/version.h b/app/xterm/version.h
index e6214da23..d7b2a46b2 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.335 2011/09/28 20:56:08 tom Exp $ */
+/* $XTermId: version.h,v 1.337 2012/01/12 12:45:36 tom Exp $ */
/*
* Copyright 1998-2010,2011 by Thomas E. Dickey
@@ -36,7 +36,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 276
+#define XTERM_PATCH 278
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/vttests/16colors.sh b/app/xterm/vttests/16colors.sh
index f47337577..7d3e24676 100644
--- a/app/xterm/vttests/16colors.sh
+++ b/app/xterm/vttests/16colors.sh
@@ -1,14 +1,43 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/16colors.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: 16colors.sh,v 1.14 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Show a simple 16-color test pattern. It is a little more confusing than
# 8colors.sh, since everything is abbreviated to fit on an 80-column line.
# The high (8-15) combinations for foreground or background are marked with
# a '+' sign.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/8colors.sh b/app/xterm/vttests/8colors.sh
index 10865f730..0bb53c00d 100644
--- a/app/xterm/vttests/8colors.sh
+++ b/app/xterm/vttests/8colors.sh
@@ -1,11 +1,40 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/8colors.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: 8colors.sh,v 1.14 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Show a simple 8-color test pattern
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/acolors.sh b/app/xterm/vttests/acolors.sh
index ea19a38f4..ff3900c33 100644
--- a/app/xterm/vttests/acolors.sh
+++ b/app/xterm/vttests/acolors.sh
@@ -1,11 +1,40 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/acolors.sh,v 1.2 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: acolors.sh,v 1.7 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 2002-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Demonstrate the use of the control sequence for changing ANSI colors.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/doublechars.sh b/app/xterm/vttests/doublechars.sh
index dd032ae46..249da1606 100644
--- a/app/xterm/vttests/doublechars.sh
+++ b/app/xterm/vttests/doublechars.sh
@@ -1,7 +1,36 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/doublechars.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: doublechars.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/7/7)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Illustrate the use of double-size characters by drawing successive lines in
# the commonly used video attributes.
#
@@ -9,7 +38,7 @@
# the double-high lines will be split.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/dynamic.sh b/app/xterm/vttests/dynamic.sh
index e68ebbc6c..7f561c9bb 100644
--- a/app/xterm/vttests/dynamic.sh
+++ b/app/xterm/vttests/dynamic.sh
@@ -1,12 +1,41 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/dynamic.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: dynamic.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Demonstrate the use of dynamic colors by setting the background successively
# to different values.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/dynamic2.sh b/app/xterm/vttests/dynamic2.sh
index e099af0c8..36748a60d 100644
--- a/app/xterm/vttests/dynamic2.sh
+++ b/app/xterm/vttests/dynamic2.sh
@@ -1,12 +1,41 @@
#!/bin/sh
-# $XTermId: dynamic2.sh,v 1.1 2006/10/17 20:37:21 tom Exp $
+# $XTermId: dynamic2.sh,v 1.3 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (2006/10/17)
+# Copyright 2006,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Demonstrate the use of dynamic colors by setting each dynamic color
# successively to different values.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/fonts.sh b/app/xterm/vttests/fonts.sh
index 5dd9e29f0..c9e7657a7 100644
--- a/app/xterm/vttests/fonts.sh
+++ b/app/xterm/vttests/fonts.sh
@@ -1,12 +1,41 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/fonts.sh,v 1.4 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: fonts.sh,v 1.11 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Demonstrate the use of dynamic colors by setting the background successively
# to different values.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/resize.sh b/app/xterm/vttests/resize.sh
index 004574949..30ff28458 100644
--- a/app/xterm/vttests/resize.sh
+++ b/app/xterm/vttests/resize.sh
@@ -1,12 +1,41 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/resize.sh,v 1.5 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: resize.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Obtain the current screen size, then resize the terminal to the nominal
# screen width/height, and restore the size.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/vttests/title.sh b/app/xterm/vttests/title.sh
index af3807783..cc35ac022 100644
--- a/app/xterm/vttests/title.sh
+++ b/app/xterm/vttests/title.sh
@@ -1,12 +1,41 @@
#!/bin/sh
-# $XFree86: xc/programs/xterm/vttests/title.sh,v 1.6 2003/05/19 00:52:30 dickey Exp $
+# $XTermId: title.sh,v 1.18 2011/12/11 16:21:22 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
#
-# -- Thomas Dickey (1999/3/27)
+# Copyright 1999-2003,2011 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
# Obtain the current title of the window, set up a simple clock which runs
# until this script is interrupted, then restore the title.
ESC=""
-CMD='echo'
+CMD='/bin/echo'
OPT='-n'
SUF=''
TMP=/tmp/xterm$$
diff --git a/app/xterm/xcharmouse.h b/app/xterm/xcharmouse.h
index 63ef2bfa7..ed3d2b438 100644
--- a/app/xterm/xcharmouse.h
+++ b/app/xterm/xcharmouse.h
@@ -1,4 +1,4 @@
-/* $XTermId: xcharmouse.h,v 1.12 2010/08/19 09:30:03 Ryan.Johnson Exp $ */
+/* $XTermId: xcharmouse.h,v 1.15 2011/12/08 21:54:12 tom Exp $ */
/************************************************************
@@ -27,6 +27,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef included_xcharmouse_h
#define included_xcharmouse_h
+/* *INDENT-OFF* */
/*
* Macros for dpmodes
@@ -48,6 +49,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Extend mouse tracking for terminals wider(taller) than 223 cols(rows) */
#define SET_EXT_MODE_MOUSE 1005 /* compatible with above */
+#define SET_SGR_EXT_MODE_MOUSE 1006
+#define SET_URXVT_EXT_MODE_MOUSE 1015
#define SET_BUTTON1_MOVE_POINT 2001 /* click1 emit Esc seq to move point*/
#define SET_BUTTON2_MOVE_POINT 2002 /* press2 emit Esc seq to move point*/
@@ -78,4 +81,6 @@ typedef enum {
,DEC_LOCATOR
} XtermMouseModes;
+/* *INDENT-ON* */
+
#endif /* included_xcharmouse_h */
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index 1e896b1b8..d552da433 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.662 2011/10/09 21:58:44 tom Exp $ */
+/* $XTermId: xterm.h,v 1.673 2011/12/27 09:51:07 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -403,6 +403,7 @@ extern char **environ;
#define XtNdynamicColors "dynamicColors"
#define XtNeightBitControl "eightBitControl"
#define XtNeightBitInput "eightBitInput"
+#define XtNeightBitMeta "eightBitMeta"
#define XtNeightBitOutput "eightBitOutput"
#define XtNeightBitSelectTypes "eightBitSelectTypes"
#define XtNfaceName "faceName"
@@ -512,6 +513,7 @@ extern char **environ;
#define XtNveryBoldColors "veryBoldColors"
#define XtNvisualBell "visualBell"
#define XtNvisualBellDelay "visualBellDelay"
+#define XtNvisualBellLine "visualBellLine"
#define XtNvt100Graphics "vt100Graphics"
#define XtNwideBoldFont "wideBoldFont"
#define XtNwideChars "wideChars"
@@ -576,6 +578,7 @@ extern char **environ;
#define XtCDynamicColors "DynamicColors"
#define XtCEightBitControl "EightBitControl"
#define XtCEightBitInput "EightBitInput"
+#define XtCEightBitMeta "EightBitMeta"
#define XtCEightBitOutput "EightBitOutput"
#define XtCEightBitSelectTypes "EightBitSelectTypes"
#define XtCFaceName "FaceName"
@@ -676,6 +679,7 @@ extern char **environ;
#define XtCVeryBoldColors "VeryBoldColors"
#define XtCVisualBell "VisualBell"
#define XtCVisualBellDelay "VisualBellDelay"
+#define XtCVisualBellLine "VisualBellLine"
#define XtCWideBoldFont "WideBoldFont"
#define XtCWideChars "WideChars"
#define XtCWideFont "WideFont"
@@ -828,6 +832,7 @@ extern void VTInitTranslations (void);
extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */) GCC_NORETURN;
extern void VTRun (XtermWidget /* xw */);
extern void dotext (XtermWidget /* xw */, int /* charset */, IChar * /* buf */, Cardinal /* len */);
+extern void lookupSelectUnit(XtermWidget /* xw */, Cardinal /* item */, String /* value */);
extern void releaseCursorGCs(XtermWidget /*xw*/);
extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/);
extern void resetCharsets (TScreen * /* screen */);
@@ -847,6 +852,10 @@ extern void xtermAddInput(Widget /* w */);
extern void ToggleCursorBlink(TScreen * /* screen */);
#endif
+#if OPT_INPUT_METHOD
+extern TInput *lookupTInput (XtermWidget /* xw */, Widget /* w */);
+#endif
+
#if OPT_ISO_COLORS
extern void SGR_Background (XtermWidget /* xw */, int /* color */);
extern void SGR_Foreground (XtermWidget /* xw */, int /* color */);
@@ -1014,9 +1023,11 @@ extern void xtermBell(XtermWidget /* xw */, int /* which */, int /* percent */);
extern void xtermCopyEnv (char ** /* oldenv */);
extern void xtermDisplayCursor (XtermWidget /* xw */);
extern void xtermEmbedWindow(Window /* winToEmbedInfo */);
+extern void xtermPerror (const char * /*fmt*/,...) GCC_PRINTFLIKE(1,2);
extern void xtermSetenv (const char * /* var */, const char * /* value */);
extern void xtermShowPointer (XtermWidget /* xw */, Bool /* enable */);
extern void xtermUnsetenv (const char * /* var */);
+extern void xtermWarning (const char * /*fmt*/,...) GCC_PRINTFLIKE(1,2);
#if OPT_DABBREV
extern void HandleDabbrevExpand PROTO_XT_ACTIONS_ARGS;
@@ -1044,6 +1055,13 @@ extern void xtermClearLEDs (TScreen * /* screen */);
#define GetScrollLock(screen) /* nothing */
#endif
+#if OPT_SELECTION_OPS
+extern void HandleExecFormatted PROTO_XT_ACTIONS_ARGS;
+extern void HandleExecSelectable PROTO_XT_ACTIONS_ARGS;
+extern void HandleInsertFormatted PROTO_XT_ACTIONS_ARGS;
+extern void HandleInsertSelectable PROTO_XT_ACTIONS_ARGS;
+#endif
+
#if OPT_SESSION_MGT
extern void xtermCloseSession (void);
extern void xtermOpenSession (void);
@@ -1132,10 +1150,12 @@ extern void FullScreen(XtermWidget /* xw */, Bool /* enabled */);
extern void ScrnAllocBuf (XtermWidget /* xw */);
extern void ScrnClearCells (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */);
extern void ScrnDeleteChar (XtermWidget /* xw */, unsigned /* n */);
+extern void ScrnDeleteCol (XtermWidget /* xw */, unsigned /* n */);
extern void ScrnDeleteLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* n */, int /* last */, unsigned /* where */);
extern void ScrnDisownSelection (XtermWidget /* xw */);
extern void ScrnFillRectangle (XtermWidget /* xw */, XTermRect *, int , unsigned /* flags */, Bool /* keepColors */);
extern void ScrnInsertChar (XtermWidget /* xw */, unsigned /* n */);
+extern void ScrnInsertCol (XtermWidget /* xw */, unsigned /* n */);
extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last */, int /* where */, unsigned /* n */);
extern void ScrnRefresh (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */);
extern void ScrnUpdate (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */);
@@ -1259,8 +1279,11 @@ extern void set_keyboard_type (XtermWidget /* xw */, xtermKeyboardType /* type
extern void toggle_keyboard_type (XtermWidget /* xw */, xtermKeyboardType /* type */);
extern void update_keyboard_type (void);
extern void xtermClear (XtermWidget /* xw */);
+extern void xtermColIndex (XtermWidget /* xw */, Bool /* toLeft */);
+extern void xtermColScroll (XtermWidget /* xw */, int /* amount */, Bool /* toLeft */, int /* at_col */);
extern void xtermRepaint (XtermWidget /* xw */);
extern void xtermScroll (XtermWidget /* xw */, int /* amount */);
+extern void xtermScrollLR (XtermWidget /* xw */, int /* amount */, Bool /* toLeft */);
extern void xtermSizeHints (XtermWidget /* xw */, int /* scrollbarWidth */);
#if OPT_ISO_COLORS
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index bfd361418..1510c4c3d 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -31,7 +31,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.1107 2011/10/11 00:55:31 tom Exp $
+ $XTermId: xterm.log.html,v 1.1133 2012/01/19 01:54:00 tom Exp $
-->
<HTML>
<HEAD>
@@ -58,6 +58,8 @@ Most of these are summarized in the XFree86 CHANGELOG
is the latest version of this file.
<UL>
+<LI><A HREF="#xterm_278">Patch #278 - 2012/01/18</A>
+<LI><A HREF="#xterm_277">Patch #277 - 2012/01/07</A>
<LI><A HREF="#xterm_276">Patch #276 - 2011/10/10</A>
<LI><A HREF="#xterm_275">Patch #275 - 2011/09/11</A>
<LI><A HREF="#xterm_274">Patch #274 - 2011/09/05</A>
@@ -337,6 +339,125 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
+<H1><A NAME="xterm_278">Patch #278 - 2012/01/18</A></H1>
+<ul>
+ <li>correct initialization for <code>eightBitMeta</code> resource
+ (FreeBSD #164101).
+
+ <li>make special check for Darwin 9 (and lower) to <em>not</em>
+ use <code>posix_openpt</code> (report by Christian Ebert).
+
+ <li>minor fixes (adding ".ne" directives) to reduce the cases where
+ groff's utility for generating images for tables dumps core.
+ Most versions of groff (I've found 1.19.2 to be the most stable)
+ dump core when attempting to report that there are too few lines
+ on a page for a table to be shown.
+</ul>
+
+<H1><A NAME="xterm_277">Patch #277 - 2012/01/07</A></H1>
+<ul>
+ <li>remove special case for ISC pseudo-terminals which attempts to
+ open the pty in two different ways.
+
+ <li>move call to <code>grantpt</code> before asking utempter to
+ add a record, to work with kFreeBSD which does not update the
+ terminal's ownership until this point (Debian #652907).
+
+ <li>document limitation of XIM interface in manpage (Debian #230787).
+
+ <li>cleanup error reporting with new xtermWarning function.
+
+ <li>add configure option <code>--disable-selection-ops</code> to
+ make the new actions optional.
+
+ <li>add four new actions for making the selection or data directly
+ copied from the screen (prompted by discussion in Debian #637001,
+ as well as report by Arjen van Tol):
+ <ul>
+ <li>exec-formatted
+ <li>exec-selectable
+ <li>insert-formatted
+ <li>insert-selectable
+ </ul>
+
+ <li>add <code>visualBellLine</code> resource to allow
+ <code>visualBell</code> to flash only the current line (prompted by
+ patch by Gertjan Halkes).
+
+ <li>add <code>eightBitMeta</code> resource to control the features
+ which modify or interpret the eighth bit of a key when the
+ meta modifier key is pressed (prompted by Debian #326200).
+
+ <li>improve discussion of <code>eightBitInput</code> in the manpage
+ (prompted by Debian #326200).
+
+ <li>correct logic for <code>alt-sends-escape</code> action,
+ overlooked when implementing <code>altSendsEscape</code> resource,
+ which still used <code>eightBitInput</code> resource value.
+
+ <li>add a workaround for <code>XAllocColor()</code>, which does not
+ actually allocate "a read-only colormap entry corresponding to the
+ closest RGB value supported by the hardware", but rather a rough
+ approximation (Debian #650291).
+
+ <li>undo parameter checks for <code>RequestResize()</code> added in
+ <a href="#xterm_251">patch #251</a> and amended in
+ <a href="#xterm_270">patch #270</a>, because zeros also are
+ special cases (report by John S Urban).
+
+ <li>modify some test-scripts to use <code>/bin/echo</code> rather than
+ the shell's possibly-builtin <code>echo</code>, to work around
+ broken configuration on Mac OS X, i.e., neither honoring the option
+ nor flagging an error.
+
+ <li>add SGR 1006, as a better technical solution than SGR 1015:
+ <ul>
+ <li>the responses will not be confused with line-deletion and
+ scrolling controls.
+ <li>the button encoding is a little simpler, since it does not
+ add an unnecessary 32 because the integer parameter does not
+ have to be represented as a printable character.
+ <li>the control responses for pressing and releasing a mouse
+ button differ, allowing an application to tell which button was
+ released.
+ </ul>
+ <p>
+ Besides these improvements,
+ in discussion, it was noted that urxvt's implementation of 1005 is
+ incorrect, relying upon a locale that provides UTF-8 encoding. In
+ contrast, vttest demonstrates a correct decoding, independent of
+ locale.
+
+ <li>add support for urxvt SGR 1015 to address shortcoming of
+ SGR 1005 with luit (patch by Egmont Koblinger).
+
+ <li>add ISO and DEC controls useful for left/right scrolling.
+
+ <li>add some changes for OpenBSD and MirBSD (adapted from patch by
+ Thorsten Glaser):
+ <ul>
+ <li>disable search for non-Unix96 ptys.
+ <li>fix a gcc warning in <code>timestamp_filename</code>
+ <li>modify <code>Imakefile</code> to install xterm setgid to utmp.
+ </ul>
+
+ <li>add/use/prefer <code>posix_openpt()</code> for opening
+ pseudo-terminal.
+
+ <li>modify special errno handling case in ptydata.c from
+ <a href="#xterm_158">patch #158</a>
+ to allow for the possibility that any platform may have
+ special cases where "/dev/tty" is absent.
+ For example, this can happen in a FreeBSD jail
+ (patch by David Wolfskill).
+
+ <li>add keyboard logic to map shift-tab into XK_ISO_Left_Tab, which is
+ usually, not always, done by the X keyboard configuration.
+
+ <li>portability fixes for some configure macros:
+ <code>CF_XOPEN_SOURCE</code>
+</ul>
+
<H1><A NAME="xterm_276">Patch #276 - 2011/10/10</A></H1>
<ul>
<li>modify clipping limits for TrueType fonts to account for the
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 024f05b54..9b2dab6cf 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.511 2011/10/03 22:23:26 tom Exp $
+.\" $XTermId: xterm.man,v 1.522 2012/01/08 18:21:15 tom Exp $
.\"
.\" Copyright 1996-2010,2011 by Thomas E. Dickey
.\"
@@ -125,15 +125,15 @@ entries that work with
.I xterm
include
an optional platform-specific entry (\*(``__default_termname__\*(''),
-\*(``xterm,\*(''
-\*(``vt102,\*(''
-\*(``vt100,\*(''
+\*(``xterm\*('',
+\*(``vt102\*('',
+\*(``vt100\*('',
\*(``ansi\*('' and
-\*(``dumb.\*(''
+\*(``dumb\*(''.
.I xterm
automatically searches the termcap file in this order for these entries and then
sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
-You may also use \*(``vt220,\*('' but must set the terminal emulation level
+You may also use \*(``vt220\*('', but must set the terminal emulation level
with the \fBdecTerminalID\fP resource.
(The \*(``TERMCAP\*('' environment variable is not set if \fIxterm\fP is linked
against a terminfo library, since the requisite information is not provided
@@ -937,12 +937,12 @@ Switching between the two windows is done using the
.IR Termcap (5)
entries that work with
.I xterm
-\*(``tek4014,\*(''
-\*(``tek4015,\*(''
-\*(``tek4012,\*(''
-\*(``tek4013,\*(''
-\*(``tek4010,\*('' and
-\*(``dumb.\*(''
+\*(``tek4014\*('',
+\*(``tek4015\*('',
+\*(``tek4012\*('',
+\*(``tek4013\*('',
+\*(``tek4010\*('', and
+\*(``dumb\*(''.
.I xterm
automatically searches the termcap file in this order for these entries and then
sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables.
@@ -1162,7 +1162,7 @@ The corresponding resource name is \fIborderColor\fP.
.B \-bg \fIcolor\fP
This option specifies the color to use for the background of the window.
The corresponding resource name is \fIbackground\fP.
-The default is \*(``XtDefaultBackground.\*(''
+The default is \*(``XtDefaultBackground\*(''.
.TP 8
.B \-bw \fInumber\fP
This option specifies the width in pixels of the border surrounding the window.
@@ -1182,7 +1182,7 @@ This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP.
This option specifies the color to use for displaying text.
The corresponding resource name is \fIforeground\fP.
The default is
-\*(``XtDefaultForeground.\*(''
+\*(``XtDefaultForeground\*(''.
.TP 8
.B \-fn \fIfont\fP
This option specifies the font to be used for displaying normal text.
@@ -1263,7 +1263,7 @@ and cannot be enabled later via menu-selection or control sequence.
.RE
.IP
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "hold (\fPclass\fB Hold)"
If true,
@@ -1305,7 +1305,7 @@ The individual resources are provided for legacy support;
this resource is simpler to use.
.IP
The default is
-\*(``unknown.\*('', i.e., none of the associated resources are set
+\*(``unknown\*('', i.e., none of the associated resources are set
via this resource.
.TP 8
.B "maxBufSize (\fPclass\fB MaxBufSize)"
@@ -1323,7 +1323,7 @@ if the operating system prefers larger buffer sizes.
Specifies whether or not \fIxterm\fP should ask the window manager to
maximize its layout on startup.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "messages (\fPclass\fB Messages)"
Specifies whether write access to the terminal is allowed initially.
@@ -1413,6 +1413,17 @@ The default is \*(``true\*(''.
Scale line-height values by the resource value,
which is limited to \*(``0.9\*('' to \*(``1.5\*(''.
The default value is \*(``1.0\*('',
+.IP
+While this resource applies to either bitmap or TrueType fonts,
+its main purpose is to
+help work around incompatible changes in the Xft library's font metrics.
+\fIXterm\fP checks the font metrics to find what the library claims are
+the bounding boxes for each glyph (character).
+However, some of Xft's features (such as the autohinter) can cause the
+glyphs to be scaled larger than the bounding boxes, and be partly overwritten
+by the next row.
+.IP
+See \fBuseClipping\fP for a related resource.
.TP 8
.B "scoFunctionKeys (\fPclass\fB ScoFunctionKeys)"
Specifies whether or not SCO Function Key escape codes should be generated for
@@ -1459,7 +1470,7 @@ Specifies whether or not function key escape codes read from the
termcap/terminfo entry should be generated for
function keys instead of standard escape sequences.
The default is
-\*(``false.\*('', i.e., this feature is disabled.
+\*(``false\*('', i.e., this feature is disabled.
.IP
See also the \fBkeyboardType\fP resource.
.TP 8
@@ -1473,7 +1484,7 @@ this application.
.B "toolBar (\fPclass\fB ToolBar)"
Specifies whether or not the toolbar should be displayed.
The default is
-\*(``true.\*(''
+\*(``true\*(''.
.TP 8
.B "ttyModes (\fPclass\fB TtyModes)"
Specifies a string containing terminal setting keywords and the characters
@@ -1518,20 +1529,20 @@ i.e., \fIxterm\fP initializes the terminal to match that value.
Force use of insert mode by adding appropriate entries to the TERMCAP
environment variable.
This is useful if the system termcap is broken.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "utmpDisplayId (\fPclass\fB UtmpDisplayId)"
Specifies whether or not \fIxterm\fP should try to record the display
identifier (display number and screen number) as well as the hostname in
the system \fIutmp\fP log file.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "utmpInhibit (\fPclass\fB UtmpInhibit)"
Specifies whether or not \fIxterm\fP should try to record the user's terminal
in
the system \fIutmp\fP log file.
If true, \fIxterm\fP will not try.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "waitForMap (\fPclass\fB WaitForMap)"
Specifies whether or not \fIxterm\fP should wait for the initial window map
@@ -1544,7 +1555,7 @@ it passes the terminal size from the display end of the pseudo-terminal
to the terminal I/O connection, e.g., according to the window manager.
Otherwise, it uses the size as given in resource values or command-line
option \fB\-geom\fP.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "zIconBeep (\fPclass\fB ZIconBeep)"
Same as \-ziconbeep command line argument.
@@ -1554,7 +1565,7 @@ and have \*(``***\*('' prepended to their icon titles.
Most window managers will detect this change immediately, showing you
which window has the output.
(A similar feature was in x10 \fIxterm\fR.)
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.\"
.SS VT100 Widget Resources
.PP
@@ -1578,10 +1589,10 @@ Not all window managers
necessarily support application icon windows.
Some window managers
will allow you to enter keystrokes into the active icon window.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "allowBoldFonts (\fPclass\fB AllowBoldFonts)"
-When set to \*(``false.\*('', \fIxterm\fP will not use bold fonts.
+When set to \*(``false\*('', \fIxterm\fP will not use bold fonts.
This overrides both the \fBalwaysBoldMode\fP and the \fBboldMode\fP resources.
.B "alwaysBoldMode (\fPclass\fB AlwaysBoldMode)"
.TP 8
@@ -1591,22 +1602,22 @@ If true, overrides the mapping of C1 controls
as if they were printable characters.
Although this corresponds to no particular standard,
some users insist it is a VT100.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP
.B "allowColorOps (\fPclass\fB AllowColorOps)"
Specifies whether control sequences that set/query the dynamic colors should be allowed.
ANSI colors are unaffected by this resource setting.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP
.B "allowFontOps (\fPclass\fB AllowFontOps)"
Specifies whether control sequences that set/query the font should be allowed.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "allowScrollLock (\fPclass\fB AllowScrollLock)"
Specifies whether control sequences that set/query
the Scroll Lock key should be allowed,
as well as whether the Scroll Lock key responds to user's keypress.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
When this feature is enabled, \fIxterm\fP will sense the state of the
Scroll Lock key each time it acquires focus.
@@ -1617,7 +1628,7 @@ same set of lines.
If the current viewport is scrolled past the limit set by the
\fBsaveLines\fP resource, then Scroll Lock has no further effect.
.IP
-The reason for setting the default to \*(``false.\*('' is to avoid
+The reason for setting the default to \*(``false\*('' is to avoid
user surprise.
This key is generally unused in keyboard configurations,
and has not acquired a standard meaning even when it is used in that manner.
@@ -1629,13 +1640,13 @@ the X protocol SendEvent request) should be interpreted or discarded.
The default is \*(``false\*('' meaning they are discarded.
Note that allowing such events would create a very large security hole, therefore
enabling this resource forcefully disables the \fBallow\fP\fIXXX\fP\fBOps\fR resources.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP
.B "allowTcapOps (\fPclass\fB AllowTcapOps)"
Specifies whether control sequences that query the terminal's
notion of its function-key strings, as termcap or terminfo capabilities
should be allowed.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
A few programs, e.g., \fIvim\fP, use this feature to get an accurate
description of the terminal's capabilities,
@@ -1658,7 +1669,7 @@ Reporting control- and alt-modifiers is a feature that relies on the
.B "allowTitleOps (\fPclass\fB AllowTitleOps)"
Specifies whether control sequences that modify the window title or icon name
should be allowed.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP
.B "allowWindowOps (\fPclass\fB AllowWindowOps)"
Specifies whether extended window control sequences
@@ -1670,7 +1681,7 @@ Each of these can be abused in a script;
curiously enough most terminal emulators that implement these
restrict only a small part of the repertoire.
For fine-tuning, see \fBdisallowedWindowOps\fP.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)"
If \*(``true\*('', treat the Alt-key as if it were the Meta-key.
@@ -1678,24 +1689,29 @@ Your keyboard may happen to be configured so they are the same.
But if they are not, this allows you to use the same prefix- and shifting
operations with the Alt-key as with the Meta-key.
See \fBaltSendsEscape\fP and \fBmetaSendsEscape\fP.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "altSendsEscape (\fPclass\fB AltSendsEscape\fP)"
This is an additional keyboard operation that may be processed
after the logic for \fBmetaSendsEscape\fP.
It is only available if the \fBaltIsNotMeta\fP resource is set.
-.IP
+.RS
+.bP
If \*(``true\*('', Alt characters
(a character combined with the modifier associated with left/right Alt-keys)
are converted into a two-character
sequence with the character itself preceded by ESC.
This applies as well to function key control sequences, unless \fIxterm\fP
sees that \fBAlt\fP is used in your key translations.
+.bP
If \*(``false\*('', Alt characters input from the keyboard cause a shift to
8-bit characters (just like \fBmetaSendsEscape\fP).
By combining the Alt- and Meta-modifiers, you can create corresponding
combinations of ESC-prefix and 8-bit characters.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
+.RE
+.IP
+\fIXterm\fP provides a menu option for toggling this resource.
.TP 8
.B "alwaysBoldMode (\fPclass\fB AlwaysBoldMode)"
Specifies whether \fIxterm\fP should check if the normal and bold
@@ -1704,7 +1720,8 @@ simulate bold fonts.
If this resource is true,
\fIxterm\fP does not make the check for
distinct fonts when deciding how to handle the \fBboldMode\fP resource.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
+.ne 9
.TS
l l l l
_ _ _ _
@@ -1726,7 +1743,7 @@ text cursor.
By default (if this resource is false),
a hollow text cursor is displayed whenever the
pointer moves out of the window or the window loses the input focus.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "alwaysUseMods (\fPclass\fB AlwaysUseMods)"
Override the \fBnumLock\fP resource, telling \fIxterm\fR to use the Alt and Meta
@@ -1735,7 +1752,7 @@ those modifiers appear in the translations resource.
Normally \fIxterm\fP checks if Alt or Meta is used in a translation that
would conflict with function key modifiers, and will ignore these modifiers
in that special case.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "answerbackString (\fPclass\fB AnswerbackString)"
Specifies the string that \fIxterm\fR sends in response to an ENQ (control/E)
@@ -1744,46 +1761,46 @@ The default is a blank string, i.e., \*(``\*(''.
A hardware VT100 implements this feature as a setup option.
.TP 8
.B "appcursorDefault (\fPclass\fB AppcursorDefault)"
-If \*(``true,\*('' the cursor keys are initially in application mode.
+If \*(``true\*('', the cursor keys are initially in application mode.
This is the same as the VT102 private DECCKM mode,
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "appkeypadDefault (\fPclass\fB AppkeypadDefault)"
-If \*(``true,\*('' the keypad keys are initially in application mode.
-The default is \*(``false.\*(''
+If \*(``true\*('', the keypad keys are initially in application mode.
+The default is \*(``false\*(''.
.TP 8
.B "autoWrap (\fPclass\fB AutoWrap)"
Specifies whether or not auto-wraparound should be enabled.
This is the same as the VT102 DECAWM.
The
-default is \*(``true.\*(''
+default is \*(``true\*(''.
.TP 8
.B "awaitInput (\fPclass\fB AwaitInput)"
Specifies whether or not the \fIxterm\fR uses a 50 millisecond timeout to
await input (i.e., to support the Xaw3d arrow scrollbar).
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "backarrowKey (\fPclass\fB BackarrowKey)"
Specifies whether the backarrow key transmits
a backspace (8)
or delete (127) character.
This corresponds to the DECBKM control sequence.
-The default (backspace) is \*(``true.\*(''
+The default (backspace) is \*(``true\*(''.
Pressing the control key toggles this behavior.
.TP 8
.B "background (\fPclass\fB Background)"
Specifies the color to use for the background of the window.
The default is
-\*(``XtDefaultBackground.\*(''
+\*(``XtDefaultBackground\*(''.
.TP 8
.B "bellIsUrgent (\fPclass\fB BellIsUrgent)"
Specifies whether to set the Urgency hint for the window manager
when making a bell sound.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "bellOnReset (\fPclass\fB BellOnReset)"
Specifies whether to sound a bell when doing a hard reset.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "bellSuppressTime (\fPclass\fB BellSuppressTime)"
Number of milliseconds after a bell command is sent during which additional
@@ -1799,7 +1816,7 @@ the visible bell.
Specifies whether to combine bold attribute with colors like the IBM PC,
i.e., map colors 0 through 7 to colors 8 through 15.
These normally are the brighter versions of the first 8 colors, hence bold.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "boldFont (\fPclass\fB BoldFont)"
Specifies the name of the bold font to use instead of overstriking.
@@ -1824,7 +1841,7 @@ Note that \fIxterm\fP has one bold font which you may set explicitly.
If it cannot find a bold font, it will use the normal font.
In each case (whether the explicit resource or the derived font),
if the normal and bold fonts are distinct, this resource has no effect.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.IP
See the \fBalwaysBoldMode\fP resource which can modify the behavior
of this resource.
@@ -1860,7 +1877,7 @@ If true, \fIxterm\fP applies a workaround to ignore malformed control
sequences that a Linux script might send.
Compare the palette control sequences documented in \fIconsole_codes\fR
with ECMA-48.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "brokenSelections (\fPclass\fB BrokenSelections)"
If true, \fIxterm\fP in 8-bit mode will interpret
@@ -1872,13 +1889,13 @@ selections carry ISO-8859-1 encoded text.
Setting this resource to
\*(``true\*('' violates the ICCCM; it may, however, be useful for interacting
with some broken X clients.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "brokenStringTerm (\fPclass\fB BrokenStringTerm)"
provides a work-around for some ISDN routers which start an application
control string without completing it.
Set this to \*(``true\*('' if \fIxterm\fP appears to freeze when connecting.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
\fIXterm\fP's state parser recognizes
several types of control strings which can contain text, e.g.,
@@ -1933,7 +1950,7 @@ control/X (cancel)
.B "c132 (\fPclass\fB C132)"
Specifies whether or not the VT102 DECCOLM escape sequence,
used to switch between 80 and 132 columns, should be honored.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "cacheDoublesize (\fPclass\fB CacheDoublesize)"
Tells whether to cache double-sized fonts by \fIxterm\fR.
@@ -1956,7 +1973,7 @@ if you have some old East Asian terminal based programs that assume that
line-drawing characters have a column width of 2.
If this resource is false, the \fBmkWidth\fP resource controls the
choice between the system's \fBwcwidth\fP and \fIxterm\fP's built-in tables.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "color0 (\fPclass\fB Color0)"
.TP 8
@@ -2044,58 +2061,58 @@ Specifies whether \fBcolorBD\fP, \fBcolorBL\fP, \fBcolorRV\fP, and
\fBcolorUL\fP should override ANSI colors.
If not, these are displayed only when no ANSI colors
have been set for the corresponding position.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "colorBD (\fPclass\fB ColorBD)"
This specifies the color to use to display bold characters if
the \*(``colorBDMode\*('' resource is enabled.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
.TP 8
.B "colorBDMode (\fPclass\fB ColorAttrMode)"
Specifies whether characters with the bold attribute should be displayed in
color or as bold characters.
Note that setting \fBcolorMode\fR off disables
all colors, including bold.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "colorBL (\fPclass\fB ColorBL)"
This specifies the color to use to display blink characters if
the \*(``colorBLMode\*('' resource is enabled.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
.TP 8
.B "colorBLMode (\fPclass\fB ColorAttrMode)"
Specifies whether characters with the blink attribute should be displayed in
color.
Note that setting \fBcolorMode\fR off disables all colors, including this.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "colorMode (\fPclass\fB ColorMode)"
Specifies whether or not recognition of ANSI (ISO-6429)
color change escape sequences should be enabled.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "colorRV (\fPclass\fB ColorRV)"
This specifies the color to use to display reverse characters if
the \*(``colorRVMode\*('' resource is enabled.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
.TP 8
.B "colorRVMode (\fPclass\fB ColorAttrMode)"
Specifies whether characters with the reverse attribute should be displayed in
color.
Note that setting \fBcolorMode\fR off disables all colors, including this.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "colorUL (\fPclass\fB ColorUL)"
This specifies the color to use to display underlined characters if
the \*(``colorULMode\*('' resource is enabled.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
.TP 8
.B "colorULMode (\fPclass\fB ColorAttrMode)"
Specifies whether characters with the underline attribute should be displayed
in color or as underlined characters.
Note that setting \fBcolorMode\fR off
disables all colors, including underlining.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "combiningChars (\fPclass\fB CombiningChars)"
Specifies the number of wide-characters which can be stored in a cell
@@ -2115,15 +2132,15 @@ Specifies whether or not the last column bug in
.IR more (1)
should be worked around.
See the \fB\-cu\fP option for details.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "cursorBlink (\fPclass\fB CursorBlink)"
Specifies whether to make the cursor blink.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "cursorColor (\fPclass\fB CursorColor)"
Specifies the color to use for the text cursor.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
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.
@@ -2150,17 +2167,17 @@ The default is \*(``600\*(''.
If \*(``false\*('', triple clicking to select a line does not include the Newline
at the end of the line.
If \*(``true\*('', the Newline is selected.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "cursorUnderLine (\fPclass\fB CursorUnderLine)"
Specifies whether to make the cursor underlined or a box.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "cutToBeginningOfLine (\fPclass\fB CutToBeginningOfLine)"
If \*(``false\*('', triple clicking to select a line selects only from the
current word forward.
If \*(``true\*('', the entire line is selected.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "decTerminalID (\fPclass\fB DecTerminalID)"
Specifies the emulation level (100=VT100, 220=VT220, etc.), used to determine
@@ -2185,7 +2202,7 @@ the same layout on the screen as the original text.
.B "deleteIsDEL (\fPclass\fB DeleteIsDEL)"
Specifies whether the Delete key on the editing keypad should send DEL (127)
or the VT220-style Remove escape sequence.
-The default is \*(``false,\*('' for the latter.
+The default is \*(``false\*('', for the latter.
.TP 8
.B "disallowedColorOps (\fPclass\fB DisallowedColorOps)"
Specify which features will be disabled if \fBallowColorOps\fP is false.
@@ -2344,20 +2361,19 @@ different attributes are recognized.
.B "eightBitControl (\fPclass\fB EightBitControl\fP)"
Specifies whether or not control sequences sent by the
terminal should be eight-bit characters or escape sequences.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "eightBitInput (\fPclass\fB EightBitInput\fP)"
If \*(``true\*('', Meta characters
(a single-byte character combined with the \fIMeta\fP modifier key)
input from the keyboard are presented as a
-single character with the eighth bit turned on.
-The terminal is put into 8-bit mode.
+single character, modified according to the \fBeightBitMeta\fP resource.
If \*(``false\*('', Meta characters are converted into a two-character
sequence with the character itself preceded by ESC.
-On startup, \fIxterm\fP tries to put the terminal into 7-bit mode.
-The \fBmetaSendsEscape\fP and \fBaltSendsEscape\fP resources may override this.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.IP
+The \fBmetaSendsEscape\fP
+and \fBaltSendsEscape\fP resources may override this feature.
Generally keyboards do not have a key labeled \*(``Meta\*('',
but \*(``Alt\*('' keys are common,
and they are conventionally used for \*(``Meta\*(''.
@@ -2384,11 +2400,68 @@ before Meta-keys.
NumLock is tested first.
It is important to keep these keys distinct;
otherwise some of \fIxterm\fP's functionality is not available.
+.IP
+The \fBeightBitInput\fP resource is tested at startup time.
+If \*(``true\*('',
+the \fIxterm\fP tries to put the terminal into 8-bit mode.
+If \*(``false\*('',
+on startup, \fIxterm\fP tries to put the terminal into 7-bit mode.
+For some configurations this is unsuccessful; failure is ignored.
+After startup, \fIxterm\fP does not
+change the terminal between 8-bit and 7-bit mode.
+.IP
+As originally implemented in X11,
+the resource value did not change after startup.
+However
+(since patch #216 in 2006)
+\fIxterm\fP can modify \fBeightBitInput\fP after startup
+via a control sequence.
+The corresponding terminfo capabilities \fBsmm\fP (set meta mode)
+and \fBrmm\fP (reset meta mode)
+have been recognized by \fIbash\fP for some time.
+Interestingly enough, \fIbash\fP's notion of "meta mode"
+differs from the standard definition (in the \fIterminfo\fP manual),
+which describes the change to the eighth bit of a character.
+It happens that \fIbash\fP views "meta mode"
+as the ESC character that \fIxterm\fP puts before a character when a
+special meta key is pressed.
+\fIbash\fP's early documentation talks about the ESC character
+and ignores the eighth bit.
+.TP 8
+.B "eightBitMeta (\fPclass\fB EightBitMeta\fP)"
+This controls the way \fIxterm\fP modifies the eighth bit of a single-byte
+key when the \fBeightBitInput\fP resource is set.
+The default is \*(``locale\*(''.
+.IP
+The resource value is a string, evaluated as a boolean after startup.
+.RS
+.TP 5
+false
+The key is sent unmodified.
+.TP 5
+locale
+The key is modified only if the locale uses eight-bit encoding.
+.TP 5
+true
+The key is sent modified.
+.TP 5
+never
+The key is always sent unmodified.
+.RE
+.IP
+Except for the \fBnever\fP choice, \fIxterm\fP honors the
+terminfo capabilities \fBsmm\fP (set meta mode)
+and \fBrmm\fP (reset meta mode),
+allowing the feature to be turned on or off dynamically.
+.IP
+If \fBeightBitMeta\fP is enabled when the locale uses UTF-8,
+\fIxterm\fP encodes the value as UTF-8
+(since patch #183 in 2003).
.TP 8
.B "eightBitOutput (\fPclass\fB EightBitOutput\fP)"
Specifies whether or not eight-bit characters sent from the host should be
accepted as is or stripped when printed.
-The default is \*(``true,\*(''
+The default is \*(``true\*('',
which means that they are accepted as is.
.TP 8
.B "eightBitSelectTypes (\fPclass\fB EightBitSelectTypes\fP)"
@@ -2481,7 +2554,7 @@ Specifies the pointsize of the sixth alternative font.
.TP 8
.B "font (\fPclass\fB Font)"
Specifies the name of the normal font.
-The default is \*(``fixed.\*(''
+The default is \*(``fixed\*(''.
.IP
See the discussion of the \fBlocale\fP resource,
which describes how this font may be overridden.
@@ -2569,13 +2642,13 @@ If \*(``false\*('', \fIxterm\fP checks for missing glyphs in the font
and makes line-drawing characters directly as needed.
If \*(``true\*('', \fIxterm\fP assumes the font does not contain the
line-drawing characters, and draws them directly.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "forcePackedFont (\fPclass\fB ForcePackedFont)"
Specifies whether \fIxterm\fP should use the maximum or minimum glyph
width when displaying using a bitmap font.
Use the maximum width to help with proportional fonts.
-The default is \*(``true,\*('' denoting the minimum width.
+The default is \*(``true\*('', denoting the minimum width.
.TP 8
.B "foreground (\fPclass\fB Foreground)"
Specifies the color to use for displaying text in the window.
@@ -2583,7 +2656,7 @@ Setting the
class name instead of the instance name is an easy way to have everything
that would normally appear in the text color change color.
The default
-is \*(``XtDefaultForeground.\*(''
+is \*(``XtDefaultForeground\*(''.
.TP 8
.B "formatOtherKeys (\fPclass\fB FormatOtherKeys)"
Overrides the format of the escape sequence used to report modified keys
@@ -2611,7 +2684,7 @@ There is no default for this resource.
.B "highlightColor (\fPclass\fB HighlightColor)"
Specifies the color to use for the background of selected (highlighted) text.
If not specified (i.e., matching the default foreground), reverse video is used.
-The default is \*(``XtDefaultForeground.\*(''
+The default is \*(``XtDefaultForeground\*(''.
.TP 8
.B "highlightColorMode (\fPclass\fB HighlightColorMode)"
Specifies whether \fIxterm\fP should use
@@ -2639,6 +2712,7 @@ HFG
highlightTextColor
.RE
.IP
+.ne 34
.TS
l l l l l
_ _ _ _ _
@@ -2684,14 +2758,14 @@ the \fBhighlightColor\fP and \fBhighlightTextColor\fP resources,
e.g., to match the color scheme of \fIxwsh\fP.
If \*(``true\*('', \fIxterm\fP reverses the colors,
If \*(``false\*('', \fIxterm\fP does not reverse colors,
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "highlightSelection (\fPclass\fB HighlightSelection)"
If \*(``false\*('', selecting with the mouse highlights all positions on the screen
between the beginning of the selection and the current position.
If \*(``true\*('', \fIxterm\fP highlights only the positions that contain text that
can be selected.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
Depending on the way your applications write to the screen, there may
be trailing blanks on a line.
@@ -2705,7 +2779,7 @@ use the \fBtrimSelection\fP resource.
.B "highlightTextColor (\fPclass\fB HighlightTextColor)"
Specifies the color to use for the foreground of selected (highlighted) text.
If not specified (i.e., matching the default background), reverse video is used.
-The default is \*(``XtDefaultBackground.\*(''
+The default is \*(``XtDefaultBackground\*(''.
.TP 8
.B "hpLowerleftBugCompat (\fPclass\fB HpLowerleftBugCompat)"
Specifies whether to work around a bug in HP's \fIxdb\fP,
@@ -2713,14 +2787,14 @@ which ignores termcap and always sends
ESC F to move to the lower left corner.
\*(``true\*('' causes \fIxterm\fP to interpret ESC F as a request to move to the
lower left corner of the screen.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "i18nSelections (\fPclass\fB I18nSelections)"
If false, \fIxterm\fP will not request the targets
.B COMPOUND_TEXT
or
.BR TEXT .
-The default is \*(``true.\*('' It may be set to false in order to work around
+The default is \*(``true\*(''. It may be set to false in order to work around
ICCCM violations by other X clients.
.TP 8
.B "iconBorderColor (\fPclass\fB BorderColor)"
@@ -2761,7 +2835,7 @@ It is implemented only for TrueType fonts.
.B "jumpScroll (\fPclass\fB JumpScroll)"
Specifies whether or not jump scroll should be used.
This corresponds to the VT102 DECSCLM private mode.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
See \fBfastScroll\fP for a variation.
.TP 8
.B "keepSelection (\fPclass\fB KeepSelection)"
@@ -2857,12 +2931,12 @@ and set this resource to point to the shell script.
.B "loginShell (\fPclass\fB LoginShell)"
Specifies whether or not the shell to be run in the window should be started
as a login shell.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "marginBell (\fPclass\fB MarginBell)"
Specifies whether or not the bell should be rung when the user types near the
right margin.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "metaSendsEscape (\fPclass\fB MetaSendsEscape\fP)"
If \*(``true\*('', Meta characters
@@ -2873,7 +2947,7 @@ This applies as well to function key control sequences, unless \fIxterm\fP
sees that \fBMeta\fP is used in your key translations.
If \*(``false\*('', Meta characters input from the keyboard are handled according
to the \fBeightBitInput\fP resource.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "mkSamplePass (\fPclass\fB MkSamplePass)"
If \fBmkSampleSize\fP is nonzero,
@@ -2893,10 +2967,11 @@ The default (number of characters to check) is 1024.
Specifies whether \fIxterm\fP should use a built-in version of the wide
character width calculation.
See also the \fBcjkWidth\fP resource which can override this.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
Here is a summary of the resources which control the choice of
wide character width calculation:
+.ne 8
.TS
l l l
_ _ _
@@ -2995,7 +3070,7 @@ The default is \*(``250\*('' milliseconds.
.TP 8
.B "multiScroll (\fPclass\fB MultiScroll)"
Specifies whether or not scrolling should be done asynchronously.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "nMarginBell (\fPclass\fB Column)"
Specifies the number of characters from the right margin at which the margin
@@ -3008,14 +3083,14 @@ If so, this modifier is used to simplify the logic when implementing special
NumLock for the \fBsunKeyboard\fP resource.
Also (when \fBsunKeyboard\fP is false), similar logic is used to find the
modifier associated with the left and right Alt keys.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "oldXtermFKeys (\fPclass\fB OldXtermFKeys)"
If \*(``true\*('', \fIxterm\fR will use old-style control sequences for function keys F1 to F4,
for compatibility with X Consortium \fIxterm\fR.
Otherwise, it uses the VT100-style
codes for PF1 to PF4.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "on2Clicks (\fPclass\fB On2Clicks)"
.TP
@@ -3076,12 +3151,12 @@ The default is \*(``true\*(''.
.B "pointerColor (\fPclass\fB PointerColor)"
Specifies the foreground color of the pointer.
The default is
-\*(``XtDefaultForeground.\*(''
+\*(``XtDefaultForeground\*(''.
.TP 8
.B "pointerColorBackground (\fPclass\fB PointerColorBackground)"
Specifies the background color of the pointer.
The default is
-\*(``XtDefaultBackground.\*(''
+\*(``XtDefaultBackground\*(''.
.TP 8
.B "pointerMode (\fPclass\fB PointerMode)"
Specifies when the pointer may be hidden as the user types.
@@ -3102,11 +3177,11 @@ always.
.TP 8
.B "pointerShape (\fPclass\fB Cursor)"
Specifies the name of the shape of the pointer.
-The default is \*(``xterm.\*(''
+The default is \*(``xterm\*(''.
.TP 8
.B "popOnBell (\fPclass\fB PopOnBell)"
Specifies whether the window would be raised when Control-G is received.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.IP
If the window is iconified, this has no effect.
However, the \fBzIconBeep\fP resource provides you with the ability to
@@ -3218,7 +3293,7 @@ plus saved lines, with no special case for the alternated screen.
.B "printerAutoClose (\fPclass\fB PrinterAutoClose)"
If \*(``true\*('', \fIxterm\fR will close the printer (a pipe) when the application switches
the printer offline with a Media Copy command.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "printerCommand (\fPclass\fB PrinterCommand)"
Specifies a shell command to which
@@ -3242,28 +3317,28 @@ The default is \*(``0\*(''.
.B "printerExtent (\fPclass\fB PrinterExtent)"
Controls whether a print page function will print the entire page (true), or
only the the portion within the scrolling margins (false).
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "printerFormFeed (\fPclass\fB PrinterFormFeed)"
Controls whether a form feed is sent to the printer at the end of a print
page function.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "printerNewLine (\fPclass\fB PrinterNewLine)"
Controls whether a newline is sent to the printer at the end of a print
page function.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "quietGrab (\fPclass\fB QuietGrab)"
Controls whether the cursor is repainted
when \fINotifyGrab\fP and \fINotifyUngrab\fP
event types are received during change of focus.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "renderFont (\fPclass\fB RenderFont)"
If \fIxterm\fR is built with the Xft library,
this controls whether the \fBfaceName\fR resource is used.
-The default is \*(``default.\*(''
+The default is \*(``default\*(''.
.IP
The resource values are strings, evaluated as booleans after startup.
.RS
@@ -3324,7 +3399,7 @@ The default is ``3''.
.B "reverseVideo (\fPclass\fB ReverseVideo)"
Specifies whether or not reverse video should be simulated.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.IP
There are several aspects to reverse video in \fIxterm\fP:
.RS
@@ -3378,12 +3453,12 @@ a program can change the foreground and background colors.
Specifies whether or not reverse-wraparound should be enabled.
This corresponds to \fIxterm\fP's private mode 45.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "rightScrollBar (\fPclass\fB RightScrollBar)"
Specifies whether or not the scrollbar should be displayed on the right
rather than the left.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "saveLines (\fPclass\fB SaveLines)"
Specifies the number of lines to save beyond the top of the screen when a
@@ -3393,7 +3468,7 @@ The default is \*(``64\*(''.
.B "scrollBar (\fPclass\fB ScrollBar)"
Specifies whether or not the scrollbar should be displayed.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "scrollBarBorder (\fPclass\fB ScrollBarBorder)"
Specifies the width of the scrollbar border.
@@ -3407,7 +3482,7 @@ Specifies whether or not pressing a key should automatically cause the
scrollbar to go to the bottom of the scrolling region.
This corresponds to \fIxterm\fP's private mode 1011.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "scrollLines (\fPclass\fB ScrollLines)"
Specifies the number of lines that the \fIscroll-back\fP and
@@ -3417,7 +3492,7 @@ The default value is 1.
.B "scrollTtyOutput (\fPclass\fB ScrollCond)"
Specifies whether or not output to the terminal should automatically cause
the scrollbar to go to the bottom of the scrolling region.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP
.B "selectToClipboard (\fPclass\fB SelectToClipboard)"
Tells \fIxterm\fP whether to use the PRIMARY or CLIPBOARD for
@@ -3432,19 +3507,19 @@ Specifies whether to enable the actions
\fBlarger-vt-font()\fP and
\fBsmaller-vt-font()\fP, which are normally bound to
the shifted KP_Add and KP_Subtract.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "showBlinkAsBold (\fPclass\fB ShowBlinkAsBold)"
Tells \fIxterm\fP whether to display text with blink-attribute the same
as bold.
If \fIxterm\fP has not been configured to support blinking text,
-the default is \*(``true.\*('', which corresponds to older versions of \fIxterm\fP,
-otherwise the default is \*(``false.\*(''
+the default is \*(``true\*('', which corresponds to older versions of \fIxterm\fP,
+otherwise the default is \*(``false\*(''.
.TP 8
.B "showMissingGlyphs (\fPclass\fB ShowMissingGlyphs)"
Tells \fIxterm\fP whether to display a box outlining places where
a character has been used that the font does not represent.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "showWrapMarks (\fPclass\fB ShowWrapMarks)"
For debugging \fIxterm\fP and applications that may manipulate the
@@ -3455,7 +3530,7 @@ The mark shows which lines have the flag set.
.B "signalInhibit (\fPclass\fB SignalInhibit)"
Specifies whether or not the entries in the \*(``Main Options\*('' menu for sending
signals to \fIxterm\fP should be disallowed.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "tekGeometry (\fPclass\fB Geometry)"
Specifies the preferred size and position of the Tektronix window.
@@ -3466,18 +3541,18 @@ Specifies whether or not
the escape sequence to enter
Tektronix mode should be ignored.
The default is
-\*(``false.\*(''
+\*(``false\*(''.
.TP 8
.B "tekSmall (\fPclass\fB TekSmall)"
Specifies whether or not the Tektronix mode window should start in its smallest
size if no explicit geometry is given.
This is useful when running \fIxterm\fP
on displays with small screens.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "tekStartup (\fPclass\fB TekStartup)"
Specifies whether or not \fIxterm\fP should start up in Tektronix mode.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "tiXtraScroll (\fPclass\fB TiXtraScroll)"
Specifies whether \fIxterm\fP should scroll to a new page when processing
@@ -3486,7 +3561,7 @@ This is only in effect if \fBtiteInhibit\fP is \*(``true\*('',
because the intent of this option is to provide a picture of the full-screen
application's display on the scrollback without wiping out the text that
would be shown before the application was initialized.
-The default for this resource is \*(``false.\*(''
+The default for this resource is \*(``false\*(''.
.TP 8
.B "titeInhibit (\fPclass\fB TiteInhibit)"
Specifies whether or not \fIxterm\fP should remove \fIti\fP and \fIte\fP
@@ -3498,7 +3573,7 @@ alternate screen.
\fIXterm\fP supports terminfo in a different way, supporting composite control
sequences (also known as private modes) 1047, 1048 and 1049 which have the same
effect as the original 47 control sequence.
-The default for this resource is \*(``false.\*(''
+The default for this resource is \*(``false\*(''.
.TP 8
.B "titleModes (\fPclass\fB TitleModes)"
Tells \fIxterm\fP whether to accept or return
@@ -3527,7 +3602,7 @@ Query window/icon labels using UTF-8
.TP 8
.B "translations (\fPclass\fB Translations)"
Specifies the key and button bindings for menus, selections, \*(``programmed
-strings,\*('' etc.
+strings\*('', etc.
The \fBtranslations\fP resource,
which provides much of \fIxterm\fP's configurability,
is a feature of the X Toolkit Intrinsics library (Xt).
@@ -3544,27 +3619,27 @@ If this resource is true, \fIxterm\fP will trim trailing spaces from
text which is selected.
It does not affect spaces which result in a wrapped line, nor will it
trim the trailing newline from your selection.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "underLine (\fPclass\fB UnderLine)"
This specifies whether or not text with the underline attribute should be
underlined.
It may be desirable to disable underlining when color is being
used for the underline attribute.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "useClipping (\fPclass\fB UseClipping)"
Tell \fIxterm\fP whether to use clipping to keep
from producing dots outside the text drawing area.
Originally used to work around for overstriking effects,
this is also needed to work with some incorrectly-sized fonts.
-The default is \*(``true.\*(''
+The default is \*(``true\*(''.
.TP 8
.B "utf8 (\fPclass\fB Utf8)"
This specifies whether \fIxterm\fP will run in UTF-8 mode.
If you set this resource, \fIxterm\fP also sets the \fBwideChars\fP resource as a side-effect.
The resource can be set via the menu entry \*(``UTF-8 Encoding\*(''.
-The default is \*(``default.\*(''
+The default is \*(``default\*(''.
.IP
\fIXterm\fP accepts either a keyword (ignoring case)
or the number shown in parentheses:
@@ -3602,7 +3677,7 @@ This specifies whether \fIxterm\fP will use UTF-8 fonts specified via
resource patterns such as \*(``\fB*vt100.utf8Fonts.font\fP\*(''
or normal (ISO-8859-1) fonts via patterns such as \*(``\fB*vt100.font\fP\*(''.
The resource can be set via the menu entry \*(``UTF-8 Fonts\*(''.
-The default is \*(``default.\*(''
+The default is \*(``default\*(''.
.IP
\fIXterm\fP accepts either a keyword (ignoring case)
or the number shown in parentheses:
@@ -3632,7 +3707,7 @@ If true,
allow an ISO-8859-1 \fInormal\fP
font to be combined with an ISO-10646 font if the latter is given
via the \fB\-fw\fP option or its corresponding resource value.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "utf8SelectTypes (\fPclass\fB Utf8SelectTypes)"
Override \fIxterm\fP's default selection target list (see SELECT/PASTE) for
@@ -3664,7 +3739,7 @@ in the control sequences document), to set an equivalent flag.
The \fBtitleModes\fP resource sets the same value,
which overrides this resource.
.IP
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "veryBoldColors (\fPclass\fB VeryBoldColors)"
Specifies whether to combine video attributes with colors specified by
@@ -3684,7 +3759,7 @@ The default is \*(``0\*(''.
.B "visualBell (\fPclass\fB VisualBell)"
Specifies whether or not a visible bell (i.e., flashing) should be used instead
of an audible bell when Control-G is received.
-The default is \*(``false.\*(''
+The default is \*(``false\*('', which tells \fIxterm\fP to use an audible bell.
.TP 8
.B "visualBellDelay (\fPclass\fB VisualBellDelay)"
Number of milliseconds to delay when displaying a visual bell.
@@ -3692,6 +3767,12 @@ Default is 100.
If set to zero, no visual bell is displayed.
This is useful for very slow displays, e.g., an LCD display on a laptop.
.TP 8
+.B "visualBellLine (\fPclass\fB VisualBellLine)"
+Specifies whether to flash only the current line when displaying a visual bell.
+rather than flashing the entire screen:
+The default is \*(``false\*('',
+which tells \fIxterm\fP to flash the entire screen.
+.TP 8
.B "vt100Graphics (\fPclass\fB VT100Graphics)"
This specifies whether \fIxterm\fP will interpret VT100 graphic character
escape sequences while in UTF-8 mode.
@@ -3708,7 +3789,7 @@ the bold font.
.B "wideChars (\fPclass\fB WideChars)"
Specifies if \fIxterm\fP should respond to control sequences that
process 16-bit characters.
-The default is \*(``false.\*(''
+The default is \*(``false\*(''.
.TP 8
.B "wideFont (\fPclass\fB WideFont)"
This option specifies the font to be used for displaying wide text.
@@ -3753,9 +3834,9 @@ Specifies the small font to use in the Tektronix window.
.TP 8
.B "ginTerminator (\fPclass\fB GinTerminator)"
Specifies what character(s) should follow a GIN report or status report.
-The possibilities are \*(``none,\*('' which sends no terminating characters,
-\*(``CRonly,\*('' which sends CR, and \*(``CR&EOT,\*('' which sends both CR and EOT.
-The default is \*(``none.\*(''
+The possibilities are \*(``none\*('', which sends no terminating characters,
+\*(``CRonly\*('', which sends CR, and \*(``CR&EOT\*('', which sends both CR and EOT.
+The default is \*(``none\*(''.
.TP 8
.B "height (\fPclass\fB Height)"
Specifies the height of the Tektronix window in pixels.
@@ -3763,7 +3844,7 @@ Specifies the height of the Tektronix window in pixels.
.B "initialFont (\fPclass\fB InitialFont)"
Specifies which of the four Tektronix fonts to use initially.
Values are the same as for the \fIset-tek-text\fP action.
-The default is \*(``large.\*(''
+The default is \*(``large\*(''.
.TP 8
.B "width (\fPclass\fB Width)"
Specifies the width of the Tektronix window in pixels.
@@ -3922,7 +4003,7 @@ This entry toggles active icons on and off if this feature was
compiled into \fIxterm\fP.
It is enabled only if \fIxterm\fP
was started with the command line option +ai or the \fBactiveIcon\fP
-resource is set to \*(``true.\*(''
+resource is set to \*(``true\*(''.
.TP 8
.B "softreset (\fPclass\fB SmeBSB)"
This entry invokes the \fBsoft-reset()\fP action.
@@ -5080,7 +5161,7 @@ This action set or toggles the \fBallowWindowOps\fP resource and is also
invoked by the \fBallow-window-ops\fP entry in \fIfontMenu\fP.
.TP 8
.B "alt-sends-escape()"
-This action toggles the state of the \fBeightBitInput\fP resource.
+This action toggles the state of the \fBaltSendsEscape\fP resource.
.TP 8
.B "bell([\fIpercent\fP])"
This action rings the keyboard bell at the specified percentage
@@ -5162,18 +5243,97 @@ the key that was pressed.
.B "insert-eight-bit()"
This action inserts an eight-bit (Meta) version of the character or string
associated with the key that was pressed.
-This only applies to single-byte values.
+Only single-byte values are treated specially.
The exact action depends on the value of
+the \fBaltSendsEscape\fP and
the \fBmetaSendsEscape\fP and
the \fBeightBitInput\fP resources.
The \fBmetaSendsEscape\fP resource is tested first.
+See the \fBeightBitInput\fP resource for a full discussion.
.IP
The term \*(``eight-bit\*('' is misleading:
-\fIxterm\fP checks if the key's value is less than 128.
-If so, \fIxterm\fP adds 128 to the value, setting its eighth bit.
-Otherwise \fIxterm\fP sends an ESC byte before the key.
-In other applications' documentation,
-that is referred to as a \*(``meta key\*(''.
+\fIxterm\fP checks if the key is in the range 128 to 255
+(the eighth bit is set).
+If the value is in that range,
+depending on the resource values,
+\fIxterm\fP may then do one of the following:
+.RS
+.bP
+add 128 to the value, setting its eighth bit,
+.bP
+send an ESC byte before the key, or
+.bP
+send the key unaltered.
+.RE
+.TP 8
+.B "exec-formatted(\fIformat\fP, \fIsourcename\fP [, ...])"
+Execute an external command,
+using the current selection for part of the command's parameters.
+The first parameter, \fIformat\fP gives the basic command.
+Succeeding parameters specify the selection source as in \fBinsert-selection\fP.
+.IP
+The \fIformat\fP parameter allows these substitutions:
+.RS
+.TP 5
+%%
+inserts a "%".
+.TP 5
+%P
+the screen-position at the beginning of the highlighted region,
+as a semicolon-separated pair of integers using the
+values that the CUP control sequence would use.
+.TP 5
+%p
+the screen-position after the beginning of the highlighted region,
+using the same convention as \*(``%P\*(''.
+.TP 5
+%S
+the length of the string that \*(``%s\*('' would insert.
+.TP 5
+%s
+the content of the selection, unmodified.
+.TP 5
+%T
+the length of the string that \*(``%t\*('' would insert.
+.TP 5
+%t
+the selection, trimmed of leading/trailing whitespace, and newlines
+changed to single spaces.
+.TP 5
+%V
+the video attributes at the beginning of the highlighted region,
+as a semicolon-separated list of integers using the
+values that the SGR control sequence would use.
+.TP 5
+%v
+the video attributes after the end of the highlighted region,
+using the same convention as \*(``%V\*(''.
+.RE
+.IP
+After constructing the command-string,
+\fIxterm\fP forks a subprocess and executes the command,
+which completes independently of xterm.
+.TP 8
+.B "exec-selectable(\fIformat\fP, \fIonClicks\fP)"
+Execute an external command,
+using data copied from the screen for part of the command's parameters.
+The first parameter, \fIformat\fP gives
+the basic command as in \fBexec-formatted\fP.
+The second parameter specifies the method for copying
+the data as in the \fBonClicks\fP resource.
+.TP 8
+.B "insert-formatted(\fIformat\fP, \fIsourcename\fP [, ...])"
+Insert the current selection or data related to it, formatted.
+The first parameter, \fIformat\fP gives the template for the data
+as in \fBexec-formatted\fP.
+Succeeding parameters specify the selection source as in \fBinsert-selection\fP.
+.TP 8
+.B "insert-selectable(\fIformat\fP, \fIonClicks\fP)"
+Insert data copied from the screen, formatted.
+The first parameter, \fIformat\fP gives the template for the data
+as in \fBexec-formatted\fP.
+The second parameter specifies the method for copying
+the data as in the \fBonClicks\fP resource.
.TP 8
.B "insert-selection(\fIsourcename\fP [, ...])"
This action inserts the string found in the selection or cutbuffer indicated
@@ -6122,6 +6282,10 @@ will accept data, but some pty drivers do not return enough information
to know if the write has succeeded.
.
.PP
+When connected to an input method, it is possible for xterm to hang
+if the XIM server is suspended or killed.
+.
+.PP
Many of the options are not resettable after
.I xterm
starts.
diff --git a/app/xterm/xterm_io.h b/app/xterm/xterm_io.h
index 7a6e10be4..d24da4d6e 100644
--- a/app/xterm/xterm_io.h
+++ b/app/xterm/xterm_io.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm_io.h,v 1.51 2011/07/03 15:48:35 Paul.Lampert Exp $ */
+/* $XTermId: xterm_io.h,v 1.53 2011/12/30 22:45:49 tom Exp $ */
/*
* Copyright 2000-2006,2010 by Thomas E. Dickey
@@ -167,7 +167,7 @@
#ifdef SYSV
#ifdef USE_USG_PTYS
#include <sys/stream.h> /* get typedef used in ptem.h */
-#if !defined(SVR4) || defined(__SCO__)
+#ifdef HAVE_SYS_PTEM_H
#include <sys/ptem.h> /* get struct winsize */
#endif
#endif /* USE_USG_PTYS */
diff --git a/app/xterm/xtermcfg.h b/app/xterm/xtermcfg.h
index 42a7aae34..1dc4288b1 100644
--- a/app/xterm/xtermcfg.h
+++ b/app/xterm/xtermcfg.h
@@ -49,6 +49,7 @@ authorization.
/* #undef DISABLE_SETUID */ /* CF_ARG_DISABLE(setuid) */
#define HAVE_GETHOSTNAME 1 /* AC_CHECK_FUNCS(gethostname) */
#define HAVE_GETLOGIN 1 /* AC_CHECK_FUNCS(getlogin) */
+/* #undef HAVE_GRANTPT /* CF_FUNC_GRANTPT */
#define HAVE_LANGINFO_CODESET 1 /* AM_LANGINFO_CODESET */
/* #undef HAVE_LASTLOG_H */ /* CF_LASTLOG */
/* #undef HAVE_LIB_NEXTAW */ /* CF_X_ATHENA(--with-neXtaw) */
@@ -60,9 +61,12 @@ authorization.
/* #undef HAVE_NCURSES_TERM_H */ /* AC_CHECK_HEADERS(ncurses/term.h) */
#define HAVE_PATHS_H 1 /* CF_LASTLOG */
/* #undef HAVE_PCREPOSIX_H */ /* CF_WITH_PCRE */
+/* #undef HAVE_POSIX_OPENPT /* CF_FUNC_GRANTPT */
#define HAVE_POSIX_SAVED_IDS 1 /* CF_POSIX_SAVED_IDS */
+/* #undef HAVE_PTSNAME /* CF_FUNC_GRANTPT */
#define HAVE_PUTENV 1 /* AC_CHECK_FUNCS(putenv) */
#define HAVE_SCHED_YIELD 1 /* AC_CHECK_FUNCS(sched_yield) */
+#define HAVE_SETPGID /* AC_CHECK_FUNCS(setpgid) */
#define HAVE_STDLIB_H 1 /* AC_CHECK_HEADERS(stdlib.h) */
#define HAVE_STRERROR 1 /* AC_CHECK_FUNCS(strerror) */
#define HAVE_STRFTIME 1 /* AC_CHECK_FUNCS(strftime) */
@@ -76,8 +80,8 @@ authorization.
#define HAVE_TERM_H 1 /* AC_CHECK_HEADERS(term.h) */
#define HAVE_TIGETSTR 1 /* AC_CHECK_FUNCS(tigetstr) */
#define HAVE_UNISTD_H 1 /* AC_CHECK_HEADERS(unistd.h) */
-#define HAVE_USE_EXTENDED_NAMES 1 /* AC_CHECK_FUNCS(use_extended_names) */
#define HAVE_UNSETENV /* AC_CHECK_FUNCS(unsetenv) */
+#define HAVE_USE_EXTENDED_NAMES 1 /* AC_CHECK_FUNCS(use_extended_names) */
#define HAVE_UTMP 1 /* CF_UTMP */
#define HAVE_UTMP_UT_HOST 1 /* CF_UTMP_UT_HOST */
/* #undef HAVE_UTMP_UT_SESSION */ /* CF_UTMP_UT_SESSION */
@@ -134,6 +138,7 @@ authorization.
/* #undef OPT_READLINE */ /* CF_ARG_ENABLE(readline-mouse) */
/* #undef OPT_SAME_NAME */ /* CF_ARG_DISABLE(samename) */
/* #undef OPT_SCO_FUNC_KEYS */ /* CF_ARG_ENABLE(sco-fkeys) */
+/* #undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */
#define OPT_SELECT_REGEX 1 /* CF_ARG_DISABLE(regex) */
/* #undef OPT_SESSION_MGT */ /* CF_ARG_DISABLE(session-mgt) */
/* #undef OPT_SUN_FUNC_KEYS */ /* CF_ARG_ENABLE(sun-fkeys) */
diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin
index bdaebe825..32b22e3fc 100644
--- a/app/xterm/xtermcfg.hin
+++ b/app/xterm/xtermcfg.hin
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcfg.hin,v 1.185 2011/09/11 15:06:56 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.188 2012/01/05 10:28:29 tom Exp $ */
/*
* Copyright 1997-2010,2011 by Thomas E. Dickey
@@ -47,6 +47,7 @@
#undef DISABLE_SETUID /* CF_ARG_DISABLE(setuid) */
#undef HAVE_GETHOSTNAME /* AC_CHECK_FUNCS(gethostname) */
#undef HAVE_GETLOGIN /* AC_CHECK_FUNCS(getlogin) */
+#undef HAVE_GRANTPT /* CF_FUNC_GRANTPT */
#undef HAVE_LANGINFO_CODESET /* AM_LANGINFO_CODESET */
#undef HAVE_LASTLOG_H /* CF_LASTLOG */
#undef HAVE_LIB_NEXTAW /* CF_X_ATHENA(--with-neXtaw) */
@@ -58,9 +59,12 @@
#undef HAVE_NCURSES_TERM_H /* AC_CHECK_HEADERS(ncurses/term.h) */
#undef HAVE_PATHS_H /* CF_LASTLOG */
#undef HAVE_PCREPOSIX_H /* CF_WITH_PCRE */
+#undef HAVE_POSIX_OPENPT /* CF_FUNC_GRANTPT */
#undef HAVE_POSIX_SAVED_IDS /* CF_POSIX_SAVED_IDS */
+#undef HAVE_PTSNAME /* CF_FUNC_GRANTPT */
#undef HAVE_PUTENV /* AC_CHECK_FUNCS(putenv) */
#undef HAVE_SCHED_YIELD /* AC_CHECK_FUNCS(sched_yield) */
+#undef HAVE_SETPGID /* AC_CHECK_FUNCS(setpgid) */
#undef HAVE_STDLIB_H /* AC_CHECK_HEADERS(stdlib.h) */
#undef HAVE_STRERROR /* AC_CHECK_FUNCS(strerror) */
#undef HAVE_STRFTIME /* AC_CHECK_FUNCS(strftime) */
@@ -74,8 +78,8 @@
#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_UNSETENV /* AC_CHECK_FUNCS(unsetenv) */
+#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 */
@@ -132,6 +136,7 @@
#undef OPT_READLINE /* CF_ARG_ENABLE(readline-mouse) */
#undef OPT_SAME_NAME /* CF_ARG_DISABLE(samename) */
#undef OPT_SCO_FUNC_KEYS /* CF_ARG_ENABLE(sco-fkeys) */
+#undef OPT_SELECTION_OPS /* CF_ARG_DISABLE(selection-ops) */
#undef OPT_SELECT_REGEX /* CF_ARG_DISABLE(regex) */
#undef OPT_SESSION_MGT /* CF_ARG_DISABLE(session-mgt) */
#undef OPT_SUN_FUNC_KEYS /* CF_ARG_ENABLE(sun-fkeys) */