summaryrefslogtreecommitdiff
path: root/app/xterm
diff options
context:
space:
mode:
Diffstat (limited to 'app/xterm')
-rw-r--r--app/xterm/MANIFEST2
-rw-r--r--app/xterm/VTPrsTbl.c72
-rw-r--r--app/xterm/VTparse.def7
-rw-r--r--app/xterm/VTparse.h7
-rw-r--r--app/xterm/button.c17
-rw-r--r--app/xterm/charproc.c1095
-rw-r--r--app/xterm/configure.in4
-rw-r--r--app/xterm/ctlseqs.ms93
-rw-r--r--app/xterm/ctlseqs.txt98
-rw-r--r--app/xterm/cursor.c154
-rw-r--r--app/xterm/data.h5
-rw-r--r--app/xterm/doublechr.c44
-rw-r--r--app/xterm/input.c4
-rw-r--r--app/xterm/main.c22
-rw-r--r--app/xterm/misc.c132
-rw-r--r--app/xterm/os2main.c19
-rw-r--r--app/xterm/package/debian/changelog6
-rw-r--r--app/xterm/package/xterm.spec4
-rw-r--r--app/xterm/ptyx.h51
-rw-r--r--app/xterm/screen.c152
-rw-r--r--app/xterm/tabs.c13
-rw-r--r--app/xterm/trace.c76
-rw-r--r--app/xterm/trace.h4
-rw-r--r--app/xterm/util.c671
-rw-r--r--app/xterm/version.h6
-rw-r--r--app/xterm/xstrings.c89
-rw-r--r--app/xterm/xstrings.h4
-rw-r--r--app/xterm/xterm.h88
-rw-r--r--app/xterm/xterm.log.html111
-rw-r--r--app/xterm/xterm.man54
-rw-r--r--app/xterm/xterm_io.h24
-rw-r--r--app/xterm/xtermcfg.hin5
-rw-r--r--app/xterm/xutf8.c20
33 files changed, 2336 insertions, 817 deletions
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 30e5fd378..53891c47d 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-278, version xterm-278
+MANIFEST for xterm-279, version xterm-279
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index 35e0bc780..825593e8d 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,4 +1,4 @@
-/* $XTermId: VTPrsTbl.c,v 1.63 2011/12/04 19:46:52 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.66 2012/04/26 09:04:37 tom Exp $ */
/*
* Copyright 1999-2010,2011 by Thomas E. Dickey
@@ -99,7 +99,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -423,7 +423,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -530,12 +530,12 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* ` a b c */
CASE_HPA,
-CASE_GROUND_STATE,
+CASE_HPR,
CASE_REP,
CASE_DA1,
/* d e f g */
CASE_VPA,
-CASE_GROUND_STATE,
+CASE_VPR,
CASE_CUP,
CASE_TBC,
/* h i j k */
@@ -690,12 +690,12 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* agrave aacute acircumflex atilde */
CASE_HPA,
-CASE_GROUND_STATE,
+CASE_HPR,
CASE_REP,
CASE_DA1,
/* adiaeresis aring ae ccedilla */
CASE_VPA,
-CASE_GROUND_STATE,
+CASE_VPR,
CASE_CUP,
CASE_TBC,
/* egrave eacute ecircumflex ediaeresis */
@@ -747,7 +747,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -854,12 +854,12 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* ` a b c */
CASE_HPA,
-CASE_GROUND_STATE,
+CASE_HPR,
CASE_REP,
CASE_DA1,
/* d e f g */
CASE_VPA,
-CASE_GROUND_STATE,
+CASE_VPR,
CASE_CUP,
CASE_TBC,
/* h i j k */
@@ -1014,12 +1014,12 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* agrave aacute acircumflex atilde */
CASE_HPA,
-CASE_GROUND_STATE,
+CASE_HPR,
CASE_REP,
CASE_DA1,
/* adiaeresis aring ae ccedilla */
CASE_VPA,
-CASE_GROUND_STATE,
+CASE_VPR,
CASE_CUP,
CASE_TBC,
/* egrave eacute ecircumflex ediaeresis */
@@ -1071,7 +1071,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -1395,7 +1395,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -1720,7 +1720,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -2046,7 +2046,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -2372,7 +2372,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -2696,7 +2696,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -2833,7 +2833,7 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* x y z { */
CASE_DECSACE,
-CASE_GROUND_STATE,
+CASE_DECRQCRA,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* | } ~ DEL */
@@ -2993,7 +2993,7 @@ CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* oslash ugrave uacute ucircumflex */
CASE_DECSACE,
-CASE_GROUND_STATE,
+CASE_DECRQCRA,
CASE_GROUND_STATE,
CASE_GROUND_STATE,
/* udiaeresis yacute thorn ydiaeresis */
@@ -3021,7 +3021,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -3346,7 +3346,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -3671,7 +3671,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -3995,7 +3995,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -4319,7 +4319,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -4643,7 +4643,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -4967,7 +4967,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -5291,7 +5291,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -5615,7 +5615,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -5939,7 +5939,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -6263,7 +6263,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -6591,7 +6591,7 @@ CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_IGNORE,
CASE_IGNORE,
CASE_IGNORE,
@@ -6916,7 +6916,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_SO,
@@ -7242,7 +7242,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_IGNORE,
@@ -7566,7 +7566,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_IGNORE,
@@ -7890,7 +7890,7 @@ CASE_BS,
CASE_TAB,
CASE_VMOT,
CASE_VMOT,
-/* NP CR SO SI */
+/* FF CR SO SI */
CASE_VMOT,
CASE_CR,
CASE_IGNORE,
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index 67254d142..7f6a83ae0 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,10 +1,10 @@
-# $XTermId: VTparse.def,v 1.42 2011/12/04 18:29:33 tom Exp $
+# $XTermId: VTparse.def,v 1.44 2012/04/26 01:01:03 tom Exp $
#
# vile:confmode rs=lf
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1996-2010,2011 by Thomas E. Dickey
+# Copyright 1996-2011,2012 by Thomas E. Dickey
#
# All Rights Reserved
#
@@ -191,3 +191,6 @@ CASE_DECDC
CASE_DECIC
CASE_DECBI
CASE_DECFI
+CASE_DECRQCRA
+CASE_HPR
+CASE_VPR
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index bf9350f31..2a747df93 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,7 +1,7 @@
-/* $XTermId: VTparse.h,v 1.55 2011/12/04 18:30:20 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.57 2012/04/26 01:01:03 tom Exp $ */
/*
- * Copyright 2002-2010,2011 by Thomas E. Dickey
+ * Copyright 2002-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -272,5 +272,8 @@ extern Const PARSE_T esc_pct_table[];
#define CASE_DECIC 150
#define CASE_DECBI 151
#define CASE_DECFI 152
+#define CASE_DECRQCRA 153
+#define CASE_HPR 154
+#define CASE_VPR 155
#endif /* included_VTparse_h */
diff --git a/app/xterm/button.c b/app/xterm/button.c
index d3c44e4fb..cdf05b318 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,7 +1,7 @@
-/* $XTermId: button.c,v 1.430 2012/01/07 02:00:35 tom Exp $ */
+/* $XTermId: button.c,v 1.434 2012/05/10 11:06:10 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -2597,14 +2597,14 @@ ScrollSelection(TScreen * screen, int amount, Bool always)
adjust = ROW2INX(screen, screen->startH.row);
if (always
- || !ScrnHaveLineMargins(screen)
- || ScrnIsLineInMargins(screen, adjust)) {
+ || !ScrnHaveRowMargins(screen)
+ || ScrnIsRowInMargins(screen, adjust)) {
scroll_update_one(&screen->startH);
}
adjust = ROW2INX(screen, screen->endH.row);
if (always
- || !ScrnHaveLineMargins(screen)
- || ScrnIsLineInMargins(screen, adjust)) {
+ || !ScrnHaveRowMargins(screen)
+ || ScrnIsRowInMargins(screen, adjust)) {
scroll_update_one(&screen->endH);
}
}
@@ -2730,7 +2730,7 @@ static int charClass[256] =
{
/* NUL SOH STX ETX EOT ENQ ACK BEL */
32, 1, 1, 1, 1, 1, 1, 1,
-/* BS HT NL VT NP CR SO SI */
+/* BS HT NL VT FF CR SO SI */
1, 32, 1, 1, 1, 1, 1, 1,
/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */
1, 1, 1, 1, 1, 1, 1, 1,
@@ -4673,8 +4673,7 @@ formatVideoAttrs(XtermWidget xw, char *buffer, CELL * cell)
buffer += sprintf(buffer, "%s48;5", delim);
delim = ";";
}
- buffer += sprintf(buffer, "%s%u", delim, bg);
- delim = ";";
+ (void) sprintf(buffer, "%s%u", delim, bg);
}
#endif
}
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index ec5f498d7..8940e8830 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,7 +1,7 @@
-/* $XTermId: charproc.c,v 1.1161 2012/01/19 00:22:08 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1205 2012/05/10 10:51:37 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -162,6 +162,7 @@ static void window_ops(XtermWidget /* xw */ );
#define DoStartBlinking(s) ((s)->cursor_blink ^ (s)->cursor_blink_esc)
#if OPT_BLINK_CURS || OPT_BLINK_TEXT
+#define UpdateCursorBlink(screen) SetCursorBlink(screen, screen->cursor_blink)
static void SetCursorBlink(TScreen * /* screen */ ,
Bool /* enable */ );
static void HandleBlinking(XtPointer /* closure */ ,
@@ -666,6 +667,7 @@ static XtResource xterm_resources[] =
#if OPT_WIDE_CHARS
Bres(XtNcjkWidth, XtCCjkWidth, misc.cjk_width, False),
Bres(XtNmkWidth, XtCMkWidth, misc.mk_width, False),
+ Bres(XtNprecompose, XtCPrecompose, screen.normalized_c, True),
Bres(XtNutf8Latin1, XtCUtf8Latin1, screen.utf8_latin1, False),
Bres(XtNutf8Title, XtCUtf8Title, screen.utf8_title, False),
Bres(XtNvt100Graphics, XtCVT100Graphics, screen.vt100_graphics, True),
@@ -1065,8 +1067,9 @@ resetCharsets(TScreen * screen)
static void
set_ansi_conformance(TScreen * screen, int level)
{
- TRACE(("set_ansi_conformance(%d) terminal_id %d, ansi_level %d\n",
+ TRACE(("set_ansi_conformance(%d) dec_level %d:%d, ansi_level %d\n",
level,
+ screen->vtXX_level * 100,
screen->terminal_id,
screen->ansi_level));
if (screen->vtXX_level >= 3) {
@@ -1109,6 +1112,33 @@ set_tb_margins(TScreen * screen, int top, int bottom)
}
void
+set_lr_margins(TScreen * screen, int left, int right)
+{
+ TRACE(("set_lr_margins %d..%d, prior %d..%d\n",
+ left, right,
+ screen->lft_marg,
+ screen->rgt_marg));
+ if (right > left) {
+ screen->lft_marg = left;
+ screen->rgt_marg = right;
+ }
+ if (screen->lft_marg > screen->max_col)
+ screen->lft_marg = screen->max_col;
+ if (screen->rgt_marg > screen->max_col)
+ screen->rgt_marg = screen->max_col;
+}
+
+#define reset_tb_margins(screen) set_tb_margins(screen, 0, screen->max_row)
+#define reset_lr_margins(screen) set_lr_margins(screen, 0, screen->max_col)
+
+static void
+reset_margins(TScreen * screen)
+{
+ reset_tb_margins(screen);
+ reset_lr_margins(screen);
+}
+
+void
set_max_col(TScreen * screen, int cols)
{
TRACE(("set_max_col %d, prior %d\n", cols, screen->max_col));
@@ -1344,14 +1374,19 @@ init_parser(XtermWidget xw, struct ParseState *sp)
ResetState(sp);
}
+static void
+init_reply(unsigned type)
+{
+ memset(&reply, 0, sizeof(reply));
+ reply.a_type = (Char) type;
+}
+
static Boolean
doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
{
TScreen *screen = TScreenOf(xw);
int row;
int col;
- int top;
- int bot;
int count;
int laststate;
int thischar = -1;
@@ -1370,25 +1405,38 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (c >= 0x300 && screen->wide_chars
&& my_wcwidth((int) c) == 0
&& !isWideControl(c)) {
- int prev, precomposed;
+ int prev, test;
WriteNow();
- prev = (int) XTERM_CELL(screen->last_written_row,
- screen->last_written_col);
- precomposed = do_precomposition(prev, (int) c);
- TRACE(("do_precomposition (U+%04X [%d], U+%04X [%d]) -> U+%04X [%d]\n",
- prev, my_wcwidth(prev),
- (int) c, my_wcwidth((int) c),
- precomposed, my_wcwidth(precomposed)));
+ /*
+ * Check if the latest data can be added to the base character.
+ * If there is already a combining character stored for the cell,
+ * we cannot, since that would change the order.
+ */
+ if (screen->normalized_c
+ && !IsCellCombined(screen,
+ screen->last_written_row,
+ screen->last_written_col)) {
+ prev = (int) XTERM_CELL(screen->last_written_row,
+ screen->last_written_col);
+ test = do_precomposition(prev, (int) c);
+ TRACE(("do_precomposition (U+%04X [%d], U+%04X [%d]) -> U+%04X [%d]\n",
+ prev, my_wcwidth(prev),
+ (int) c, my_wcwidth((int) c),
+ test, my_wcwidth(test)));
+ } else {
+ prev = -1;
+ test = -1;
+ }
/* substitute combined character with precomposed character
* only if it does not change the width of the base character
*/
- if (precomposed != -1 && my_wcwidth(precomposed) == my_wcwidth(prev)) {
+ if (test != -1 && my_wcwidth(test) == my_wcwidth(prev)) {
putXtermCell(screen,
screen->last_written_row,
- screen->last_written_col, precomposed);
+ screen->last_written_col, test);
} else {
addXtermCombining(screen,
screen->last_written_row,
@@ -1672,8 +1720,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
case CASE_CR:
- /* CR */
- CarriageReturn(screen);
+ TRACE(("CASE_CR\n"));
+ CarriageReturn(xw);
break;
case CASE_ESC:
@@ -1698,18 +1746,20 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
#endif
case CASE_VMOT:
+ TRACE(("CASE_VMOT\n"));
/*
* form feed, line feed, vertical tab
*/
xtermAutoPrint(xw, c);
xtermIndex(xw, 1);
if (xw->flags & LINEFEED)
- CarriageReturn(screen);
+ CarriageReturn(xw);
else
do_xevents();
break;
case CASE_CBT:
+ TRACE(("CASE_CBT\n"));
/* cursor backward tabulation */
if ((count = param[0]) == DEFAULT)
count = 1;
@@ -1719,6 +1769,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
case CASE_CHT:
+ TRACE(("CASE_CHT\n"));
/* cursor forward tabulation */
if ((count = param[0]) == DEFAULT)
count = 1;
@@ -1870,7 +1921,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_CUF - cursor forward\n"));
if ((col = param[0]) < 1)
col = 1;
- CursorForward(screen, col);
+ CursorForward(xw, col);
ResetState(sp);
break;
@@ -1896,18 +1947,34 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
case CASE_VPA:
- TRACE(("CASE_VPA - vertical position\n"));
+ TRACE(("CASE_VPA - vertical position absolute\n"));
if ((row = param[0]) < 1)
row = 1;
- CursorSet(screen, row - 1, screen->cur_col, xw->flags);
+ CursorSet(screen, row - 1, CursorCol(xw), xw->flags);
ResetState(sp);
break;
case CASE_HPA:
- TRACE(("CASE_HPA - horizontal position\n"));
+ TRACE(("CASE_HPA - horizontal position absolute\n"));
if ((col = param[0]) < 1)
col = 1;
- CursorSet(screen, screen->cur_row, col - 1, xw->flags);
+ CursorSet(screen, CursorRow(xw), col - 1, xw->flags);
+ ResetState(sp);
+ break;
+
+ case CASE_VPR:
+ TRACE(("CASE_VPR - vertical position relative\n"));
+ if ((row = param[0]) < 1)
+ row = 1;
+ CursorSet(screen, CursorRow(xw) + row, CursorCol(xw), xw->flags);
+ ResetState(sp);
+ break;
+
+ case CASE_HPR:
+ TRACE(("CASE_HPR - horizontal position relative\n"));
+ if ((col = param[0]) < 1)
+ col = 1;
+ CursorSet(screen, CursorRow(xw), CursorCol(xw) + col, xw->flags);
ResetState(sp);
break;
@@ -2010,7 +2077,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DA1\n"));
if (param[0] <= 0) { /* less than means DEFAULT */
count = 0;
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = '?';
/* The first param corresponds to the highest
@@ -2066,7 +2133,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DA2\n"));
if (param[0] <= 0) { /* less than means DEFAULT */
count = 0;
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = '>';
if (screen->terminal_id >= 200)
@@ -2315,51 +2382,64 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
/* FALLTHRU */
case CASE_CPR:
- TRACE(("CASE_CPR - cursor position\n"));
+ TRACE(("CASE_DSR - device status report\n"));
count = 0;
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = CharOf(sp->private_function ? '?' : 0);
reply.a_inters = 0;
reply.a_final = 'n';
switch (param[0]) {
case 5:
+ TRACE(("...request operating status\n"));
/* operating status */
reply.a_param[count++] = 0; /* (no malfunction ;-) */
break;
case 6:
+ TRACE(("...request %s\n",
+ (sp->private_function
+ ? "DECXCPR"
+ : "CPR")));
/* CPR */
- /* DECXCPR (with page=0) */
+ /* DECXCPR (with page=1) */
reply.a_param[count++] = (ParmType) (screen->cur_row + 1);
reply.a_param[count++] = (ParmType) (screen->cur_col + 1);
+ if (sp->private_function
+ && screen->vtXX_level >= 4) { /* VT420 */
+ reply.a_param[count++] = 1;
+ }
reply.a_final = 'R';
break;
case 15:
- /* printer status */
- if (screen->terminal_id >= 200) { /* VT220 */
+ TRACE(("...request printer status\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 2) { /* VT220 */
reply.a_param[count++] = 13; /* implement printer */
}
break;
case 25:
- /* UDK status */
- if (screen->terminal_id >= 200) { /* VT220 */
+ TRACE(("...request UDK status\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 2) { /* VT220 */
reply.a_param[count++] = 20; /* UDK always unlocked */
}
break;
case 26:
- /* keyboard status */
- if (screen->terminal_id >= 200) { /* VT220 */
+ TRACE(("...request keyboard status\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 2) { /* VT220 */
reply.a_param[count++] = 27;
reply.a_param[count++] = 1; /* North American */
- if (screen->terminal_id >= 400) {
+ if (screen->vtXX_level >= 4) { /* VT420 */
reply.a_param[count++] = 0; /* ready */
reply.a_param[count++] = 0; /* LK201 */
}
}
break;
case 53:
- /* Locator status */
- if (screen->terminal_id >= 200) { /* VT220 */
+ TRACE(("...request locator status\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 2) { /* VT220 */
#if OPT_DEC_LOCATOR
reply.a_param[count++] = 50; /* locator ready */
#else
@@ -2367,6 +2447,43 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
#endif
}
break;
+ case 62:
+ TRACE(("...request DECMSR - macro space\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 4) { /* VT420 */
+ reply.a_pintro = 0;
+ reply.a_radix[count] = 16; /* no data */
+ reply.a_param[count++] = 0; /* no space for macros */
+ reply.a_inters = '*';
+ reply.a_final = '{';
+ }
+ break;
+ case 63:
+ TRACE(("...request DECCKSR - memory checksum\n"));
+ /* DECCKSR - Memory checksum */
+ if (sp->private_function
+ && screen->vtXX_level >= 4) { /* VT420 */
+ init_reply(ANSI_DCS);
+ reply.a_param[count++] = (ParmType) param[1]; /* PID */
+ reply.a_delim = "!~"; /* delimiter */
+ reply.a_radix[count] = 16; /* use hex */
+ reply.a_param[count++] = 0; /* no data */
+ }
+ break;
+ case 75:
+ TRACE(("...request data integrity\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 4) { /* VT420 */
+ reply.a_param[count++] = 70; /* no errors */
+ }
+ break;
+ case 85:
+ TRACE(("...request multi-session configuration\n"));
+ if (sp->private_function
+ && screen->vtXX_level >= 4) { /* VT420 */
+ reply.a_param[count++] = 83; /* not configured */
+ }
+ break;
default:
break;
}
@@ -2406,19 +2523,23 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECSTBM:
TRACE(("CASE_DECSTBM - set scrolling region\n"));
- if ((top = param[0]) < 1)
- top = 1;
- if (nparam < 2 || (bot = param[1]) == DEFAULT
- || bot > MaxRows(screen)
- || bot == 0)
- bot = MaxRows(screen);
- if (bot > top) {
- if (screen->scroll_amt)
- FlushScroll(xw);
- set_tb_margins(screen, top - 1, bot - 1);
- CursorSet(screen, 0, 0, xw->flags);
+ {
+ int top;
+ int bot;
+ if ((top = param[0]) < 1)
+ top = 1;
+ if (nparam < 2 || (bot = param[1]) == DEFAULT
+ || bot > MaxRows(screen)
+ || bot == 0)
+ bot = MaxRows(screen);
+ if (bot > top) {
+ if (screen->scroll_amt)
+ FlushScroll(xw);
+ set_tb_margins(screen, top - 1, bot - 1);
+ CursorSet(screen, 0, 0, xw->flags);
+ }
+ ResetState(sp);
}
- ResetState(sp);
break;
case CASE_DECREQTPARM:
@@ -2427,7 +2548,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) == DEFAULT)
row = 0;
if (row == 0 || row == 1) {
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 7;
reply.a_param[0] = (ParmType) (row + 2);
@@ -2469,7 +2590,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DECALN - alignment test\n"));
if (screen->cursor_state)
HideCursor();
- set_tb_margins(screen, 0, screen->max_row);
+ reset_margins(screen);
CursorSet(screen, 0, 0, xw->flags);
xtermParseRect(xw, 0, 0, &myRect);
ScrnFillRectangle(xw, &myRect, 'E', 0, False);
@@ -2484,9 +2605,26 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
case CASE_DECSC:
- TRACE(("CASE_DECSC - save cursor\n"));
- CursorSave(xw);
- ResetState(sp);
+ if (IsLeftRightMode(xw)) {
+ int left;
+ int right;
+
+ TRACE(("CASE_DECSLRM - set left and right margin\n"));
+ if ((left = param[0]) < 1)
+ left = 1;
+ if (nparam < 2 || (right = param[1]) == DEFAULT
+ || right > MaxCols(screen)
+ || right == 0)
+ right = MaxCols(screen);
+ if (right > left) {
+ set_lr_margins(screen, left - 1, right - 1);
+ CursorSet(screen, 0, 0, xw->flags);
+ }
+ } else {
+ TRACE(("CASE_DECSC - save cursor\n"));
+ CursorSave(xw);
+ ResetState(sp);
+ }
break;
case CASE_DECRC:
@@ -2525,7 +2663,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DECSCUSR\n"));
{
Boolean change = True;
- Boolean blinks = screen->cursor_blink;
+ Boolean blinks = screen->cursor_blink_esc;
HideCursor();
@@ -2559,7 +2697,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (change) {
xtermSetCursorBox(screen);
- SetCursorBlink(screen, blinks);
+ screen->cursor_blink_esc = blinks;
+ UpdateCursorBlink(screen);
}
}
ResetState(sp);
@@ -2604,7 +2743,11 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
&& screen->vtXX_level == 0) {
sp->groundtable =
sp->parsestate = ansi_table;
- screen->vtXX_level = screen->vt52_save_level;
+ /*
+ * On restore, the terminal does not recognize DECRQSS for
+ * DECSCL (per vttest).
+ */
+ screen->vtXX_level = 1;
screen->curgl = screen->vt52_save_curgl;
screen->curgr = screen->vt52_save_curgr;
screen->curss = screen->vt52_save_curss;
@@ -2633,24 +2776,27 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECSCL:
TRACE(("CASE_DECSCL(%d,%d)\n", param[0], param[1]));
- if (param[0] >= 61 && param[0] <= 65) {
- /*
- * VT300, VT420, VT520 manuals claim that DECSCL does a hard
- * reset (RIS). VT220 manual states that it is a soft reset.
- * Perhaps both are right (unlikely). Kermit says it's soft.
- */
- ReallyReset(xw, False, False);
- init_parser(xw, sp);
- screen->vtXX_level = param[0] - 60;
- if (param[0] > 61) {
- switch (zero_if_default(1)) {
- case 1:
- show_8bit_control(False);
- break;
- case 0:
- case 2:
- show_8bit_control(True);
- break;
+ if (screen->terminal_id >= 200) {
+ if (param[0] >= 61 && param[0] <= 65) {
+ /*
+ * VT300, VT420, VT520 manuals claim that DECSCL does a
+ * hard reset (RIS). VT220 manual states that it is a soft
+ * reset. Perhaps both are right (unlikely). Kermit says
+ * it's soft.
+ */
+ ReallyReset(xw, False, False);
+ init_parser(xw, sp);
+ screen->vtXX_level = param[0] - 60;
+ if (param[0] > 61) {
+ switch (zero_if_default(1)) {
+ case 1:
+ show_8bit_control(False);
+ break;
+ case 0:
+ case 2:
+ show_8bit_control(True);
+ break;
+ }
}
}
}
@@ -2660,10 +2806,13 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECSCA:
TRACE(("CASE_DECSCA\n"));
screen->protected_mode = DEC_PROTECT;
- if (param[0] <= 0 || param[0] == 2)
+ if (param[0] <= 0 || param[0] == 2) {
UIntClr(xw->flags, PROTECTED);
- else if (param[0] == 1)
+ TRACE(("...clear PROTECTED\n"));
+ } else if (param[0] == 1) {
xw->flags |= PROTECTED;
+ TRACE(("...set PROTECTED\n"));
+ }
ResetState(sp);
break;
@@ -2779,7 +2928,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECDC:
TRACE(("CASE_DC - delete column\n"));
- if (screen->terminal_id >= 400) {
+ if (screen->vtXX_level >= 4
+ && IsLeftRightMode(xw)) {
if ((count = param[0]) < 1)
count = 1;
xtermColScroll(xw, count, True, screen->cur_col);
@@ -2789,7 +2939,8 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECIC:
TRACE(("CASE_IC - insert column\n"));
- if (screen->terminal_id >= 400) {
+ if (screen->vtXX_level >= 4
+ && IsLeftRightMode(xw)) {
if ((count = param[0]) < 1)
count = 1;
xtermColScroll(xw, count, False, screen->cur_col);
@@ -2799,7 +2950,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECBI:
TRACE(("CASE_BI - back index\n"));
- if (screen->terminal_id >= 400) {
+ if (screen->vtXX_level >= 4) {
xtermColIndex(xw, True);
}
ResetState(sp);
@@ -2807,7 +2958,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_DECFI:
TRACE(("CASE_FI - forward index\n"));
- if (screen->terminal_id >= 400) {
+ if (screen->vtXX_level >= 4) {
xtermColIndex(xw, False);
}
ResetState(sp);
@@ -2822,20 +2973,20 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_CPL:
TRACE(("CASE_CPL - cursor prev line\n"));
- CursorPrevLine(screen, param[0]);
+ CursorPrevLine(xw, param[0]);
ResetState(sp);
break;
case CASE_CNL:
TRACE(("CASE_CNL - cursor next line\n"));
- CursorNextLine(screen, param[0]);
+ CursorNextLine(xw, param[0]);
ResetState(sp);
break;
case CASE_NEL:
TRACE(("CASE_NEL\n"));
xtermIndex(xw, 1);
- CarriageReturn(screen);
+ CarriageReturn(xw);
ResetState(sp);
break;
@@ -2983,6 +3134,24 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
sp->parsestate = eigtable;
break;
+ case CASE_DECRQCRA:
+ if (screen->vtXX_level >= 4) {
+ int checksum;
+
+ TRACE(("CASE_DECRQCRA - Request checksum of rectangular area\n"));
+ xtermCheckRect(xw, nparam, param, &checksum);
+ init_reply(ANSI_DCS);
+ count = 0;
+ reply.a_param[count++] = (ParmType) param[1]; /* PID */
+ reply.a_delim = "!~"; /* delimiter */
+ reply.a_radix[count] = 16;
+ reply.a_param[count++] = (ParmType) checksum;
+ reply.a_nparam = (ParmType) count;
+ unparseseq(xw, &reply);
+ }
+ ResetState(sp);
+ break;
+
case CASE_DECCRA:
if (screen->vtXX_level >= 4) {
TRACE(("CASE_DECCRA - Copy rectangular area\n"));
@@ -3083,18 +3252,22 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_S7C1T:
TRACE(("CASE_S7C1T\n"));
- show_8bit_control(False);
- ResetState(sp);
+ if (screen->terminal_id >= 200) {
+ show_8bit_control(False);
+ ResetState(sp);
+ }
break;
case CASE_S8C1T:
TRACE(("CASE_S8C1T\n"));
+ if (screen->terminal_id >= 200) {
#if OPT_VT52_MODE
- if (screen->vtXX_level <= 1)
- break;
+ if (screen->vtXX_level <= 1)
+ break;
#endif
- show_8bit_control(True);
- ResetState(sp);
+ show_8bit_control(True);
+ ResetState(sp);
+ }
break;
case CASE_OSC:
@@ -3826,7 +3999,7 @@ WrapLine(XtermWidget xw)
}
xtermAutoPrint(xw, '\n');
xtermIndex(xw, 1);
- set_cur_col(screen, 0);
+ set_cur_col(screen, ScrnLeftMargin(xw));
}
}
@@ -3848,7 +4021,15 @@ dotext(XtermWidget xw,
int next_col, last_col, this_col; /* must be signed */
#endif
Cardinal offset;
+ int right = ScrnRightMargin(xw);
+ /*
+ * It is possible to use CUP, etc., to move outside margins. In that
+ * case, the right-margin is ineffective.
+ */
+ if (screen->cur_col > right) {
+ right = screen->max_col;
+ }
#if OPT_WIDE_CHARS
/* don't translate if we use UTF-8, and are not handling legacy support
* for line-drawing characters.
@@ -3873,7 +4054,7 @@ dotext(XtermWidget xw,
for (offset = 0;
offset < len && (chars_chomped > 0 || screen->do_wrap);
offset += chars_chomped) {
- int width_available = MaxCols(screen) - screen->cur_col;
+ int width_available = right + 1 - screen->cur_col;
int width_here = 0;
Boolean need_wrap = False;
int last_chomp = 0;
@@ -3883,11 +4064,17 @@ dotext(XtermWidget xw,
screen->do_wrap = False;
if ((xw->flags & WRAPAROUND)) {
WrapLine(xw);
- width_available = MaxCols(screen) - screen->cur_col;
+ width_available = right + 1 - screen->cur_col;
next_col = screen->cur_col;
}
}
+ /*
+ * This can happen with left/right margins...
+ */
+ if (width_available <= 0)
+ break;
+
while (width_here <= width_available && chars_chomped < (len - offset)) {
if (!screen->utf8_mode
|| (screen->vt100_graphics && charset == '0'))
@@ -3899,9 +4086,12 @@ dotext(XtermWidget xw,
}
if (width_here > width_available) {
- if (last_chomp > MaxCols(screen))
+ if (last_chomp > right + 1)
break; /* give up - it is too big */
- chars_chomped--;
+ if (chars_chomped-- == 0) {
+ /* This can happen with left/right margins... */
+ break;
+ }
width_here -= last_chomp;
if (chars_chomped > 0) {
need_wrap = True;
@@ -3934,6 +4124,8 @@ dotext(XtermWidget xw,
#endif
last_col = LineMaxCol(screen, ld);
+ if (last_col > (right + 1))
+ last_col = right + 1;
this_col = last_col - screen->cur_col + 1;
if (this_col <= 1) {
if (screen->do_wrap) {
@@ -3990,34 +4182,12 @@ HandleStructNotify(Widget w GCC_UNUSED,
XEvent * event,
Boolean * cont GCC_UNUSED)
{
- static char *icon_name;
- static Arg args[] =
- {
- {XtNiconName, (XtArgVal) & icon_name}
- };
XtermWidget xw = term;
- TScreen *screen = TScreenOf(xw);
switch (event->type) {
case MapNotify:
TRACE(("HandleStructNotify(MapNotify)\n"));
-#if OPT_ZICONBEEP
- if (screen->zIconBeep_flagged) {
- screen->zIconBeep_flagged = False;
- icon_name = NULL;
- XtGetValues(toplevel, args, XtNumber(args));
- if (icon_name != NULL) {
- char *buf = CastMallocN(char, strlen(icon_name));
- if (buf == NULL) {
- screen->zIconBeep_flagged = True;
- return;
- }
- strcpy(buf, icon_name + 4);
- ChangeIconName(xw, buf);
- free(buf);
- }
- }
-#endif /* OPT_ZICONBEEP */
+ resetZIconBeep(xw);
mapstate = !IsUnmapped;
break;
case UnmapNotify:
@@ -4066,10 +4236,10 @@ HandleStructNotify(Widget w GCC_UNUSED,
* Try to fool it.
*/
REQ_RESIZE((Widget) xw,
- screen->fullVwin.fullwidth,
+ TScreenOf(xw)->fullVwin.fullwidth,
(Dimension) (info->menu_height
- save.menu_height
- + screen->fullVwin.fullheight),
+ + TScreenOf(xw)->fullVwin.fullheight),
NULL, NULL);
repairSizeHints();
}
@@ -4172,6 +4342,103 @@ really_set_mousemode(XtermWidget xw,
#endif
/*
+ * Use this enumerated type to check consistency among dpmodes(), savemodes()
+ * and restoremodes().
+ */
+typedef enum {
+ srm_DECCKM = 1
+ ,srm_DECANM = 2
+ ,srm_DECCOLM = 3
+ ,srm_DECSCLM = 4
+ ,srm_DECSCNM = 5
+ ,srm_DECOM = 6
+ ,srm_DECAWM = 7
+ ,srm_DECARM = 8
+ ,srm_X10_MOUSE = SET_X10_MOUSE
+#if OPT_TOOLBAR
+ ,srm_RXVT_TOOLBAR = 10
+#endif
+#if OPT_BLINK_CURS
+ ,srm_ATT610_BLINK = 12
+#endif
+ ,srm_DECPFF = 18
+ ,srm_DECPEX = 19
+ ,srm_DECTCEM = 25
+ ,srm_RXVT_SCROLLBAR = 30
+#if OPT_SHIFT_FONTS
+ ,srm_RXVT_FONTSIZE = 35
+#endif
+#if OPT_TEK4014
+ ,srm_DECTEK = 38
+#endif
+ ,srm_132COLS = 40
+ ,srm_CURSES_HACK = 41
+ ,srm_DECNRCM = 42
+ ,srm_MARGIN_BELL = 44
+ ,srm_REVERSEWRAP = 45
+#ifdef ALLOWLOGGING
+ ,srm_ALLOWLOGGING = 46
+#endif
+ ,srm_OPT_ALTBUF_CURSOR = 1049
+ ,srm_OPT_ALTBUF = 1047
+ ,srm_ALTBUF = 47
+ ,srm_DECNKM = 66
+ ,srm_DECBKM = 67
+ ,srm_DECLRMM = 69
+ ,srm_DECNCSM = 95
+ ,srm_VT200_MOUSE = SET_VT200_MOUSE
+ ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE
+ ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE
+ ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE
+#if OPT_FOCUS_EVENT
+ ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE
+#endif
+ ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE
+ ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE
+ ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE
+ ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010
+ ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011
+ ,srm_EIGHT_BIT_META = 1034
+#if OPT_NUM_LOCK
+ ,srm_REAL_NUMLOCK = 1035
+ ,srm_META_SENDS_ESC = 1036
+#endif
+ ,srm_DELETE_IS_DEL = 1037
+#if OPT_NUM_LOCK
+ ,srm_ALT_SENDS_ESC = 1039
+#endif
+ ,srm_KEEP_SELECTION = 1040
+ ,srm_SELECT_TO_CLIPBOARD = 1041
+ ,srm_BELL_IS_URGENT = 1042
+ ,srm_POP_ON_BELL = 1043
+ ,srm_TITE_INHIBIT = 1048
+#if OPT_TCAP_FKEYS
+ ,srm_TCAP_FKEYS = 1050
+#endif
+#if OPT_SUN_FUNC_KEYS
+ ,srm_SUN_FKEYS = 1051
+#endif
+#if OPT_HP_FUNC_KEYS
+ ,srm_HP_FKEYS = 1052
+#endif
+#if OPT_SCO_FUNC_KEYS
+ ,srm_SCO_FKEYS = 1053
+#endif
+ ,srm_LEGACY_FKEYS = 1060
+#if OPT_SUNPC_KBD
+ ,srm_VT220_FKEYS = 1061
+#endif
+#if OPT_READLINE
+ ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT
+ ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT
+ ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE
+ ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET
+ ,srm_PASTE_QUOTE = SET_PASTE_QUOTE
+ ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL
+#endif /* OPT_READLINE */
+} DECSET_codes;
+
+/*
* process DEC private modes set, reset
*/
static void
@@ -4183,12 +4450,12 @@ dpmodes(XtermWidget xw, BitFunc func)
for (i = 0; i < nparam; ++i) {
TRACE(("%s %d\n", IsSM()? "DECSET" : "DECRST", param[i]));
- switch (param[i]) {
- case 1: /* DECCKM */
+ switch ((DECSET_codes) param[i]) {
+ case srm_DECCKM:
(*func) (&xw->keyboard.flags, MODE_DECCKM);
update_appcursor();
break;
- case 2: /* DECANM - ANSI/VT52 mode */
+ case srm_DECANM: /* ANSI/VT52 mode */
if (IsSM()) { /* ANSI (VT100) */
/*
* Setting DECANM should have no effect, since this function
@@ -4201,7 +4468,6 @@ dpmodes(XtermWidget xw, BitFunc func)
TRACE(("DECANM terminal_id %d, vtXX_level %d\n",
screen->terminal_id,
screen->vtXX_level));
- screen->vt52_save_level = screen->vtXX_level;
screen->vtXX_level = 0;
screen->vt52_save_curgl = screen->curgl;
screen->vt52_save_curgr = screen->curgr;
@@ -4212,18 +4478,23 @@ dpmodes(XtermWidget xw, BitFunc func)
}
#endif
break;
- case 3: /* DECCOLM */
+ case srm_DECCOLM:
if (screen->c132) {
- ClearScreen(xw);
+ if (!(xw->flags & NOCLEAR_COLM))
+ ClearScreen(xw);
CursorSet(screen, 0, 0, xw->flags);
if ((j = IsSM()? 132 : 80) !=
((xw->flags & IN132COLUMNS) ? 132 : 80) ||
j != MaxCols(screen))
RequestResize(xw, -1, j, True);
(*func) (&xw->flags, IN132COLUMNS);
+ if (xw->flags & IN132COLUMNS) {
+ xw->flags &= ~LEFT_RIGHT;
+ reset_lr_margins(screen);
+ }
}
break;
- case 4: /* DECSCLM (slow scroll) */
+ case srm_DECSCLM: /* (slow scroll) */
if (IsSM()) {
screen->jumpscroll = 0;
if (screen->scroll_amt)
@@ -4233,7 +4504,7 @@ dpmodes(XtermWidget xw, BitFunc func)
(*func) (&xw->flags, SMOOTHSCROLL);
update_jumpscroll();
break;
- case 5: /* DECSCNM */
+ case srm_DECSCNM:
myflags = xw->flags;
(*func) (&xw->flags, REVERSE_VIDEO);
if ((xw->flags ^ myflags) & REVERSE_VIDEO)
@@ -4241,87 +4512,87 @@ dpmodes(XtermWidget xw, BitFunc func)
/* update_reversevideo done in RevVid */
break;
- case 6: /* DECOM */
+ case srm_DECOM:
(*func) (&xw->flags, ORIGIN);
CursorSet(screen, 0, 0, xw->flags);
break;
- case 7: /* DECAWM */
+ case srm_DECAWM:
(*func) (&xw->flags, WRAPAROUND);
update_autowrap();
break;
- case 8: /* DECARM */
+ case srm_DECARM:
/* ignore autorepeat
* XAutoRepeatOn() and XAutoRepeatOff() can do this, but only
* for the whole display - not limited to a given window.
*/
break;
- case SET_X10_MOUSE: /* MIT bogus sequence */
+ case srm_X10_MOUSE: /* MIT bogus sequence */
MotionOff(screen, xw);
set_mousemode(X10_MOUSE);
break;
#if OPT_TOOLBAR
- case 10: /* rxvt */
+ case srm_RXVT_TOOLBAR:
ShowToolbar(IsSM());
break;
#endif
#if OPT_BLINK_CURS
- case 12: /* att610: Start/stop blinking cursor */
+ case srm_ATT610_BLINK: /* att610: Start/stop blinking cursor */
if (screen->cursor_blink_res) {
set_bool_mode(screen->cursor_blink_esc);
- SetCursorBlink(screen, screen->cursor_blink);
+ UpdateCursorBlink(screen);
}
break;
#endif
- case 18: /* DECPFF: print form feed */
+ case srm_DECPFF: /* print form feed */
set_bool_mode(PrinterOf(screen).printer_formfeed);
break;
- case 19: /* DECPEX: print extent */
+ case srm_DECPEX: /* print extent */
set_bool_mode(PrinterOf(screen).printer_extent);
break;
- case 25: /* DECTCEM: Show/hide cursor (VT200) */
+ case srm_DECTCEM: /* Show/hide cursor (VT200) */
set_bool_mode(screen->cursor_set);
break;
- case 30: /* rxvt */
+ case srm_RXVT_SCROLLBAR:
if (screen->fullVwin.sb_info.width != (IsSM()? ON : OFF))
ToggleScrollBar(xw);
break;
#if OPT_SHIFT_FONTS
- case 35: /* rxvt */
+ case srm_RXVT_FONTSIZE:
set_bool_mode(xw->misc.shift_fonts);
break;
#endif
- case 38: /* DECTEK */
#if OPT_TEK4014
+ case srm_DECTEK:
if (IsSM() && !(screen->inhibit & I_TEK)) {
FlushLog(xw);
TEK4014_ACTIVE(xw) = True;
}
-#endif
break;
- case 40: /* 132 column mode */
+#endif
+ case srm_132COLS: /* 132 column mode */
set_bool_mode(screen->c132);
update_allow132();
break;
- case 41: /* curses hack */
+ case srm_CURSES_HACK:
set_bool_mode(screen->curses);
update_cursesemul();
break;
- case 42: /* DECNRCM national charset (VT220) */
+ case srm_DECNRCM: /* national charset (VT220) */
(*func) (&xw->flags, NATIONAL);
break;
- case 44: /* margin bell */
+ case srm_MARGIN_BELL: /* margin bell */
set_bool_mode(screen->marginbell);
if (!screen->marginbell)
screen->bellArmed = -1;
update_marginbell();
break;
- case 45: /* reverse wraparound */
+ case srm_REVERSEWRAP: /* reverse wraparound */
(*func) (&xw->flags, REVERSEWRAP);
update_reversewrap();
break;
#ifdef ALLOWLOGGING
- case 46: /* logging */
+ case srm_ALLOWLOGGING: /* logging */
#ifdef ALLOWLOGFILEONOFF
/*
* if this feature is enabled, logging may be
@@ -4337,7 +4608,7 @@ dpmodes(XtermWidget xw, BitFunc func)
#endif /* ALLOWLOGFILEONOFF */
break;
#endif
- case 1049: /* alternate buffer & cursor */
+ case srm_OPT_ALTBUF_CURSOR: /* alternate buffer & cursor */
if (!xw->misc.titeInhibit) {
if (IsSM()) {
CursorSave(xw);
@@ -4353,9 +4624,9 @@ dpmodes(XtermWidget xw, BitFunc func)
}
}
break;
- case 1047:
+ case srm_OPT_ALTBUF:
/* FALLTHRU */
- case 47: /* alternate buffer */
+ case srm_ALTBUF: /* alternate buffer */
if (!xw->misc.titeInhibit) {
if (IsSM()) {
ToAlternate(xw);
@@ -4371,30 +4642,46 @@ dpmodes(XtermWidget xw, BitFunc func)
}
}
break;
- case 66: /* DECNKM */
+ case srm_DECNKM:
(*func) (&xw->keyboard.flags, MODE_DECKPAM);
update_appkeypad();
break;
- case 67: /* DECBKM */
+ case srm_DECBKM:
/* back-arrow mapped to backspace or delete(D) */
(*func) (&xw->keyboard.flags, MODE_DECBKM);
TRACE(("DECSET DECBKM %s\n",
BtoS(xw->keyboard.flags & MODE_DECBKM)));
update_decbkm();
break;
- case SET_VT200_MOUSE: /* xterm bogus sequence */
+ case srm_DECLRMM:
+ if (screen->terminal_id >= 400) { /* VT420 */
+ (*func) (&xw->flags, LEFT_RIGHT);
+ if (IsLeftRightMode(xw)) {
+ xterm_ResetDouble(xw);
+ } else {
+ reset_lr_margins(screen);
+ }
+ CursorSet(screen, 0, 0, xw->flags);
+ }
+ break;
+ case srm_DECNCSM:
+ if (screen->terminal_id >= 500) { /* VT510 */
+ (*func) (&xw->flags, NOCLEAR_COLM);
+ }
+ break;
+ case srm_VT200_MOUSE: /* xterm bogus sequence */
MotionOff(screen, xw);
set_mousemode(VT200_MOUSE);
break;
- case SET_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */
+ case srm_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */
MotionOff(screen, xw);
set_mousemode(VT200_HIGHLIGHT_MOUSE);
break;
- case SET_BTN_EVENT_MOUSE:
+ case srm_BTN_EVENT_MOUSE:
MotionOff(screen, xw);
set_mousemode(BTN_EVENT_MOUSE);
break;
- case SET_ANY_EVENT_MOUSE:
+ case srm_ANY_EVENT_MOUSE:
set_mousemode(ANY_EVENT_MOUSE);
if (screen->send_mouse_pos == MOUSE_OFF) {
MotionOff(screen, xw);
@@ -4403,15 +4690,15 @@ dpmodes(XtermWidget xw, BitFunc func)
}
break;
#if OPT_FOCUS_EVENT
- case SET_FOCUS_EVENT_MOUSE:
+ case srm_FOCUS_EVENT_MOUSE:
set_bool_mode(screen->send_focus_pos);
break;
#endif
- case SET_EXT_MODE_MOUSE:
+ case srm_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_SGR_EXT_MODE_MOUSE:
+ case srm_SGR_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_URXVT_EXT_MODE_MOUSE:
+ case srm_URXVT_EXT_MODE_MOUSE:
/*
* Rather than choose an arbitrary precedence among the coordinate
* modes, they are mutually exclusive. For consistency, a reset is
@@ -4423,56 +4710,56 @@ dpmodes(XtermWidget xw, BitFunc func)
screen->extend_coords = 0;
}
break;
- case 1010: /* rxvt */
+ case srm_RXVT_SCROLL_TTY_OUTPUT:
set_bool_mode(screen->scrollttyoutput);
update_scrollttyoutput();
break;
- case 1011: /* rxvt */
+ case srm_RXVT_SCROLL_TTY_KEYPRESS:
set_bool_mode(screen->scrollkey);
update_scrollkey();
break;
- case 1034:
+ case srm_EIGHT_BIT_META:
if (screen->eight_bit_meta != ebNever) {
set_bool_mode(screen->eight_bit_meta);
}
break;
#if OPT_NUM_LOCK
- case 1035:
+ case srm_REAL_NUMLOCK:
set_bool_mode(xw->misc.real_NumLock);
update_num_lock();
break;
- case 1036:
+ case srm_META_SENDS_ESC:
set_bool_mode(screen->meta_sends_esc);
update_meta_esc();
break;
#endif
- case 1037:
+ case srm_DELETE_IS_DEL:
set_bool_mode(screen->delete_is_del);
update_delete_del();
break;
#if OPT_NUM_LOCK
- case 1039:
+ case srm_ALT_SENDS_ESC:
set_bool_mode(screen->alt_sends_esc);
update_alt_esc();
break;
#endif
- case 1040:
+ case srm_KEEP_SELECTION:
set_bool_mode(screen->keepSelection);
update_keepSelection();
break;
- case 1041:
+ case srm_SELECT_TO_CLIPBOARD:
set_bool_mode(screen->selectToClipboard);
update_selectToClipboard();
break;
- case 1042:
+ case srm_BELL_IS_URGENT:
set_bool_mode(screen->bellIsUrgent);
update_bellIsUrgent();
break;
- case 1043:
+ case srm_POP_ON_BELL:
set_bool_mode(screen->poponbell);
update_poponbell();
break;
- case 1048:
+ case srm_TITE_INHIBIT:
if (!xw->misc.titeInhibit) {
if (IsSM())
CursorSave(xw);
@@ -4481,50 +4768,50 @@ dpmodes(XtermWidget xw, BitFunc func)
}
break;
#if OPT_TCAP_FKEYS
- case 1050:
+ case srm_TCAP_FKEYS:
set_keyboard_type(xw, keyboardIsTermcap, IsSM());
break;
#endif
#if OPT_SUN_FUNC_KEYS
- case 1051:
+ case srm_SUN_FKEYS:
set_keyboard_type(xw, keyboardIsSun, IsSM());
break;
#endif
#if OPT_HP_FUNC_KEYS
- case 1052:
+ case srm_HP_FKEYS:
set_keyboard_type(xw, keyboardIsHP, IsSM());
break;
#endif
#if OPT_SCO_FUNC_KEYS
- case 1053:
+ case srm_SCO_FKEYS:
set_keyboard_type(xw, keyboardIsSCO, IsSM());
break;
#endif
- case 1060:
+ case srm_LEGACY_FKEYS:
set_keyboard_type(xw, keyboardIsLegacy, IsSM());
break;
#if OPT_SUNPC_KBD
- case 1061:
+ case srm_VT220_FKEYS:
set_keyboard_type(xw, keyboardIsVT220, IsSM());
break;
#endif
#if OPT_READLINE
- case SET_BUTTON1_MOVE_POINT:
+ case srm_BUTTON1_MOVE_POINT:
set_mouseflag(click1_moves);
break;
- case SET_BUTTON2_MOVE_POINT:
+ case srm_BUTTON2_MOVE_POINT:
set_mouseflag(paste_moves);
break;
- case SET_DBUTTON3_DELETE:
+ case srm_DBUTTON3_DELETE:
set_mouseflag(dclick3_deletes);
break;
- case SET_PASTE_IN_BRACKET:
+ case srm_PASTE_IN_BRACKET:
set_mouseflag(paste_brackets);
break;
- case SET_PASTE_QUOTE:
+ case srm_PASTE_QUOTE:
set_mouseflag(paste_quotes);
break;
- case SET_PASTE_LITERAL_NL:
+ case srm_PASTE_LITERAL_NL:
set_mouseflag(paste_literal_nl);
break;
#endif /* OPT_READLINE */
@@ -4543,118 +4830,208 @@ savemodes(XtermWidget xw)
for (i = 0; i < nparam; i++) {
TRACE(("savemodes %d\n", param[i]));
- switch (param[i]) {
- case 1: /* DECCKM */
+ switch ((DECSET_codes) param[i]) {
+ case srm_DECCKM:
DoSM(DP_DECCKM, xw->keyboard.flags & MODE_DECCKM);
break;
- case 3: /* DECCOLM */
+ case srm_DECANM: /* ANSI/VT52 mode */
+ /* no effect */
+ break;
+ case srm_DECCOLM:
if (screen->c132)
DoSM(DP_DECCOLM, xw->flags & IN132COLUMNS);
break;
- case 4: /* DECSCLM (slow scroll) */
+ case srm_DECSCLM: /* (slow scroll) */
DoSM(DP_DECSCLM, xw->flags & SMOOTHSCROLL);
break;
- case 5: /* DECSCNM */
+ case srm_DECSCNM:
DoSM(DP_DECSCNM, xw->flags & REVERSE_VIDEO);
break;
- case 6: /* DECOM */
+ case srm_DECOM:
DoSM(DP_DECOM, xw->flags & ORIGIN);
break;
- case 7: /* DECAWM */
+ case srm_DECAWM:
DoSM(DP_DECAWM, xw->flags & WRAPAROUND);
break;
- case 8: /* DECARM */
+ case srm_DECARM:
/* ignore autorepeat */
break;
- case SET_X10_MOUSE: /* mouse bogus sequence */
+ case srm_X10_MOUSE: /* mouse bogus sequence */
DoSM(DP_X_X10MSE, screen->send_mouse_pos);
break;
#if OPT_TOOLBAR
- case 10: /* rxvt */
+ case srm_RXVT_TOOLBAR:
DoSM(DP_TOOLBAR, resource.toolBar);
break;
#endif
#if OPT_BLINK_CURS
- case 12: /* att610: Start/stop blinking cursor */
+ case srm_ATT610_BLINK: /* att610: Start/stop blinking cursor */
if (screen->cursor_blink_res) {
DoSM(DP_CRS_BLINK, screen->cursor_blink_esc);
}
break;
#endif
- case 18: /* DECPFF: print form feed */
+ case srm_DECPFF: /* print form feed */
DoSM(DP_PRN_FORMFEED, PrinterOf(screen).printer_formfeed);
break;
- case 19: /* DECPEX: print extent */
+ case srm_DECPEX: /* print extent */
DoSM(DP_PRN_EXTENT, PrinterOf(screen).printer_extent);
break;
- case 25: /* DECTCEM: Show/hide cursor (VT200) */
+ case srm_DECTCEM: /* Show/hide cursor (VT200) */
DoSM(DP_CRS_VISIBLE, screen->cursor_set);
break;
- case 40: /* 132 column mode */
+ case srm_RXVT_SCROLLBAR:
+ DoSM(DP_RXVT_SCROLLBAR, (screen->fullVwin.sb_info.width != 0));
+ break;
+#if OPT_SHIFT_FONTS
+ case srm_RXVT_FONTSIZE:
+ DoSM(DP_RXVT_FONTSIZE, xw->misc.shift_fonts);
+ break;
+#endif
+#if OPT_TEK4014
+ case srm_DECTEK:
+ DoSM(DP_DECTEK, TEK4014_ACTIVE(xw));
+ break;
+#endif
+ case srm_132COLS: /* 132 column mode */
DoSM(DP_X_DECCOLM, screen->c132);
break;
- case 41: /* curses hack */
+ case srm_CURSES_HACK: /* curses hack */
DoSM(DP_X_MORE, screen->curses);
break;
- case 42: /* DECNRCM national charset (VT220) */
- /* do nothing */
+ case srm_DECNRCM: /* national charset (VT220) */
+ DoSM(DP_DECNRCM, xw->flags & NATIONAL);
break;
- case 44: /* margin bell */
+ case srm_MARGIN_BELL: /* margin bell */
DoSM(DP_X_MARGIN, screen->marginbell);
break;
- case 45: /* reverse wraparound */
+ case srm_REVERSEWRAP: /* reverse wraparound */
DoSM(DP_X_REVWRAP, xw->flags & REVERSEWRAP);
break;
#ifdef ALLOWLOGGING
- case 46: /* logging */
+ case srm_ALLOWLOGGING: /* logging */
DoSM(DP_X_LOGGING, screen->logging);
break;
#endif
- case 1047: /* alternate buffer */
+ case srm_OPT_ALTBUF_CURSOR:
/* FALLTHRU */
- case 47: /* alternate buffer */
+ case srm_OPT_ALTBUF:
+ /* FALLTHRU */
+ case srm_ALTBUF: /* alternate buffer */
DoSM(DP_X_ALTSCRN, screen->whichBuf);
break;
- case SET_VT200_MOUSE: /* mouse bogus sequence */
- case SET_VT200_HIGHLIGHT_MOUSE:
- case SET_BTN_EVENT_MOUSE:
- case SET_ANY_EVENT_MOUSE:
+ case srm_DECNKM:
+ DoSM(DP_DECKPAM, xw->keyboard.flags & MODE_DECKPAM);
+ break;
+ case srm_DECBKM:
+ DoSM(DP_DECBKM, xw->keyboard.flags & MODE_DECBKM);
+ break;
+ case srm_DECLRMM: /* left-right */
+ DoSM(DP_X_LRMM, LEFT_RIGHT);
+ break;
+ case srm_DECNCSM: /* noclear */
+ DoSM(DP_X_NCSM, NOCLEAR_COLM);
+ break;
+ case srm_VT200_MOUSE: /* mouse bogus sequence */
+ case srm_VT200_HIGHLIGHT_MOUSE:
+ case srm_BTN_EVENT_MOUSE:
+ case srm_ANY_EVENT_MOUSE:
DoSM(DP_X_MOUSE, screen->send_mouse_pos);
break;
#if OPT_FOCUS_EVENT
- case SET_FOCUS_EVENT_MOUSE:
+ case srm_FOCUS_EVENT_MOUSE:
DoSM(DP_X_FOCUS, screen->send_focus_pos);
break;
#endif
- case SET_EXT_MODE_MOUSE:
+ case srm_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_SGR_EXT_MODE_MOUSE:
+ case srm_SGR_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_URXVT_EXT_MODE_MOUSE:
+ case srm_URXVT_EXT_MODE_MOUSE:
DoSM(DP_X_EXT_MOUSE, screen->extend_coords);
break;
- case 1048:
+ case srm_RXVT_SCROLL_TTY_OUTPUT:
+ DoSM(DP_RXVT_SCROLL_TTY_OUTPUT, screen->scrollttyoutput);
+ break;
+ case srm_RXVT_SCROLL_TTY_KEYPRESS:
+ DoSM(DP_RXVT_SCROLL_TTY_KEYPRESS, screen->scrollkey);
+ break;
+ case srm_EIGHT_BIT_META:
+ DoSM(DP_EIGHT_BIT_META, screen->eight_bit_meta);
+ break;
+#if OPT_NUM_LOCK
+ case srm_REAL_NUMLOCK:
+ DoSM(DP_REAL_NUMLOCK, xw->misc.real_NumLock);
+ break;
+ case srm_META_SENDS_ESC:
+ DoSM(DP_META_SENDS_ESC, screen->meta_sends_esc);
+ break;
+#endif
+ case srm_DELETE_IS_DEL:
+ DoSM(DP_DELETE_IS_DEL, screen->delete_is_del);
+ break;
+#if OPT_NUM_LOCK
+ case srm_ALT_SENDS_ESC:
+ DoSM(DP_ALT_SENDS_ESC, screen->alt_sends_esc);
+ break;
+#endif
+ case srm_KEEP_SELECTION:
+ DoSM(DP_KEEP_SELECTION, screen->keepSelection);
+ break;
+ case srm_SELECT_TO_CLIPBOARD:
+ DoSM(DP_SELECT_TO_CLIPBOARD, screen->selectToClipboard);
+ break;
+ case srm_BELL_IS_URGENT:
+ DoSM(DP_BELL_IS_URGENT, screen->bellIsUrgent);
+ break;
+ case srm_POP_ON_BELL:
+ DoSM(DP_POP_ON_BELL, screen->poponbell);
+ break;
+#if OPT_TCAP_FKEYS
+ case srm_TCAP_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SUN_FUNC_KEYS
+ case srm_SUN_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_HP_FUNC_KEYS
+ case srm_HP_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SCO_FUNC_KEYS
+ case srm_SCO_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SUNPC_KBD
+ case srm_VT220_FKEYS:
+ /* FALLTHRU */
+#endif
+ case srm_LEGACY_FKEYS:
+ DoSM(DP_KEYBOARD_TYPE, xw->keyboard.type);
+ break;
+ case srm_TITE_INHIBIT:
if (!xw->misc.titeInhibit) {
CursorSave(xw);
}
break;
#if OPT_READLINE
- case SET_BUTTON1_MOVE_POINT:
+ case srm_BUTTON1_MOVE_POINT:
SCREEN_FLAG_save(screen, click1_moves);
break;
- case SET_BUTTON2_MOVE_POINT:
+ case srm_BUTTON2_MOVE_POINT:
SCREEN_FLAG_save(screen, paste_moves);
break;
- case SET_DBUTTON3_DELETE:
+ case srm_DBUTTON3_DELETE:
SCREEN_FLAG_save(screen, dclick3_deletes);
break;
- case SET_PASTE_IN_BRACKET:
+ case srm_PASTE_IN_BRACKET:
SCREEN_FLAG_save(screen, paste_brackets);
break;
- case SET_PASTE_QUOTE:
+ case srm_PASTE_QUOTE:
SCREEN_FLAG_save(screen, paste_quotes);
break;
- case SET_PASTE_LITERAL_NL:
+ case srm_PASTE_LITERAL_NL:
SCREEN_FLAG_save(screen, paste_literal_nl);
break;
#endif /* OPT_READLINE */
@@ -4673,15 +5050,19 @@ restoremodes(XtermWidget xw)
for (i = 0; i < nparam; i++) {
TRACE(("restoremodes %d\n", param[i]));
- switch (param[i]) {
- case 1: /* DECCKM */
+ switch ((DECSET_codes) param[i]) {
+ case srm_DECCKM:
bitcpy(&xw->keyboard.flags,
screen->save_modes[DP_DECCKM], MODE_DECCKM);
update_appcursor();
break;
- case 3: /* DECCOLM */
+ case srm_DECANM: /* ANSI/VT52 mode */
+ /* no effect */
+ break;
+ case srm_DECCOLM:
if (screen->c132) {
- ClearScreen(xw);
+ if (!(xw->flags & NOCLEAR_COLM))
+ ClearScreen(xw);
CursorSet(screen, 0, 0, xw->flags);
if ((j = (screen->save_modes[DP_DECCOLM] & IN132COLUMNS)
? 132 : 80) != ((xw->flags & IN132COLUMNS)
@@ -4692,7 +5073,7 @@ restoremodes(XtermWidget xw)
IN132COLUMNS);
}
break;
- case 4: /* DECSCLM (slow scroll) */
+ case srm_DECSCLM: /* (slow scroll) */
if (screen->save_modes[DP_DECSCLM] & SMOOTHSCROLL) {
screen->jumpscroll = 0;
if (screen->scroll_amt)
@@ -4702,70 +5083,95 @@ restoremodes(XtermWidget xw)
bitcpy(&xw->flags, screen->save_modes[DP_DECSCLM], SMOOTHSCROLL);
update_jumpscroll();
break;
- case 5: /* DECSCNM */
+ case srm_DECSCNM:
if ((screen->save_modes[DP_DECSCNM] ^ xw->flags) & REVERSE_VIDEO) {
bitcpy(&xw->flags, screen->save_modes[DP_DECSCNM], REVERSE_VIDEO);
ReverseVideo(xw);
/* update_reversevideo done in RevVid */
}
break;
- case 6: /* DECOM */
+ case srm_DECOM:
bitcpy(&xw->flags, screen->save_modes[DP_DECOM], ORIGIN);
CursorSet(screen, 0, 0, xw->flags);
break;
- case 7: /* DECAWM */
+ case srm_DECAWM:
bitcpy(&xw->flags, screen->save_modes[DP_DECAWM], WRAPAROUND);
update_autowrap();
break;
- case 8: /* DECARM */
+ case srm_DECARM:
/* ignore autorepeat */
break;
- case SET_X10_MOUSE: /* MIT bogus sequence */
+ case srm_X10_MOUSE: /* MIT bogus sequence */
DoRM0(DP_X_X10MSE, screen->send_mouse_pos);
+ really_set_mousemode(xw, screen->send_mouse_pos,
+ screen->send_mouse_pos != MOUSE_OFF);
break;
#if OPT_TOOLBAR
- case 10: /* rxvt */
+ case srm_RXVT_TOOLBAR:
DoRM(DP_TOOLBAR, resource.toolBar);
ShowToolbar(resource.toolBar);
break;
#endif
#if OPT_BLINK_CURS
- case 12: /* att610: Start/stop blinking cursor */
+ case srm_ATT610_BLINK: /* Start/stop blinking cursor */
if (screen->cursor_blink_res) {
DoRM(DP_CRS_BLINK, screen->cursor_blink_esc);
- SetCursorBlink(screen, screen->cursor_blink);
+ UpdateCursorBlink(screen);
}
break;
#endif
- case 18: /* DECPFF: print form feed */
+ case srm_DECPFF: /* print form feed */
DoRM(DP_PRN_FORMFEED, PrinterOf(screen).printer_formfeed);
break;
- case 19: /* DECPEX: print extent */
+ case srm_DECPEX: /* print extent */
DoRM(DP_PRN_EXTENT, PrinterOf(screen).printer_extent);
break;
- case 25: /* DECTCEM: Show/hide cursor (VT200) */
+ case srm_DECTCEM: /* Show/hide cursor (VT200) */
DoRM(DP_CRS_VISIBLE, screen->cursor_set);
break;
- case 40: /* 132 column mode */
+ case srm_RXVT_SCROLLBAR:
+ if ((screen->fullVwin.sb_info.width != 0) !=
+ screen->save_modes[DP_RXVT_SCROLLBAR]) {
+ ToggleScrollBar(xw);
+ }
+ break;
+#if OPT_SHIFT_FONTS
+ case srm_RXVT_FONTSIZE:
+ DoRM(DP_RXVT_FONTSIZE, xw->misc.shift_fonts);
+ break;
+#endif
+#if OPT_TEK4014
+ case srm_DECTEK:
+ if (!(screen->inhibit & I_TEK) &&
+ (TEK4014_ACTIVE(xw) != (Boolean) screen->save_modes[DP_DECTEK])) {
+ FlushLog(xw);
+ TEK4014_ACTIVE(xw) = screen->save_modes[DP_DECTEK];
+ }
+ break;
+#endif
+ case srm_132COLS: /* 132 column mode */
DoRM(DP_X_DECCOLM, screen->c132);
update_allow132();
break;
- case 41: /* curses hack */
+ case srm_CURSES_HACK: /* curses hack */
DoRM(DP_X_MORE, screen->curses);
update_cursesemul();
break;
- case 44: /* margin bell */
+ case srm_DECNRCM: /* national charset (VT220) */
+ bitcpy(&xw->flags, screen->save_modes[DP_DECNRCM], NATIONAL);
+ break;
+ case srm_MARGIN_BELL: /* margin bell */
if ((DoRM(DP_X_MARGIN, screen->marginbell)) == 0)
screen->bellArmed = -1;
update_marginbell();
break;
- case 45: /* reverse wraparound */
+ case srm_REVERSEWRAP: /* reverse wraparound */
bitcpy(&xw->flags, screen->save_modes[DP_X_REVWRAP], REVERSEWRAP);
update_reversewrap();
break;
#ifdef ALLOWLOGGING
- case 46: /* logging */
+ case srm_ALLOWLOGGING: /* logging */
#ifdef ALLOWLOGFILEONOFF
if (screen->save_modes[DP_X_LOGGING])
StartLog(xw);
@@ -4775,9 +5181,11 @@ restoremodes(XtermWidget xw)
/* update_logging done by StartLog and CloseLog */
break;
#endif
- case 1047: /* alternate buffer */
+ case srm_OPT_ALTBUF_CURSOR: /* alternate buffer & cursor */
/* FALLTHRU */
- case 47: /* alternate buffer */
+ case srm_OPT_ALTBUF:
+ /* FALLTHRU */
+ case srm_ALTBUF: /* alternate buffer */
if (!xw->misc.titeInhibit) {
if (screen->save_modes[DP_X_ALTSCRN])
ToAlternate(xw);
@@ -4790,46 +5198,138 @@ restoremodes(XtermWidget xw)
}
}
break;
- case SET_VT200_MOUSE: /* mouse bogus sequence */
- case SET_VT200_HIGHLIGHT_MOUSE:
- case SET_BTN_EVENT_MOUSE:
- case SET_ANY_EVENT_MOUSE:
+ case srm_DECNKM:
+ bitcpy(&xw->flags, screen->save_modes[DP_DECKPAM], MODE_DECKPAM);
+ update_appkeypad();
+ break;
+ case srm_DECBKM:
+ bitcpy(&xw->flags, screen->save_modes[DP_DECBKM], MODE_DECBKM);
+ update_decbkm();
+ break;
+ case srm_DECLRMM: /* left-right */
+ bitcpy(&xw->flags, screen->save_modes[DP_X_LRMM], LEFT_RIGHT);
+ if (IsLeftRightMode(xw)) {
+ xterm_ResetDouble(xw);
+ } else {
+ reset_lr_margins(screen);
+ }
+ CursorSet(screen, 0, 0, xw->flags);
+ break;
+ case srm_DECNCSM: /* noclear */
+ bitcpy(&xw->flags, screen->save_modes[DP_X_NCSM], NOCLEAR_COLM);
+ break;
+ case srm_VT200_MOUSE: /* mouse bogus sequence */
+ case srm_VT200_HIGHLIGHT_MOUSE:
+ case srm_BTN_EVENT_MOUSE:
+ case srm_ANY_EVENT_MOUSE:
DoRM0(DP_X_MOUSE, screen->send_mouse_pos);
+ really_set_mousemode(xw, screen->send_mouse_pos,
+ screen->send_mouse_pos != MOUSE_OFF);
break;
#if OPT_FOCUS_EVENT
- case SET_FOCUS_EVENT_MOUSE:
+ case srm_FOCUS_EVENT_MOUSE:
DoRM(DP_X_FOCUS, screen->send_focus_pos);
break;
#endif
- case SET_EXT_MODE_MOUSE:
+ case srm_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_SGR_EXT_MODE_MOUSE:
+ case srm_SGR_EXT_MODE_MOUSE:
/* FALLTHRU */
- case SET_URXVT_EXT_MODE_MOUSE:
+ case srm_URXVT_EXT_MODE_MOUSE:
DoRM(DP_X_EXT_MOUSE, screen->extend_coords);
break;
- case 1048:
+ case srm_TITE_INHIBIT:
if (!xw->misc.titeInhibit) {
CursorRestore(xw);
}
break;
+ case srm_RXVT_SCROLL_TTY_OUTPUT:
+ DoRM(DP_RXVT_SCROLL_TTY_OUTPUT, screen->scrollttyoutput);
+ update_scrollttyoutput();
+ break;
+ case srm_RXVT_SCROLL_TTY_KEYPRESS:
+ DoRM(DP_RXVT_SCROLL_TTY_KEYPRESS, screen->scrollkey);
+ update_scrollkey();
+ break;
+ case srm_EIGHT_BIT_META:
+ DoRM(DP_EIGHT_BIT_META, screen->eight_bit_meta);
+ break;
+#if OPT_NUM_LOCK
+ case srm_REAL_NUMLOCK:
+ DoRM(DP_REAL_NUMLOCK, xw->misc.real_NumLock);
+ update_num_lock();
+ break;
+ case srm_META_SENDS_ESC:
+ DoRM(DP_META_SENDS_ESC, screen->meta_sends_esc);
+ update_meta_esc();
+ break;
+#endif
+ case srm_DELETE_IS_DEL:
+ DoRM(DP_DELETE_IS_DEL, screen->delete_is_del);
+ update_delete_del();
+ break;
+#if OPT_NUM_LOCK
+ case srm_ALT_SENDS_ESC:
+ DoRM(DP_ALT_SENDS_ESC, screen->alt_sends_esc);
+ update_alt_esc();
+ break;
+#endif
+ case srm_KEEP_SELECTION:
+ DoRM(DP_KEEP_SELECTION, screen->keepSelection);
+ update_keepSelection();
+ break;
+ case srm_SELECT_TO_CLIPBOARD:
+ DoRM(DP_SELECT_TO_CLIPBOARD, screen->selectToClipboard);
+ update_selectToClipboard();
+ break;
+ case srm_BELL_IS_URGENT:
+ DoRM(DP_BELL_IS_URGENT, screen->bellIsUrgent);
+ update_bellIsUrgent();
+ break;
+ case srm_POP_ON_BELL:
+ DoRM(DP_POP_ON_BELL, screen->poponbell);
+ update_poponbell();
+ break;
+#if OPT_TCAP_FKEYS
+ case srm_TCAP_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SUN_FUNC_KEYS
+ case srm_SUN_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_HP_FUNC_KEYS
+ case srm_HP_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SCO_FUNC_KEYS
+ case srm_SCO_FKEYS:
+ /* FALLTHRU */
+#endif
+#if OPT_SUNPC_KBD
+ case srm_VT220_FKEYS:
+ /* FALLTHRU */
+#endif
+ case srm_LEGACY_FKEYS:
+ xw->keyboard.type = (xtermKeyboardType) screen->save_modes[DP_KEYBOARD_TYPE];
+ break;
#if OPT_READLINE
- case SET_BUTTON1_MOVE_POINT:
+ case srm_BUTTON1_MOVE_POINT:
SCREEN_FLAG_restore(screen, click1_moves);
break;
- case SET_BUTTON2_MOVE_POINT:
+ case srm_BUTTON2_MOVE_POINT:
SCREEN_FLAG_restore(screen, paste_moves);
break;
- case SET_DBUTTON3_DELETE:
+ case srm_DBUTTON3_DELETE:
SCREEN_FLAG_restore(screen, dclick3_deletes);
break;
- case SET_PASTE_IN_BRACKET:
+ case srm_PASTE_IN_BRACKET:
SCREEN_FLAG_restore(screen, paste_brackets);
break;
- case SET_PASTE_QUOTE:
+ case srm_PASTE_QUOTE:
SCREEN_FLAG_restore(screen, paste_quotes);
break;
- case SET_PASTE_LITERAL_NL:
+ case srm_PASTE_LITERAL_NL:
SCREEN_FLAG_restore(screen, paste_literal_nl);
break;
#endif /* OPT_READLINE */
@@ -4933,7 +5433,6 @@ report_win_label(XtermWidget xw,
int code,
char *text)
{
- reply.a_type = ANSI_ESC;
unparseputc(xw, ANSI_ESC);
unparseputc(xw, ']');
unparseputc(xw, code);
@@ -5055,7 +5554,7 @@ window_ops(XtermWidget xw)
XGetWindowAttributes(screen->display,
VWindow(screen),
&win_attrs);
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 1;
reply.a_param[0] = (ParmType) ((win_attrs.map_state == IsViewable)
@@ -5073,7 +5572,7 @@ window_ops(XtermWidget xw)
XGetWindowAttributes(screen->display,
WMFrameWindow(xw),
&win_attrs);
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 3;
reply.a_param[0] = 3;
@@ -5091,7 +5590,7 @@ window_ops(XtermWidget xw)
XGetWindowAttributes(screen->display,
VWindow(screen),
&win_attrs);
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 3;
reply.a_param[0] = 4;
@@ -5110,7 +5609,7 @@ window_ops(XtermWidget xw)
case ewGetWinSizeChars: /* Report the text's size in characters */
if (AllowWindowOps(xw, ewGetWinSizeChars)) {
TRACE(("...get window size in characters\n"));
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 3;
reply.a_param[0] = 8;
@@ -5130,7 +5629,7 @@ window_ops(XtermWidget xw)
root_height = 0;
root_width = 0;
}
- reply.a_type = ANSI_CSI;
+ init_reply(ANSI_CSI);
reply.a_pintro = 0;
reply.a_nparam = 3;
reply.a_param[0] = 9;
@@ -5287,9 +5786,20 @@ unparseseq(XtermWidget xw, ANSI * ap)
if (ap->a_pintro != 0)
unparseputc(xw, ap->a_pintro);
for (i = 0; i < ap->a_nparam; ++i) {
- if (i != 0)
- unparseputc(xw, ';');
- unparseputn(xw, (unsigned int) ap->a_param[i]);
+ if (i != 0) {
+ if (ap->a_delim) {
+ unparseputs(xw, ap->a_delim);
+ } else {
+ unparseputc(xw, ';');
+ }
+ }
+ if (ap->a_radix[i]) {
+ char temp[8];
+ sprintf(temp, "%04X", ap->a_param[i] & 0xffff);
+ unparseputs(xw, temp);
+ } else {
+ unparseputn(xw, (unsigned int) ap->a_param[i]);
+ }
}
if ((inters = ap->a_inters) != 0) {
for (i = 3; i >= 0; --i) {
@@ -5298,7 +5808,17 @@ unparseseq(XtermWidget xw, ANSI * ap)
unparseputc(xw, c);
}
}
- unparseputc(xw, (char) ap->a_final);
+ switch (ap->a_type) {
+ case ANSI_DCS:
+ case ANSI_OSC:
+ case ANSI_PM:
+ case ANSI_APC:
+ unparseputc1(xw, ANSI_ST);
+ break;
+ default:
+ unparseputc(xw, (char) ap->a_final);
+ break;
+ }
}
unparse_end(xw);
}
@@ -6697,6 +7217,7 @@ VTInitialize(Widget wrequest,
tblRenderFont, erLast);
if (wnew->misc.render_font == erDefault) {
if (IsEmpty(wnew->misc.face_name)) {
+ free(wnew->misc.face_name);
wnew->misc.face_name = x_strdup(DEFFACENAME_AUTO);
TRACE(("will allow runtime switch to render_font using \"%s\"\n",
wnew->misc.face_name));
@@ -6722,6 +7243,7 @@ VTInitialize(Widget wrequest,
extendedBoolean(request->screen.utf8_fonts_s, tblUtf8Mode, uLast);
VTInitialize_locale(request);
+ init_Bres(screen.normalized_c);
init_Bres(screen.utf8_latin1);
init_Bres(screen.utf8_title);
@@ -6936,8 +7458,8 @@ releaseWindowGCs(XtermWidget xw, VTwin * win)
#define TRACE_FREE_LEAK(name) \
if (name) { \
free((void *) name); \
+ TRACE(("freed " #name ": %p\n", name)); \
name = 0; \
- TRACE(("freed " #name "\n")); \
}
#define FREE_LEAK(name) \
@@ -6992,6 +7514,21 @@ VTDestroy(Widget w GCC_UNUSED)
TRACE_FREE_LEAK(screen->Acolors[n].resource);
}
#endif
+#if OPT_COLOR_RES
+ for (n = 0; n < NCOLORS; n++) {
+ switch (n) {
+#if OPT_TEK4014
+ case TEK_BG:
+ case TEK_FG:
+ case TEK_CURSOR:
+ break;
+#endif
+ default:
+ TRACE_FREE_LEAK(screen->Tcolors[n].resource);
+ break;
+ }
+ }
+#endif
TRACE_FREE_LEAK(screen->save_ptr);
TRACE_FREE_LEAK(screen->saveBuf_data);
TRACE_FREE_LEAK(screen->saveBuf_index);
@@ -7012,6 +7549,9 @@ VTDestroy(Widget w GCC_UNUSED)
TRACE_FREE_LEAK(xw->screen.term_id);
#if OPT_INPUT_METHOD
cleanupInputMethod(xw);
+ TRACE_FREE_LEAK(xw->misc.f_x);
+ TRACE_FREE_LEAK(xw->misc.input_method);
+ TRACE_FREE_LEAK(xw->misc.preedit_type);
#endif
releaseCursorGCs(xw);
releaseWindowGCs(xw, &(screen->fullVwin));
@@ -7053,9 +7593,13 @@ VTDestroy(Widget w GCC_UNUSED)
#endif
/* free things allocated via init_Sres or Init_Sres2 */
+#ifndef NO_ACTIVE_ICON
+ TRACE_FREE_LEAK(screen->icon_fontname);
+#endif
#ifdef ALLOWLOGGING
TRACE_FREE_LEAK(screen->logfile);
#endif
+ TRACE_FREE_LEAK(screen->eight_bit_meta_s);
TRACE_FREE_LEAK(screen->term_id);
TRACE_FREE_LEAK(screen->charClass);
TRACE_FREE_LEAK(screen->answer_back);
@@ -7097,6 +7641,7 @@ VTDestroy(Widget w GCC_UNUSED)
XtFree((char *) (screen->selection_data));
+ TRACE_FREE_LEAK(xtermClassRec.core_class.tm_table);
TRACE_FREE_LEAK(xw->keyboard.extra_translations);
TRACE_FREE_LEAK(xw->keyboard.shell_translations);
TRACE_FREE_LEAK(xw->keyboard.xterm_translations);
@@ -7440,7 +7985,7 @@ VTRealize(Widget w,
set_cur_row(screen, 0);
set_max_col(screen, Width(screen) / screen->fullVwin.f_width - 1);
set_max_row(screen, Height(screen) / screen->fullVwin.f_height - 1);
- set_tb_margins(screen, 0, screen->max_row);
+ reset_margins(screen);
memset(screen->sc, 0, sizeof(screen->sc));
@@ -8374,7 +8919,7 @@ StopBlinking(TScreen * screen)
}
#if OPT_BLINK_TEXT
-static Bool
+Bool
LineHasBlinking(TScreen * screen, LineData * ld)
{
int col;
@@ -8536,7 +9081,7 @@ ReallyReset(XtermWidget xw, Bool full, Bool saved)
screen->cursor_set = ON;
/* reset scrolling region */
- set_tb_margins(screen, 0, screen->max_row);
+ reset_margins(screen);
bitclr(&xw->flags, ORIGIN);
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index d44ab11e7..a47ca557f 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,9 +1,9 @@
-dnl $XTermId: configure.in,v 1.285 2012/01/05 10:27:54 tom Exp $
+dnl $XTermId: configure.in,v 1.286 2012/03/15 00:01:30 tom Exp $
dnl
dnl -----------------------------------------------------------------------------
dnl this file is part of xterm
dnl
-dnl Copyright 1997-2010,2011 by Thomas E. Dickey
+dnl Copyright 1997-2011,2012 by Thomas E. Dickey
dnl
dnl All Rights Reserved
dnl
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index bb96d92c4..44ad73f50 100644
--- a/app/xterm/ctlseqs.ms
+++ b/app/xterm/ctlseqs.ms
@@ -1,9 +1,9 @@
.\"#! troff -ms $1 -*- Nroff -*-
.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.253 2011/12/11 19:18:48 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.264 2012/05/06 20:12:51 tom Exp $
.\"
.\"
-.\" Copyright 1996-2010,2011 by Thomas E. Dickey
+.\" Copyright 1996-2011,2012 by Thomas E. Dickey
.\"
.\" All Rights Reserved
.\"
@@ -115,7 +115,7 @@
.ds T \s\nsTAB\s0
.ds X \s\nsETX\s0
.ds N \s\nsENQ\s0
-.ds e \s\nsETB\s0
+.ds ET \s\nsETB\s0
.ds C \s\nsCAN\s0
.ds S \s\nsSUB\s0
.\" space between chars
@@ -130,7 +130,7 @@
.if \nw>\n([W .nr [W \nw
.nr w \w'\*N'u
.if \nw>\n([W .nr [W \nw
-.nr w \w'\*e'u
+.nr w \w'\*(ET'u
.if \nw>\n([W .nr [W \nw
.nr w \w'\*C'u
.if \nw>\n([W .nr [W \nw
@@ -172,7 +172,7 @@
.[] So \v'-1p'\s\nsSO\s0\v'1p'
.[] Sp \v'-1p'\s\nsSP\s0\v'1p'
.[] Si \v'-1p'\s\nsSI\s0\v'1p'
-.[] Eb \v'-1p'\*e\v'1p'
+.[] Eb \v'-1p'\*(ET\v'1p'
.[] Ca \v'-1p'\*C\v'1p'
.[] Su \v'-1p'\*S\v'1p'
.[] Es \v'-1p'\*E\v'1p'
@@ -249,6 +249,7 @@
.[] b b
.[] c c
.[] d d
+.[] e e
.[] f f
.[] g g
.[] h h
@@ -284,6 +285,8 @@
.ds Pc \fIP\v'.3m'\h'-.2m'\s-2c\s0\v'-.3m'\fP
.ds Pd \fIP\v'.3m'\h'-.2m'\s-2d\s0\v'-.3m'\fP
.ds Pe \fIP\v'.3m'\h'-.2m'\s-2e\s0\v'-.3m'\fP
+.ds Pg \fIP\v'.3m'\h'-.2m'\s-2g\s0\v'-.3m'\fP
+.ds Pi \fIP\v'.3m'\h'-.2m'\s-2i\s0\v'-.3m'\fP
.ds Pl \fIP\v'.3m'\h'-.2m'\s-2l\s0\v'-.3m'\fP
.ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP
.ds Pn \fIP\v'.3m'\h'-.2m'\s-2n\s0\v'-.3m'\fP
@@ -318,7 +321,7 @@ X Consortium (1994)
Thomas Dickey
.AI
XFree86 Project (1996-2006)
-invisible-island.net (2006-2011)
+invisible-island.net (2006-2012)
.AU
.
.am BT \" add page numbers after first page
@@ -385,7 +388,8 @@ These control characters are used in the vtXXX emulation.
.Sh "VT100 Mode"
.LP
Most of these control sequences are standard VT102 control sequences,
-but there is support for later DEC VT terminals (i.e., VT220, VT320, VT420),
+but there is support for later DEC VT terminals
+(i.e., VT220, VT320, VT420, VT510),
as well as ISO 6429 and \fIaixterm\fP color controls.
The only VT102 feature not supported is auto-repeat,
since the only way X provides for this will affect all windows.
@@ -619,6 +623,7 @@ The string following the "q" is one of the following:
\*(c"\*p \(-> DECSCL
\*r \(-> DECSTBM
\*m \(-> SGR
+ \*(Sp\*q \(-> DECSCUSR
.br
\fIxterm\fP responds with
\*(Dc\*1\*$\*r\*(Pt\*s\*(ST
@@ -756,6 +761,9 @@ Cursor Backward Tabulation \*(Ps tab stops (default = 1) (CBT).
.IP \\*(Cs\\*(Pm\\*s\\*`
Character Position Absolute [column] (default = [row,1]) (HPA).
.
+.IP \\*(Cs\\*(Pm\\*s\\*a
+Character Position Relative [columns] (default = [row,col+1]) (HPR).
+.
.IP \\*(Cs\\*(Ps\\*s\\*b
Repeat the preceding graphic character \*(Ps times (REP).
.
@@ -798,6 +806,9 @@ registration number and is always zero.
.IP \\*(Cs\\*(Pm\\*s\\*d
Line Position Absolute [row] (default = [1,column]) (VPA).
.
+.IP \\*(Cs\\*(Pm\\*s\\*e
+Line Position Relative [rows] (default = [row+1,column]) (VPR).
+.
.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*f
Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP).
.
@@ -845,14 +856,18 @@ This is normally disabled by a compile-time option.
disabled by the \fBtiteInhibit\fP resource).
\*(Ps = \*6\*6 \(-> Application keypad (DECNKM).
\*(Ps = \*6\*7 \(-> Backarrow key sends backspace (DECBKM).
+ \*(Ps = \*6\*9 \(-> Enable left and right margin mode (DECLRMM), VT420 and up.
+ \*(Ps = \*9\*5 \(-> Do not clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up.
\*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release.
See the section \fBMouse Tracking\fP.
\*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking.
\*(Ps = \*1\*0\*0\*2 \(-> Use Cell Motion Mouse Tracking.
\*(Ps = \*1\*0\*0\*3 \(-> Use All Motion Mouse Tracking.
\*(Ps = \*1\*0\*0\*4 \(-> Send FocusIn/FocusOut events.
- \*(Ps = \*1\*0\*0\*5 \(-> Enable Extended Mouse Mode.
+ \*(Ps = \*1\*0\*0\*5 \(-> Enable UTF-8 Mouse Mode.
+ \*(Ps = \*1\*0\*0\*6 \(-> Enable SGR Mouse Mode.
\*(Ps = \*1\*0\*1\*0 \(-> Scroll to bottom on tty output (rxvt).
+ \*(Ps = \*1\*0\*1\*5 \(-> Enable urxvt Mouse Mode.
\*(Ps = \*1\*0\*1\*1 \(-> Scroll to bottom on key press (rxvt).
\*(Ps = \*1\*0\*3\*4 \(-> Interpret "meta" key, sets eighth bit.
(enables the \fBeightBitInput\fP resource).
@@ -937,6 +952,8 @@ DEC Private Mode Reset (DECRST).
\*(Ps = \*4\*7 \(-> Use Normal Screen Buffer.
\*(Ps = \*6\*6 \(-> Numeric keypad (DECNKM).
\*(Ps = \*6\*7 \(-> Backarrow key sends delete (DECBKM).
+ \*(Ps = \*6\*9 \(-> Disable left and right margin mode (DECLRMM), VT420 and up.
+ \*(Ps = \*9\*5 \(-> Clear screen when DECCOLM is set/reset (DECNCSM), VT510 and up.
\*(Ps = \*1\*0\*0\*0 \(-> Don't send Mouse X & Y on button press and
release.
See the section \fBMouse Tracking\fP.
@@ -944,8 +961,10 @@ See the section \fBMouse Tracking\fP.
\*(Ps = \*1\*0\*0\*2 \(-> Don't use Cell Motion Mouse Tracking.
\*(Ps = \*1\*0\*0\*3 \(-> Don't use All Motion Mouse Tracking.
\*(Ps = \*1\*0\*0\*4 \(-> Don't send FocusIn/FocusOut events.
- \*(Ps = \*1\*0\*0\*5 \(-> Disable Extended Mouse Mode.
+ \*(Ps = \*1\*0\*0\*5 \(-> Disable UTF-8 Mouse Mode.
+ \*(Ps = \*1\*0\*0\*6 \(-> Disable SGR Mouse Mode.
\*(Ps = \*1\*0\*1\*0 \(-> Don't scroll to bottom on tty output (rxvt).
+ \*(Ps = \*1\*0\*1\*5 \(-> Disable urxvt Mouse Mode.
\*(Ps = \*1\*0\*1\*1 \(-> Don't scroll to bottom on key press (rxvt).
\*(Ps = \*1\*0\*3\*4 \(-> Don't interpret "meta" key.
(This disables the \fBeightBitInput\fP resource).
@@ -1083,27 +1102,36 @@ than adding a parameter to each function key to denote the modifiers.
.
.IP \\*(Cs\\*?\\*(Ps\\*s\\*n
Device Status Report (DSR, DEC-specific).
- \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
+ \*(Ps = \*6 \(-> Report Cursor Position (DECXCPR) [row;column] as
\*(Cs\*?\*(Ir\*s\*;\*(Ic\*s\*R
-(assumes page is zero).
+(assumes the default page, i.e., "1").
\*(Ps = \*1\*5 \(-> Report Printer status as
-\*(Cs\*?\*1\*0\*s\*n (ready).
+\*(Cs\*?\*1\*0\*n (ready).
or
-\*(Cs\*?\*1\*1\*s\*n (not ready).
+\*(Cs\*?\*1\*1\*n (not ready).
\*(Ps = \*2\*5 \(-> Report UDK status as
-\*(Cs\*?\*2\*0\*s\*n (unlocked)
+\*(Cs\*?\*2\*0\*n (unlocked)
or
-\*(Cs\*?\*2\*1\*s\*n (locked).
+\*(Cs\*?\*2\*1\*n (locked).
\*(Ps = \*2\*6 \(-> Report Keyboard status as
.br
-\*(Cs\*?\*2\*7\*s\*;\*s\*1\*s\*;\*s\*0\*s\*;\*s\*0\*s\*n (North American).
+\*(Cs\*?\*2\*7\*;\*1\*;\*0\*;\*0\*n (North American).
.br
The last two parameters apply to VT400 & up, and denote keyboard ready and LK01 respectively.
\*(Ps = \*5\*3 \(-> Report Locator status as
+\*(Cs\*?\*5\*3\*n Locator available, if compiled-in, or
+\*(Cs\*?\*5\*0\*n No Locator, if not.
+ \*(Ps = \*6\*2 \(-> Report macro space (DECMSR) as
+\*(Cs\*(Pn\*s\\*\*s\*{
+ \*(Ps = \*6\*3 \(-> Report memory checksum (DECCKSR) as
+\*(Dc\*(Pt\*s\*!x\*sx\*sx\*sx\*s\*(ST
.br
-\*(Cs\*?\*5\*3\*s\*n Locator available, if compiled-in, or
-.br
-\*(Cs\*?\*5\*0\*s\*n No Locator, if not.
+ \*(Pt is the request id (from an optional parameter to the request).
+ The x's are hexadecimal digits 0-9 and A-F.
+ \*(Ps = \*7\*5 \(-> Report data integrity as
+\*(Cs\*?\*7\*0\*n (ready, no errors)
+ \*(Ps = \*8\*5 \(-> Report multi-session configuration as
+\*(Cs\*?\*8\*3\*n (not configured for multiple-session operation).
.
.IP \\*(Cs\\*>\\*(Ps\\*s\\*p
Set resource value \fIpointerMode\fP.
@@ -1119,7 +1147,7 @@ which is \*1.
.IP \\*(Cs\\*!\\*p
Soft terminal reset (DECSTR).
.
-.IP \\*(Cs\\*(Ps\\*$\\*p
+.IP \\*(Cs\\*(Ps\\*s\\*$\\*p
.br
Request ANSI mode (DECRQM).
For VT300 and up, reply is
@@ -1194,8 +1222,11 @@ Change Attributes in Rectangular Area (DECCARA), VT400 and up.
\*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle.
\*(Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
.
+.IP \\*(Cs\\*s\\*(Pl\\*s\\*;\\*(Pr\\*s\\*(cs
+Set left and right margins (DECSLRM), available only when DECLRMM is enabled (VT420 and up).
+.
.IP \\*(Cs\\*(cs
-Save cursor (ANSI.SYS).
+Save cursor (ANSI.SYS), available only when DECLRMM is disabled.
.
.IP \\*(Cs\\*?\\*(Pm\\*s\\*(cs
Save DEC Private Mode Values.
@@ -1307,13 +1338,24 @@ whose parameters describe the terminal:
\*(Pn = \*1 \(<- clock multiplier.
\*(Pn = \*0 \(<- STP flags.
.
-.IP \\*(Cs\\*(Ps\\*s\\*x
+.IP \\*(Cs\\*(Ps\\*s\\**\\*x
Select Attribute Change Extent (DECSACE).
\*(Ps = \*0 \(-> from start to end position, wrapped.
\*(Ps = \*1 \(-> from start to end position, wrapped.
\*(Ps = \*2 \(-> rectangle (exact).
.
-.IP \\*(Cs\\*(Pc\\*;\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*$\\*x
+.IP \\*(Cs\\*(Pi\\*s\\*;\\*(Pg\\*s\\*;\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*s\\**\\*y
+Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
+Response is
+.br
+\*(Dc\*(Pt\*s\*!x\*sx\*sx\*sx\*s\*(ST
+.br
+ \*(Pi is the request id.
+ \*(Pg is the page number.
+ \*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle.
+ The x's are hexadecimal digits 0-9 and A-F.
+.
+.IP \\*(Cs\\*(Pc\\*s\\*;\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*$\\*x
Fill Rectangular Area (DECFRA), VT420 and up.
\*(Pc is the character to use.
\*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle.
@@ -1342,13 +1384,14 @@ Select Locator Events (DECSLE).
.br
Valid values for the first (and any additional parameters) are:
\*(Ps = \*0 \(-> only respond to explicit host requests (DECRQLP).
- (This is default). It also cancels any filter rectangle.
+ (This is default). It also cancels any filter
+ rectangle.
\*(Ps = \*1 \(-> report button down transitions.
\*(Ps = \*2 \(-> do not report button down transitions.
\*(Ps = \*3 \(-> report button up transitions.
\*(Ps = \*4 \(-> do not report button up transitions.
.
-.IP \\*(Cs\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*$\\*{
+.IP \\*(Cs\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*s\\*$\\*{
Selective Erase Rectangular Area (DECSERA), VT400 and up.
\*(Pt\*;\*(Pl\*;\*(Pb\*;\*(Pr denotes the rectangle.
.
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index 9dd945c98..b3af60d41 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -9,6 +9,7 @@
Xterm Control Sequences
+
Edward Moy
University of California, Berkeley
@@ -19,7 +20,7 @@
Thomas Dickey
XFree86 Project (1996-2006)
- invisible-island.net (2006-2011)
+ invisible-island.net (2006-2012)
@@ -85,14 +86,14 @@ These control characters are used in the vtXXX emulation.
VT100 Mode
Most of these control sequences are standard VT102 control sequences,
but there is support for later DEC VT terminals (i.e., VT220, VT320,
-VT420), as well as ISO 6429 and aixterm color controls. The only VT102
-feature not supported is auto-repeat, since the only way X provides for
-this will affect all windows. There are additional control sequences to
-provide xterm-dependent functions, such as the scrollbar or window size.
-Where the function is specified by DEC or ISO 6429, the code assigned to
-it is given in parentheses. The escape codes to designate and invoke
-character sets are specified by ISO 2022; see that document for a dis-
-cussion of character sets.
+VT420, VT510), as well as ISO 6429 and aixterm color controls. The only
+VT102 feature not supported is auto-repeat, since the only way X pro-
+vides for this will affect all windows. There are additional control
+sequences to provide xterm-dependent functions, such as the scrollbar or
+window size. Where the function is specified by DEC or ISO 6429, the
+code assigned to it is given in parentheses. The escape codes to desig-
+nate and invoke character sets are specified by ISO 2022; see that docu-
+ment for a discussion of character sets.
Single-character functions
BEL Bell (Ctrl-G).
@@ -197,6 +198,7 @@ DCS $ q Pt ST
" p -> DECSCL
r -> DECSTBM
m -> SGR
+ SP q -> DECSCUSR
xterm responds with DCS 1 $ r Pt ST for valid requests,
replacing the Pt with the corresponding CSI string, or DCS 0 $
r Pt ST for invalid requests.
@@ -208,8 +210,8 @@ DCS + p Pt ST
as by the Request Termcap/Terminfo String control.
DCS + q Pt ST
Request Termcap/Terminfo String (xterm, experimental). The
- string following the "q" is a list of names encoded in hex-
- adecimal (2 digits per character) separated by ; which corre-
+ string following the "q" is a list of names encoded in hexa-
+ decimal (2 digits per character) separated by ; which corre-
spond to termcap or terminfo key names.
Two special features are also recognized, which are not key
names: Co for termcap colors (or colors for terminfo colors),
@@ -275,6 +277,8 @@ CSI Ps X Erase Ps Character(s) (default = 1) (ECH).
CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
CSI Pm ` Character Position Absolute [column] (default = [row,1])
(HPA).
+CSI Pm a Character Position Relative [columns] (default = [row,col+1])
+ (HPR).
CSI Ps b Repeat the preceding graphic character Ps times (REP).
CSI Ps c Send Device Attributes (Primary DA).
Ps = 0 or omitted -> request attributes from terminal. The
@@ -309,6 +313,8 @@ CSI > Ps c
nal, Pc indicates the ROM cartridge registration number and is
always zero.
CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA).
+CSI Pm e Line Position Relative [rows] (default = [row+1,column])
+ (VPR).
CSI Ps ; Ps f
Horizontal and Vertical Position [row;column] (default =
[1,1]) (HVP).
@@ -353,14 +359,20 @@ CSI ? Pm h
abled by the titeInhibit resource).
Ps = 6 6 -> Application keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends backspace (DECBKM).
+ Ps = 6 9 -> Enable left and right margin mode (DECLRMM),
+ VT420 and up.
+ Ps = 9 5 -> Do not clear screen when DECCOLM is set/reset
+ (DECNCSM), VT510 and up.
Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Send FocusIn/FocusOut events.
- Ps = 1 0 0 5 -> Enable Extended Mouse Mode.
+ Ps = 1 0 0 5 -> Enable UTF-8 Mouse Mode.
+ Ps = 1 0 0 6 -> Enable SGR Mouse Mode.
Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
+ Ps = 1 0 1 5 -> Enable urxvt Mouse Mode.
Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit.
(enables the eightBitInput resource).
@@ -442,15 +454,21 @@ CSI ? Pm l
Ps = 4 7 -> Use Normal Screen Buffer.
Ps = 6 6 -> Numeric keypad (DECNKM).
Ps = 6 7 -> Backarrow key sends delete (DECBKM).
+ Ps = 6 9 -> Disable left and right margin mode (DECLRMM),
+ VT420 and up.
+ Ps = 9 5 -> Clear screen when DECCOLM is set/reset (DEC-
+ NCSM), VT510 and up.
Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and
release. See the section Mouse Tracking.
Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking.
Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking.
Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking.
Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events.
- Ps = 1 0 0 5 -> Disable Extended Mouse Mode.
+ Ps = 1 0 0 5 -> Disable UTF-8 Mouse Mode.
+ Ps = 1 0 0 6 -> Disable SGR Mouse Mode.
Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
(rxvt).
+ Ps = 1 0 1 5 -> Disable urxvt Mouse Mode.
Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).
Ps = 1 0 3 4 -> Don't interpret "meta" key. (This disables
the eightBitInput resource).
@@ -584,19 +602,28 @@ CSI > Ps n
fiers.
CSI ? Ps n
Device Status Report (DSR, DEC-specific).
- Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI
- ? r ; c R (assumes page is zero).
- Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).
- or CSI ? 1 1 n (not ready).
- Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked)
- or CSI ? 2 1 n (locked).
+ Ps = 6 -> Report Cursor Position (DECXCPR) [row;column] as
+ CSI ? r ; c R (assumes the default page, i.e., "1").
+ Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).
+ or CSI ? 1 1 n (not ready).
+ Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked) or
+ CSI ? 2 1 n (locked).
Ps = 2 6 -> Report Keyboard status as
- CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).
+ CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).
The last two parameters apply to VT400 & up, and denote key-
board ready and LK01 respectively.
- Ps = 5 3 -> Report Locator status as
- CSI ? 5 3 n Locator available, if compiled-in, or
- CSI ? 5 0 n No Locator, if not.
+ Ps = 5 3 -> Report Locator status as CSI ? 5 3 n Locator
+ available, if compiled-in, or CSI ? 5 0 n No Locator, if not.
+ Ps = 6 2 -> Report macro space (DECMSR) as CSI Pn \* {
+ Ps = 6 3 -> Report memory checksum (DECCKSR) as DCS Pt ! x
+ x x x ST
+ Pt is the request id (from an optional parameter to the
+ request).
+ The x's are hexadecimal digits 0-9 and A-F.
+ Ps = 7 5 -> Report data integrity as CSI ? 7 0 n (ready,
+ no errors)
+ Ps = 8 5 -> Report multi-session configuration as CSI ? 8 3
+ n (not configured for multiple-session operation).
CSI > Ps p
Set resource value pointerMode. This is used by xterm to
decide whether to hide the pointer cursor as the user types.
@@ -606,7 +633,7 @@ CSI > Ps p
Ps = 2 -> always hide the pointer. If no parameter is
given, xterm uses the default, which is 1 .
CSI ! p Soft terminal reset (DECSTR).
-CSI Ps$ p
+CSI Ps $ p
Request ANSI mode (DECRQM). For VT300 and up, reply is
CSI Ps; Pm$ y
where Ps is the mode number as in RM, and Pm is the mode
@@ -662,7 +689,11 @@ CSI Pt; Pl; Pb; Pr; Ps$ r
Change Attributes in Rectangular Area (DECCARA), VT400 and up.
Pt; Pl; Pb; Pr denotes the rectangle.
Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
-CSI s Save cursor (ANSI.SYS).
+CSI Pl ; Pr s
+ Set left and right margins (DECSLRM), available only when
+ DECLRMM is enabled (VT420 and up).
+CSI s Save cursor (ANSI.SYS), available only when DECLRMM is dis-
+ abled.
CSI ? Pm s
Save DEC Private Mode Values. Ps values are the same as for
DECSET.
@@ -768,11 +799,20 @@ CSI Ps x Request Terminal Parameters (DECREQTPARM).
Pn = 1 <- 2 8 receive 38.4k baud.
Pn = 1 <- clock multiplier.
Pn = 0 <- STP flags.
-CSI Ps x Select Attribute Change Extent (DECSACE).
+CSI Ps * x
+ Select Attribute Change Extent (DECSACE).
Ps = 0 -> from start to end position, wrapped.
Ps = 1 -> from start to end position, wrapped.
Ps = 2 -> rectangle (exact).
-CSI Pc; Pt; Pl; Pb; Pr$ x
+CSI Pi ; Pg ; Pt; Pl; Pb; Pr * y
+ Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
+ Response is
+ DCS Pt ! x x x x ST
+ Pi is the request id.
+ Pg is the page number.
+ Pt; Pl; Pb; Pr denotes the rectangle.
+ The x's are hexadecimal digits 0-9 and A-F.
+CSI Pc ; Pt ; Pl ; Pb ; Pr $ x
Fill Rectangular Area (DECFRA), VT420 and up.
Pc is the character to use.
Pt; Pl; Pb; Pr denotes the rectangle.
@@ -797,12 +837,12 @@ CSI Pm ' {
are:
Ps = 0 -> only respond to explicit host requests (DECRQLP).
(This is default). It also cancels any filter
- rectangle.
+ rectangle.
Ps = 1 -> report button down transitions.
Ps = 2 -> do not report button down transitions.
Ps = 3 -> report button up transitions.
Ps = 4 -> do not report button up transitions.
-CSI Pt; Pl; Pb; Pr$ {
+CSI Pt; Pl; Pb; Pr $ {
Selective Erase Rectangular Area (DECSERA), VT400 and up.
Pt; Pl; Pb; Pr denotes the rectangle.
CSI Ps ' |
diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c
index e25a9f801..c5b531da8 100644
--- a/app/xterm/cursor.c
+++ b/app/xterm/cursor.c
@@ -1,7 +1,7 @@
-/* $XTermId: cursor.c,v 1.55 2010/04/17 17:12:01 tom Exp $ */
+/* $XTermId: cursor.c,v 1.66 2012/05/02 13:36:51 tom Exp $ */
/*
- * Copyright 2002-2009,2010 by Thomas E. Dickey
+ * Copyright 2002-2010,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -68,23 +68,32 @@ void
CursorSet(TScreen * screen, int row, int col, unsigned flags)
{
int use_row = row;
- int max_row;
+ int use_col = col;
+ int max_col = screen->max_col;
+ int max_row = screen->max_row;
+
+ if (flags & ORIGIN) {
+ use_col += screen->lft_marg;
+ max_col = screen->rgt_marg;
+ }
+ use_col = (use_col < 0 ? 0 : use_col);
+ set_cur_col(screen, (use_col <= max_col ? use_col : max_col));
- col = (col < 0 ? 0 : col);
- set_cur_col(screen, (col <= screen->max_col ? col : screen->max_col));
- max_row = screen->max_row;
if (flags & ORIGIN) {
use_row += screen->top_marg;
max_row = screen->bot_marg;
}
use_row = (use_row < 0 ? 0 : use_row);
set_cur_row(screen, (use_row <= max_row ? use_row : max_row));
+
screen->do_wrap = False;
- TRACE(("CursorSet(%d,%d) margins [%d..%d] -> %d,%d %s\n",
+ TRACE(("CursorSet(%d,%d) margins V[%d..%d] H[%d..%d] -> %d,%d %s\n",
row, col,
screen->top_marg,
screen->bot_marg,
+ screen->lft_marg,
+ screen->rgt_marg,
screen->cur_row,
screen->cur_col,
(flags & ORIGIN ? "origin" : "normal")));
@@ -96,25 +105,34 @@ CursorSet(TScreen * screen, int row, int col, unsigned flags)
void
CursorBack(XtermWidget xw, int n)
{
+#define WRAP_MASK (REVERSEWRAP | WRAPAROUND)
TScreen *screen = TScreenOf(xw);
- int i, j, k, rev;
+ int offset, in_row, length, rev;
+ int left = ScrnLeftMargin(xw);
+ int before = screen->cur_col;
- if ((rev = (xw->flags & (REVERSEWRAP | WRAPAROUND)) ==
- (REVERSEWRAP | WRAPAROUND)) != 0
- && screen->do_wrap)
+ if ((rev = (xw->flags & WRAP_MASK) == WRAP_MASK) != 0
+ && screen->do_wrap) {
n--;
- if ((screen->cur_col -= n) < 0) {
+ }
+
+ /* if the cursor is already before the left-margin, we have to let it go */
+ if (before < left)
+ left = 0;
+
+ if ((screen->cur_col -= n) < left) {
if (rev) {
- if ((i = ((j = MaxCols(screen))
- * screen->cur_row) + screen->cur_col) < 0) {
- k = j * MaxRows(screen);
- i += ((-i) / k + 1) * k;
+ in_row = ScrnRightMargin(xw) - left + 1;
+ offset = (in_row * screen->cur_row) + screen->cur_col - left;
+ if (offset < 0) {
+ length = in_row * MaxRows(screen);
+ offset += ((-offset) / length + 1) * length;
}
- set_cur_row(screen, i / j);
- set_cur_col(screen, i % j);
+ set_cur_row(screen, (offset / in_row));
+ set_cur_col(screen, (offset % in_row) + left);
do_xevents();
} else {
- set_cur_col(screen, 0);
+ set_cur_col(screen, left);
}
}
screen->do_wrap = False;
@@ -124,13 +142,22 @@ CursorBack(XtermWidget xw, int n)
* moves the cursor forward n, no wraparound
*/
void
-CursorForward(TScreen * screen, int n)
+CursorForward(XtermWidget xw, int n)
{
+ TScreen *screen = TScreenOf(xw);
#if OPT_DEC_CHRSET
LineData *ld = getLineData(screen, screen->cur_row);
#endif
int next = screen->cur_col + n;
- int max = LineMaxCol(screen, ld);
+ int max;
+
+ if (IsLeftRightMode(xw)) {
+ max = screen->rgt_marg;
+ if (screen->cur_col > max)
+ max = screen->max_col;
+ } else {
+ max = LineMaxCol(screen, ld);
+ }
if (next > max)
next = max;
@@ -197,13 +224,14 @@ xtermIndex(XtermWidget xw, int amount)
* if cursor high enough, no scrolling necessary.
*/
if (screen->cur_row > screen->bot_marg
- || screen->cur_row + amount <= screen->bot_marg) {
+ || screen->cur_row + amount <= screen->bot_marg
+ || (IsLeftRightMode(xw)
+ && !ScrnIsColInMargins(screen, screen->cur_col))) {
CursorDown(screen, amount);
- return;
+ } else {
+ CursorDown(screen, j = screen->bot_marg - screen->cur_row);
+ xtermScroll(xw, amount - j);
}
-
- CursorDown(screen, j = screen->bot_marg - screen->cur_row);
- xtermScroll(xw, amount - j);
}
/*
@@ -220,13 +248,14 @@ RevIndex(XtermWidget xw, int amount)
* if cursor low enough, no reverse indexing needed
*/
if (screen->cur_row < screen->top_marg
- || screen->cur_row - amount >= screen->top_marg) {
+ || screen->cur_row - amount >= screen->top_marg
+ || (IsLeftRightMode(xw)
+ && !ScrnIsColInMargins(screen, screen->cur_col))) {
CursorUp(screen, amount);
- return;
+ } else {
+ RevScroll(xw, amount - (screen->cur_row - screen->top_marg));
+ CursorUp(screen, screen->cur_row - screen->top_marg);
}
-
- RevScroll(xw, amount - (screen->cur_row - screen->top_marg));
- CursorUp(screen, screen->cur_row - screen->top_marg);
}
/*
@@ -234,9 +263,26 @@ RevIndex(XtermWidget xw, int amount)
* (Note: xterm doesn't implement SLH, SLL which would affect use of this)
*/
void
-CarriageReturn(TScreen * screen)
+CarriageReturn(XtermWidget xw)
{
- set_cur_col(screen, 0);
+ TScreen *screen = TScreenOf(xw);
+ int left = ScrnLeftMargin(xw);
+ int col;
+
+ if (xw->flags & ORIGIN) {
+ col = left;
+ } else if (screen->cur_col > left) {
+ col = left;
+ } else {
+ /*
+ * If origin-mode is not active, it is possible to use cursor
+ * addressing outside the margins. In that case we will go to the
+ * first column rather than following the margin.
+ */
+ col = 0;
+ }
+
+ set_cur_col(screen, col);
screen->do_wrap = False;
do_xevents();
}
@@ -330,10 +376,12 @@ CursorRestore(XtermWidget xw)
* Move the cursor to the first column of the n-th next line.
*/
void
-CursorNextLine(TScreen * screen, int count)
+CursorNextLine(XtermWidget xw, int count)
{
+ TScreen *screen = TScreenOf(xw);
+
CursorDown(screen, count < 1 ? 1 : count);
- CarriageReturn(screen);
+ CarriageReturn(xw);
do_xevents();
}
@@ -341,13 +389,45 @@ CursorNextLine(TScreen * screen, int count)
* Move the cursor to the first column of the n-th previous line.
*/
void
-CursorPrevLine(TScreen * screen, int count)
+CursorPrevLine(XtermWidget xw, int count)
{
+ TScreen *screen = TScreenOf(xw);
+
CursorUp(screen, count < 1 ? 1 : count);
- CarriageReturn(screen);
+ CarriageReturn(xw);
do_xevents();
}
+/*
+ * Return col/row values which can be passed to CursorSet() preserving the
+ * current col/row, e.g., accounting for DECOM.
+ */
+int
+CursorCol(XtermWidget xw)
+{
+ TScreen *screen = TScreenOf(xw);
+ int result = screen->cur_col;
+ if (xw->flags & ORIGIN) {
+ result -= ScrnLeftMargin(xw);
+ if (result < 0)
+ result = 0;
+ }
+ return result;
+}
+
+int
+CursorRow(XtermWidget xw)
+{
+ TScreen *screen = TScreenOf(xw);
+ int result = screen->cur_row;
+ if (xw->flags & ORIGIN) {
+ result -= screen->top_marg;
+ if (result < 0)
+ result = 0;
+ }
+ return result;
+}
+
#if OPT_TRACE
int
set_cur_row(TScreen * screen, int value)
diff --git a/app/xterm/data.h b/app/xterm/data.h
index 78ca72a1e..14e729a8e 100644
--- a/app/xterm/data.h
+++ b/app/xterm/data.h
@@ -1,7 +1,7 @@
-/* $XTermId: data.h,v 1.119 2011/07/12 08:37:24 tom Exp $ */
+/* $XTermId: data.h,v 1.120 2012/03/26 21:48:09 tom Exp $ */
/*
- * Copyright 2002-2009,2011 by Thomas E. Dickey
+ * Copyright 2002-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -192,6 +192,7 @@ typedef struct XTERM_RESOURCE {
Boolean useInsertMode;
#if OPT_ZICONBEEP
int zIconBeep; /* beep level when output while iconified */
+ char *zIconFormat; /* format for icon name */
#endif
#if OPT_PTY_HANDSHAKE
Boolean wait_for_map;
diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c
index bff770150..3c13ef01a 100644
--- a/app/xterm/doublechr.c
+++ b/app/xterm/doublechr.c
@@ -1,7 +1,7 @@
-/* $XTermId: doublechr.c,v 1.76 2011/09/11 14:59:40 tom Exp $ */
+/* $XTermId: doublechr.c,v 1.81 2012/04/15 23:39:53 tom Exp $ */
/*
- * Copyright 1997-2010,2011 by Thomas E. Dickey
+ * Copyright 1997-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -60,7 +60,8 @@ repaint_line(XtermWidget xw, unsigned newChrSet)
/*
* Ignore repetition.
*/
- if ((ld = getLineData(screen, currow)) != 0) {
+ if (!IsLeftRightMode(xw)
+ && (ld = getLineData(screen, currow)) != 0) {
unsigned oldChrSet = GetLineDblCS(ld);
if (oldChrSet != newChrSet) {
@@ -83,10 +84,11 @@ repaint_line(XtermWidget xw, unsigned newChrSet)
* single-size and double-size font. So we paint our own.
*/
ClearCurBackground(xw,
- CursorY(screen, currow),
- LineCursorX(screen, ld, 0),
- (unsigned) FontHeight(screen),
- len * (unsigned) LineFontWidth(screen, ld));
+ currow,
+ 0,
+ 1,
+ len,
+ (unsigned) LineFontWidth(screen, ld));
SetLineDblCS(ld, newChrSet);
@@ -134,6 +136,34 @@ xterm_DECDWL(XtermWidget xw GCC_UNUSED)
#endif
}
+/*
+ * Reset all lines on the screen to single-width/single-height.
+ */
+void
+xterm_ResetDouble(XtermWidget xw)
+{
+#if OPT_DEC_CHRSET
+ TScreen *screen = TScreenOf(xw);
+ Boolean changed = False;
+ LineData *ld;
+ unsigned code;
+ int row;
+
+ for (row = 0; row < screen->max_row; ++row) {
+ if ((ld = getLineData(screen, ROW2INX(screen, row))) != 0) {
+ code = GetLineDblCS(ld);
+ if (code != CSET_SWL) {
+ SetLineDblCS(ld, CSET_SWL);
+ changed = True;
+ }
+ }
+ }
+ if (changed) {
+ xtermRepaint(xw);
+ }
+#endif
+}
+
#if OPT_DEC_CHRSET
static void
discard_font(XtermWidget xw, int n)
diff --git a/app/xterm/input.c b/app/xterm/input.c
index f049078ed..fc4740eef 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,7 +1,7 @@
-/* $XTermId: input.c,v 1.333 2012/01/07 02:01:05 tom Exp $ */
+/* $XTermId: input.c,v 1.334 2012/03/15 00:01:30 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
diff --git a/app/xterm/main.c b/app/xterm/main.c
index 294fbb6fa..663e31720 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,7 +1,7 @@
-/* $XTermId: main.c,v 1.678 2012/01/06 22:04:40 tom Exp $ */
+/* $XTermId: main.c,v 1.684 2012/05/07 23:30:42 tom Exp $ */
/*
- * Copyright 2002-2010,2011 by Thomas E. Dickey
+ * Copyright 2002-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -879,6 +879,7 @@ static XtResource application_resources[] =
Bres("useInsertMode", "UseInsertMode", useInsertMode, False),
#if OPT_ZICONBEEP
Ires("zIconBeep", "ZIconBeep", zIconBeep, 0),
+ Sres("zIconTitleFormat", "ZIconTitleFormat", zIconFormat, "*** %s"),
#endif
#if OPT_PTY_HANDSHAKE
Bres("waitForMap", "WaitForMap", wait_for_map, False),
@@ -2224,12 +2225,7 @@ main(int argc, char *argv[]ENVP_ARG)
override_tty_modes = True;
}
}
-#if OPT_ZICONBEEP
- if (resource.zIconBeep > 100 || resource.zIconBeep < -100) {
- resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */
- xtermWarning("a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
- }
-#endif /* OPT_ZICONBEEP */
+ initZIconBeep();
hold_screen = resource.hold_screen ? 1 : 0;
if (resource.icon_geometry != NULL) {
int scr, junk;
@@ -2603,7 +2599,7 @@ get_pty(int *pty, char *from GCC_UNUSED)
{
int result = 1;
-#if defined(HAVE_POSIX_OPENPT) && defined(HAVE_PTSNAME)
+#if defined(HAVE_POSIX_OPENPT) && defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT_PTY_ISATTY)
if ((*pty = posix_openpt(O_RDWR)) >= 0) {
char *name = ptsname(*pty);
if (name != 0) {
@@ -3378,6 +3374,7 @@ spawnXTerm(XtermWidget xw)
if (get_pty(&screen->respond, XDisplayString(screen->display))) {
SysError(ERROR_PTYS);
}
+ TRACE_TTYSIZE(screen->respond, "after get_pty");
#if OPT_INITIAL_ERASE
if (resource.ptyInitialErase) {
#ifdef TERMIO_STRUCT
@@ -3539,6 +3536,7 @@ spawnXTerm(XtermWidget xw)
#endif
#if !defined(USE_USG_PTYS) && defined(HAVE_POSIX_OPENPT)
unlockpt(screen->respond);
+ TRACE_TTYSIZE(screen->respond, "after unlockpt");
#endif
added_utmp_entry = False;
@@ -3587,6 +3585,7 @@ spawnXTerm(XtermWidget xw)
setpgrp();
#endif
unlockpt(screen->respond);
+ TRACE_TTYSIZE(screen->respond, "after unlockpt");
if ((pty_name = ptsname(screen->respond)) == 0) {
SysError(ERROR_PTSNAME);
} else if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
@@ -3709,6 +3708,9 @@ spawnXTerm(XtermWidget xw)
IGNORE_RC(revoke(ttydev));
#endif
if ((ttyfd = open(ttydev, O_RDWR)) >= 0) {
+ TRACE_TTYSIZE(ttyfd, "after open");
+ TRACE_RC(i, SET_TTYSIZE(ttyfd, ts));
+ TRACE_TTYSIZE(ttyfd, "after fixup");
#if defined(CRAY) && defined(TCSETCTTY)
/* make /dev/tty work */
ioctl(ttyfd, TCSETCTTY, 0);
@@ -3799,7 +3801,7 @@ spawnXTerm(XtermWidget xw)
/* input: nl->nl, don't ignore cr, cr->nl */
UIntClr(tio.c_iflag, (INLCR | IGNCR));
tio.c_iflag |= ICRNL;
-#if OPT_WIDE_CHARS && defined(linux) && defined(IUTF8)
+#if OPT_WIDE_CHARS && defined(IUTF8)
#if OPT_LUIT_PROG
if (command_to_exec_with_luit == 0)
#endif
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 32bbfbefb..49ec15306 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,7 +1,7 @@
-/* $XTermId: misc.c,v 1.576 2012/01/07 01:57:52 tom Exp $ */
+/* $XTermId: misc.c,v 1.588 2012/05/07 23:35:34 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -2176,16 +2176,79 @@ allocateClosestRGB(XtermWidget xw, Colormap cmap, XColor * def)
#define ULONG_MAX (unsigned long)(~(0L))
#endif
-static unsigned short
-searchColortable(XColor * colortable, unsigned length, unsigned color)
+#define CheckColor(result, value) \
+ result = 0; \
+ if (value.red) \
+ result |= 1; \
+ if (value.green) \
+ result |= 2; \
+ if (value.blue) \
+ result |= 4
+
+#define SelectColor(state, value, result) \
+ switch (state) { \
+ default: \
+ case 1: \
+ result = value.red; \
+ break; \
+ case 2: \
+ result = value.green; \
+ break; \
+ case 4: \
+ result = value.blue; \
+ break; \
+ }
+
+/*
+ * Check if the color map consists of values in exactly one of the red, green
+ * or blue columns. If it is not, we do not know how to use it for the exact
+ * match.
+ */
+static int
+simpleColors(XColor * colortable, unsigned length)
+{
+ unsigned n;
+ int state = -1;
+ int check;
+
+ for (n = 0; n < length; ++n) {
+ if (state == -1) {
+ CheckColor(state, colortable[n]);
+ if (state == 0)
+ state = -1;
+ }
+ if (state > 0) {
+ CheckColor(check, colortable[n]);
+ if (check > 0 && check != state) {
+ state = 0;
+ break;
+ }
+ }
+ }
+ switch (state) {
+ case 1:
+ case 2:
+ case 4:
+ break;
+ default:
+ state = 0;
+ break;
+ }
+ return state;
+}
+
+static unsigned
+searchColors(XColor * colortable, unsigned length, unsigned color, int state)
{
unsigned result = 0;
unsigned n;
unsigned long best = ULONG_MAX;
unsigned long diff;
+ unsigned value;
for (n = 0; n < length; ++n) {
- diff = (color - colortable[n].blue);
+ SelectColor(state, colortable[n], value);
+ diff = (color - value);
diff *= diff;
if (diff < best) {
#if 0
@@ -2200,7 +2263,8 @@ searchColortable(XColor * colortable, unsigned length, unsigned color)
best = diff;
}
}
- return colortable[result].blue;
+ SelectColor(state, colortable[result], value);
+ return value;
}
/*
@@ -2243,20 +2307,19 @@ allocateExactRGB(XtermWidget xw, Colormap cmap, XColor * def)
if (result) {
unsigned cmap_type;
unsigned cmap_size;
+ int state;
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 (loadColorTable(xw, cmap_size)
+ && (state = simpleColors(screen->cmap_data, cmap_size)) > 0) {
+#define SearchColors(which) temp.which = (unsigned short) searchColors(screen->cmap_data, cmap_size, save.which, state)
+ SearchColors(red);
+ SearchColors(green);
+ SearchColors(blue);
if (XAllocColor(screen->display, cmap, &temp) != 0) {
#if OPT_TRACE
if (temp.red != save.red
@@ -2265,6 +2328,9 @@ allocateExactRGB(XtermWidget xw, Colormap cmap, XColor * def)
TRACE(("...improved %x/%x/%x ->%x/%x/%x\n",
save.red, save.green, save.blue,
temp.red, temp.green, temp.blue));
+ } else {
+ TRACE(("...no improvement for %x/%x/%x\n",
+ save.red, save.green, save.blue));
}
#endif
*def = temp;
@@ -3575,6 +3641,10 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
&& (xw->flags & PROTECTED) ? 1 : 0,
cp);
} else if (!strcmp(cp, "\"p")) { /* DECSCL */
+ if (screen->vtXX_level < 2) {
+ /* actually none of DECRQSS is valid for vt100's */
+ break;
+ }
sprintf(reply, "%d%s%s",
(screen->vtXX_level ?
screen->vtXX_level : 1) + 60,
@@ -3587,6 +3657,12 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
sprintf(reply, "%d;%dr",
screen->top_marg + 1,
screen->bot_marg + 1);
+ } else if (!strcmp(cp, "s")) { /* DECSLRM */
+ if (screen->terminal_id >= 400) { /* VT420 */
+ sprintf(reply, "%d;%ds",
+ screen->lft_marg + 1,
+ screen->rgt_marg + 1);
+ }
} else if (!strcmp(cp, "m")) { /* SGR */
strcpy(reply, "0");
if (xw->flags & BOLD)
@@ -3647,10 +3723,10 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen)
strcat(reply, "m");
} else if (!strcmp(cp, " q")) { /* DECSCUSR */
int code = 0;
- if (screen->cursor_underline)
+ if (screen->cursor_underline != 0)
code |= 2;
#if OPT_BLINK_CURS
- if (screen->cursor_blink)
+ if (screen->cursor_blink_esc == 0)
code |= 1;
#endif
sprintf(reply, "%d%s", code + 1, cp);
@@ -3770,7 +3846,7 @@ enum {
};
#define MdBool(bool) ((bool) ? mdMaybeSet : mdMaybeReset)
-#define MdFlag(mode,flag) MdBool(xw->keyboard.flags & MODE_KAM)
+#define MdFlag(mode,flag) MdBool((mode) & (flag))
/*
* Reply is the same format as the query, with pair of mode/value:
@@ -3947,6 +4023,12 @@ do_decrpm(XtermWidget xw, int nparams, int *params)
case 67: /* DECBKM */
result = MdFlag(xw->keyboard.flags, MODE_DECBKM);
break;
+ case 69: /* DECLRMM */
+ result = MdFlag(xw->flags, LEFT_RIGHT);
+ break;
+ case 95: /* DECNCSM */
+ result = MdFlag(xw->flags, NOCLEAR_COLM);
+ break;
case SET_VT200_MOUSE: /* xterm bogus sequence */
result = MdBool(screen->send_mouse_pos == VT200_MOUSE);
break;
@@ -4082,7 +4164,7 @@ udk_lookup(int keycode, int *len)
return 0;
}
-static void
+void
ChangeGroup(XtermWidget xw, const char *attribute, char *value)
{
#if OPT_WIDE_CHARS
@@ -4235,19 +4317,7 @@ ChangeIconName(XtermWidget xw, char *name)
static char dummy[] = "";
name = dummy;
}
-#if OPT_ZICONBEEP /* If warning should be given then give it */
- if (resource.zIconBeep && TScreenOf(xw)->zIconBeep_flagged) {
- char *newname = CastMallocN(char, strlen(name) + 4);
- if (!newname) {
- xtermWarning("malloc failed in ChangeIconName\n");
- return;
- }
- strcpy(newname, "*** ");
- strcat(newname, name);
- ChangeGroup(xw, XtNiconName, newname);
- free(newname);
- } else
-#endif /* OPT_ZICONBEEP */
+ if (!showZIconBeep(xw, name))
ChangeGroup(xw, XtNiconName, name);
}
diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c
index 6e6b4faab..684b6447b 100644
--- a/app/xterm/os2main.c
+++ b/app/xterm/os2main.c
@@ -1,4 +1,4 @@
-/* $XTermId: os2main.c,v 1.273 2011/12/27 10:36:58 tom Exp $ */
+/* $XTermId: os2main.c,v 1.276 2012/03/27 23:09:20 tom Exp $ */
/* removed all foreign stuff to get the code more clear (hv)
* and did some rewrite for the obscure OS/2 environment
@@ -277,7 +277,11 @@ static XtResource application_resources[] =
Sres("omitTranslation", "OmitTranslation", omitTranslation, NULL),
Sres("keyboardType", "KeyboardType", keyboardType, "unknown"),
#if OPT_PRINT_ON_EXIT
+ Ires("printModeImmediate", "PrintModeImmediate", printModeNow, 0),
+ Ires("printOptsImmediate", "PrintOptsImmediate", printOptsNow, 9),
+ Sres("printFileImmediate", "PrintFileImmediate", printFileNow, NULL),
Ires("printModeOnXError", "PrintModeOnXError", printModeOnXError, 0),
+ Ires("printOptsOnXError", "PrintOptsOnXError", printOptsOnXError, 9),
Sres("printFileOnXError", "PrintFileOnXError", printFileOnXError, NULL),
#endif
#if OPT_SUNPC_KBD
@@ -302,6 +306,7 @@ static XtResource application_resources[] =
Bres("useInsertMode", "UseInsertMode", useInsertMode, False),
#if OPT_ZICONBEEP
Ires("zIconBeep", "ZIconBeep", zIconBeep, 0),
+ Sres("zIconTitleFormat", "ZIconTitleFormat", zIconFormat, "*** %s"),
#endif
#if OPT_PTY_HANDSHAKE
Bres("waitForMap", "WaitForMap", wait_for_map, False),
@@ -419,7 +424,6 @@ static XrmOptionDescRec optionDescList[] = {
{"+k8", "*allowC1Printable", XrmoptionNoArg, (XPointer) "off"},
#endif
{"-kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL},
-{"+kt", "*keyboardType", XrmoptionSepArg, (XPointer) NULL},
/* parse logging options anyway for compatibility */
{"-l", "*logging", XrmoptionNoArg, (XPointer) "on"},
{"+l", "*logging", XrmoptionNoArg, (XPointer) "off"},
@@ -451,6 +455,7 @@ static XrmOptionDescRec optionDescList[] = {
{"+rvc", "*colorRVMode", XrmoptionNoArg, (XPointer) "on"},
{"-sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "on"},
{"+sf", "*sunFunctionKeys", XrmoptionNoArg, (XPointer) "off"},
+{"-sh", "*scaleHeight", XrmoptionSepArg, (XPointer) NULL},
{"-si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "off"},
{"+si", "*scrollTtyOutput", XrmoptionNoArg, (XPointer) "on"},
{"-sk", "*scrollKey", XrmoptionNoArg, (XPointer) "on"},
@@ -657,8 +662,8 @@ static OptionHelp xtermOptions[] = {
#endif
{ "-/+uc", "turn on/off underline cursor" },
{ "-/+ulc", "turn off/on display of underline as color" },
-{ "-/+ut", "turn on/off utmp inhibit (not supported)" },
{ "-/+ulit", "turn off/on display of underline as italics" },
+{ "-/+ut", "turn on/off utmp inhibit (not supported)" },
{ "-/+vb", "turn on/off visual bell" },
{ "-/+pob", "turn on/off pop on bell" },
#if OPT_WIDE_CHARS
@@ -688,6 +693,7 @@ static OptionHelp xtermOptions[] = {
#endif
#if OPT_MAXIMIZE
{"-/+maximized", "turn on/off maxmize on startup" },
+{"-/+fullscreen", "turn on/off fullscreen on startup" },
#endif
{ NULL, NULL }};
/* *INDENT-ON* */
@@ -1069,12 +1075,7 @@ main(int argc, char **argv ENVP_ARG)
override_tty_modes = True;
}
}
-#if OPT_ZICONBEEP
- if (resource.zIconBeep > 100 || resource.zIconBeep < -100) {
- resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */
- xtermWarning("a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
- }
-#endif /* OPT_ZICONBEEP */
+ initZIconBeep();
hold_screen = resource.hold_screen ? 1 : 0;
if (resource.icon_geometry != NULL) {
int scr, junk;
diff --git a/app/xterm/package/debian/changelog b/app/xterm/package/debian/changelog
index eaffb1897..8cae16cec 100644
--- a/app/xterm/package/debian/changelog
+++ b/app/xterm/package/debian/changelog
@@ -1,3 +1,9 @@
+xterm-dev (279) unstable; urgency=low
+
+ * Miscellaneous fixes.
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 14 Mar 2012 20:33:27 -0400
+
xterm-dev (278) unstable; urgency=low
* Fix regression in eightBitInput logic.
diff --git a/app/xterm/package/xterm.spec b/app/xterm/package/xterm.spec
index 7ee524cc2..ec69b1898 100644
--- a/app/xterm/package/xterm.spec
+++ b/app/xterm/package/xterm.spec
@@ -1,7 +1,7 @@
-# $XTermId: xterm.spec,v 1.20 2012/01/12 13:10:21 tom Exp $
+# $XTermId: xterm.spec,v 1.21 2012/03/15 00:32:52 tom Exp $
Summary: A text-based Web browser
Name: xterm-dev
-Version: 278
+Version: 279
Release: 1
License: X11
Group: Applications/Internet
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index 9e127bd5e..e3ae4f7c6 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,7 +1,7 @@
-/* $XTermId: ptyx.h,v 1.720 2012/01/05 23:58:19 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.730 2012/05/09 00:09:32 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -361,7 +361,7 @@ typedef struct {
#define ANSI_APC 0x9F
#define MIN_DECID 52 /* can emulate VT52 */
-#define MAX_DECID 420 /* ...through VT420 */
+#define MAX_DECID 525 /* ...through VT525 */
#ifndef DFT_DECID
#define DFT_DECID "vt100" /* default VT100 */
@@ -392,10 +392,12 @@ typedef short ParmType;
typedef struct {
Char a_type; /* CSI, etc., see unparseq() */
Char a_pintro; /* private-mode char, if any */
+ char * a_delim; /* between parameters (;) */
Char a_inters; /* special (before final-char) */
Char a_final; /* final-char */
ParmType a_nparam; /* # of parameters */
ParmType a_param[NPARAM]; /* Parameters */
+ Char a_radix[NPARAM]; /* Parameters */
} ANSI;
#define TEK_FONT_LARGE 0
@@ -1375,6 +1377,8 @@ typedef struct {
/* indices into save_modes[] */
typedef enum {
+ DP_ALT_SENDS_ESC,
+ DP_BELL_IS_URGENT,
DP_CRS_VISIBLE,
DP_DECANM,
DP_DECARM,
@@ -1382,22 +1386,34 @@ typedef enum {
DP_DECBKM,
DP_DECCKM,
DP_DECCOLM, /* IN132COLUMNS */
+ DP_DECKPAM,
+ DP_DECNRCM,
DP_DECOM,
DP_DECPEX,
DP_DECPFF,
DP_DECSCLM,
DP_DECSCNM,
DP_DECTCEM,
- DP_DECTEK,
+ DP_DELETE_IS_DEL,
+ DP_EIGHT_BIT_META,
+ DP_KEEP_SELECTION,
+ DP_KEYBOARD_TYPE,
+ DP_POP_ON_BELL,
DP_PRN_EXTENT,
DP_PRN_FORMFEED,
+ DP_RXVT_SCROLLBAR,
+ DP_RXVT_SCROLL_TTY_KEYPRESS,
+ DP_RXVT_SCROLL_TTY_OUTPUT,
+ DP_SELECT_TO_CLIPBOARD,
DP_X_ALTSCRN,
DP_X_DECCOLM,
+ DP_X_EXT_MOUSE,
DP_X_LOGGING,
+ DP_X_LRMM,
DP_X_MARGIN,
DP_X_MORE,
DP_X_MOUSE,
- DP_X_EXT_MOUSE,
+ DP_X_NCSM,
DP_X_REVWRAP,
DP_X_X10MSE,
#if OPT_BLINK_CURS
@@ -1406,6 +1422,16 @@ typedef enum {
#if OPT_FOCUS_EVENT
DP_X_FOCUS,
#endif
+#if OPT_NUM_LOCK
+ DP_REAL_NUMLOCK,
+ DP_META_SENDS_ESC,
+#endif
+#if OPT_SHIFT_FONTS
+ DP_RXVT_FONTSIZE,
+#endif
+#if OPT_TEK4014
+ DP_DECTEK,
+#endif
#if OPT_TOOLBAR
DP_TOOLBAR,
#endif
@@ -1617,6 +1643,7 @@ typedef struct {
Boolean wide_chars; /* true when 16-bit chars */
Boolean vt100_graphics; /* true to allow vt100-graphics */
Boolean utf8_inparse; /* true to enable UTF-8 parser */
+ Boolean normalized_c; /* true to precompose to Form C */
char * utf8_mode_s; /* use UTF-8 decode/encode */
char * utf8_fonts_s; /* use UTF-8 decode/encode */
int utf8_mode; /* use UTF-8 decode/encode: 0-2 */
@@ -1799,6 +1826,8 @@ typedef struct {
int max_row; /* bottom row */
int top_marg; /* top line of scrolling region */
int bot_marg; /* bottom line of " " */
+ int lft_marg; /* left column of " " */
+ int rgt_marg; /* right column of " " */
Widget scrollWidget; /* pointer to scrollbar struct */
/*
* Indices used to keep track of the top of the vt100 window and
@@ -1884,7 +1913,7 @@ typedef struct {
String term_id; /* resource for terminal_id */
int terminal_id; /* 100=vt100, 220=vt220, etc. */
int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */
- int ansi_level; /* levels 1,2,3 */
+ int ansi_level; /* dpANSI levels 1,2,3 */
int protected_mode; /* 0=off, 1=DEC, 2=ISO */
Boolean always_bold_mode; /* compare normal/bold font */
Boolean always_highlight; /* whether to highlight cursor */
@@ -1911,7 +1940,6 @@ typedef struct {
#endif
#if OPT_VT52_MODE
- int vt52_save_level; /* save-area for DECANM */
Char vt52_save_curgl;
Char vt52_save_curgr;
Char vt52_save_curss;
@@ -2433,6 +2461,8 @@ typedef struct _TekWidgetRec {
#define IN132COLUMNS MiscBIT(7) /* true if in 132 column mode */
#define INVISIBLE MiscBIT(8) /* true if writing invisible text */
#define NATIONAL MiscBIT(9) /* true if writing national charset */
+#define LEFT_RIGHT MiscBIT(10) /* true if left/right margin mode */
+#define NOCLEAR_COLM MiscBIT(11) /* true if no clear on DECCOLM change */
/*
* Groups of attributes
@@ -2507,9 +2537,10 @@ typedef struct _TekWidgetRec {
((screen)->cursorp.col != (screen)->cur_col || \
(screen)->cursorp.row != (screen)->cur_row))
-#define CursorX(screen,col) ((col) * FontWidth(screen) + OriginX(screen))
-#define CursorY(screen,row) ((INX2ROW(screen, row) * FontHeight(screen)) \
- + screen->border)
+#define CursorX2(screen,col,fw) ((col) * (int)(fw) + OriginX(screen))
+#define CursorX(screen,col) CursorX2(screen, col, FontWidth(screen))
+#define CursorY(screen,row) ((INX2ROW(screen, row) * FontHeight(screen)) \
+ + screen->border)
/*
* These definitions depend on whether xterm supports active-icon.
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index d8bb8a4ff..dc56dc476 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,7 +1,7 @@
-/* $XTermId: screen.c,v 1.440 2011/12/27 10:10:53 tom Exp $ */
+/* $XTermId: screen.c,v 1.452 2012/05/08 08:36:43 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -78,8 +78,8 @@
#define getMinRow(screen) ((xw->flags & ORIGIN) ? (screen)->top_marg : 0)
#define getMaxRow(screen) ((xw->flags & ORIGIN) ? (screen)->bot_marg : (screen)->max_row)
-#define getMinCol(screen) 0
-#define getMaxCol(screen) ((screen)->max_col)
+#define getMinCol(screen) ((xw->flags & ORIGIN) ? (screen)->lft_marg : 0)
+#define getMaxCol(screen) ((xw->flags & ORIGIN) ? (screen)->rgt_marg : (screen)->max_col)
#define MoveLineData(base, dst, src, len) \
memmove(scrnHeadAddr(screen, base, (unsigned) (dst)), \
@@ -706,6 +706,37 @@ ChangeToWide(XtermWidget xw)
* Clear cells, no side-effects.
*/
void
+CopyCells(TScreen * screen, LineData * src, LineData * dst, int col, int len)
+{
+ if (len > 0) {
+ int n;
+ int last = col + len;
+
+ for (n = col; n < last; ++n) {
+ dst->charData[n] = src->charData[n];
+ dst->attribs[n] = src->attribs[n];
+ }
+
+ if_OPT_ISO_COLORS(screen, {
+ for (n = col; n < last; ++n) {
+ dst->color[n] = src->color[n];
+ }
+ });
+ if_OPT_WIDE_CHARS(screen, {
+ size_t off;
+ for (n = col; n < last; ++n) {
+ for_each_combData(off, src) {
+ dst->combData[off][n] = src->combData[off][n];
+ }
+ }
+ });
+ }
+}
+
+/*
+ * Clear cells, no side-effects.
+ */
+void
ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
{
if (len != 0) {
@@ -896,10 +927,10 @@ ScrnWriteText(XtermWidget xw,
ld->color[screen->cur_col + (int) j] = (CellColor) cur_fg_bg;
});
- if_OPT_WIDE_CHARS(screen, {
- screen->last_written_col = screen->cur_col + (int) real_width - 1;
- screen->last_written_row = screen->cur_row;
- });
+#if OPT_WIDE_CHARS
+ screen->last_written_col = screen->cur_col + (int) real_width - 1;
+ screen->last_written_row = screen->cur_row;
+#endif
if_OPT_XMC_GLITCH(screen, {
Resolve_XMC(xw);
@@ -1179,26 +1210,28 @@ void
ScrnInsertChar(XtermWidget xw, unsigned n)
{
#define MemMove(data) \
- for (j = last - 1; j >= (col + (int) n); --j) \
+ for (j = last; j >= (col + (int) n); --j) \
data[j] = data[j - (int) n]
TScreen *screen = TScreenOf(xw);
- int last = MaxCols(screen);
+ int first = ScrnLeftMargin(xw);
+ int last = ScrnRightMargin(xw);
int row = screen->cur_row;
int col = screen->cur_col;
int j;
LineData *ld;
- if (last <= (col + (int) n)) {
- if (last <= col)
- return;
+ if (col < first || col > last) {
+ TRACE(("ScrnInsertChar - col %d outside [%d..%d]\n", col, first, last));
+ return;
+ } else if (last <= (col + (int) n)) {
n = (unsigned) (last - col);
}
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
assert(n > 0);
- assert(last > (int) n);
+ assert(last >= (int) n);
if_OPT_WIDE_CHARS(screen, {
int xx = screen->cur_row;
@@ -1207,7 +1240,7 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
}
- kr = screen->max_col - (int) n + 1;
+ kr = last - (int) n + 1;
if (DamagedCells(screen, n, &kl, (int *) 0, xx, kr) && kr > kl) {
ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl);
}
@@ -1239,19 +1272,21 @@ void
ScrnDeleteChar(XtermWidget xw, unsigned n)
{
#define MemMove(data) \
- for (j = col; j < last - (int) n; ++j) \
+ for (j = col; j <= last - (int) n; ++j) \
data[j] = data[j + (int) n]
TScreen *screen = TScreenOf(xw);
- int last = MaxCols(screen);
+ int first = ScrnLeftMargin(xw);
+ int last = ScrnRightMargin(xw) + 1;
int row = screen->cur_row;
int col = screen->cur_col;
int j;
LineData *ld;
- if (last <= (col + (int) n)) {
- if (last <= col)
- return;
+ if (col < first || col > last) {
+ TRACE(("ScrnDeleteChar - col %d outside [%d..%d]\n", col, first, last));
+ return;
+ } else if (last <= (col + (int) n)) {
n = (unsigned) (last - col);
}
@@ -2075,6 +2110,7 @@ ScreenResize(XtermWidget xw,
/* adjust scrolling region */
set_tb_margins(screen, 0, screen->max_row);
+ set_lr_margins(screen, 0, screen->max_col);
UIntClr(*flags, ORIGIN);
if (screen->cur_row > screen->max_row)
@@ -2175,7 +2211,7 @@ non_blank_line(TScreen * screen,
}
/*
- * Rectangle parameters start from one.
+ * Limit/map rectangle parameters.
*/
#define minRectRow(screen) (getMinRow(screen) + 1)
#define minRectCol(screen) (getMinCol(screen) + 1)
@@ -2183,34 +2219,43 @@ non_blank_line(TScreen * screen,
#define maxRectCol(screen) (getMaxCol(screen) + 1)
static int
-limitedParseRow(XtermWidget xw, TScreen * screen, int row)
+limitedParseRow(XtermWidget xw, int row)
{
+ TScreen *screen = TScreenOf(xw);
int min_row = minRectRow(screen);
int max_row = maxRectRow(screen);
+ if (xw->flags & ORIGIN)
+ row += screen->top_marg;
+
if (row < min_row)
row = min_row;
else if (row > max_row)
row = max_row;
+
return row;
}
static int
-limitedParseCol(XtermWidget xw, TScreen * screen, int col)
+limitedParseCol(XtermWidget xw, int col)
{
+ TScreen *screen = TScreenOf(xw);
int min_col = minRectCol(screen);
int max_col = maxRectCol(screen);
- (void) xw;
+ if (xw->flags & ORIGIN)
+ col += screen->lft_marg;
+
if (col < min_col)
col = min_col;
else if (col > max_col)
col = max_col;
+
return col;
}
#define LimitedParse(num, func, dft) \
- func(xw, screen, (nparams > num) ? params[num] : dft)
+ func(xw, (nparams > num) ? params[num] : dft)
/*
* Copy the rectangle boundaries into a struct, providing default values as
@@ -2281,8 +2326,7 @@ ScrnFillRectangle(XtermWidget xw,
TRACE(("filling %d [%d..%d]\n", row, left, left + size));
/*
- * Fill attributes, preserving "protected" flag, as well as
- * colors if asked.
+ * Fill attributes, preserving colors.
*/
for (col = (int) left; col < target->right; ++col) {
unsigned temp = ld->attribs[col];
@@ -2290,8 +2334,7 @@ ScrnFillRectangle(XtermWidget xw,
if (!keepColors) {
UIntClr(temp, (FG_COLOR | BG_COLOR));
}
- temp = attrs | (temp & (FG_COLOR | BG_COLOR | PROTECTED));
- temp |= CHARDRAWN;
+ temp = attrs | (temp & (FG_COLOR | BG_COLOR)) | CHARDRAWN;
ld->attribs[col] = (Char) temp;
#if OPT_ISO_COLORS
if (attrs & (FG_COLOR | BG_COLOR)) {
@@ -2391,6 +2434,13 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params)
ld->attribs[col] |= CHARDRAWN;
}
}
+#if OPT_BLINK_TEXT
+ if (LineHasBlinking(screen, ld)) {
+ LineSetBlinked(ld);
+ } else {
+ LineClrBlinked(ld);
+ }
+#endif
}
free(cells);
@@ -2578,6 +2628,50 @@ ScrnWipeRectangle(XtermWidget xw,
False);
}
}
+
+/*
+ * Compute a checksum, ignoring the page number (since we have only one page).
+ */
+void
+xtermCheckRect(XtermWidget xw,
+ int nparam,
+ int *params,
+ int *result)
+{
+ TScreen *screen = TScreenOf(xw);
+ XTermRect target;
+ LineData *ld;
+
+ *result = 0;
+ if (nparam > 2) {
+ nparam -= 2;
+ params += 2;
+ }
+ xtermParseRect(xw, nparam, params, &target);
+ if (validRect(xw, &target)) {
+ int top = target.top - 1;
+ int bottom = target.bottom - 1;
+ int row, col;
+
+ for (row = top; row <= bottom; ++row) {
+ int left = (target.left - 1);
+ int right = (target.right - 1);
+
+ ld = getLineData(screen, row);
+ for (col = left; col <= right; ++col) {
+ if (ld->attribs[col] & CHARDRAWN) {
+ *result += (int) ld->charData[col];
+ if_OPT_WIDE_CHARS(screen, {
+ size_t off;
+ for_each_combData(off, ld) {
+ *result += (int) ld->combData[off][col];
+ }
+ })
+ }
+ }
+ }
+ }
+}
#endif /* OPT_DEC_RECTOPS */
#if OPT_MAXIMIZE
diff --git a/app/xterm/tabs.c b/app/xterm/tabs.c
index 4cce4ed06..a788da243 100644
--- a/app/xterm/tabs.c
+++ b/app/xterm/tabs.c
@@ -1,4 +1,4 @@
-/* $XTermId: tabs.c,v 1.39 2011/09/11 15:00:38 tom Exp $ */
+/* $XTermId: tabs.c,v 1.41 2012/05/02 14:14:36 tom Exp $ */
/*
* Copyright 2000-2010,2011 by Thomas E. Dickey
@@ -149,6 +149,8 @@ TabToNextStop(XtermWidget xw)
int next = TabNext(xw, xw->tabs, screen->cur_col);
int max = LineMaxCol(screen, getLineData(screen, screen->cur_row));
+ if (IsLeftRightMode(xw))
+ max = TScreenOf(xw)->rgt_marg;
if (next > max)
next = max;
set_cur_col(screen, next);
@@ -164,8 +166,15 @@ TabToPrevStop(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
int saved_column = screen->cur_col;
+ int next_column = TabPrev(xw->tabs, screen->cur_col);
- set_cur_col(screen, TabPrev(xw->tabs, screen->cur_col));
+ if (xw->flags & ORIGIN) {
+ int left = ScrnLeftMargin(xw);
+ if (next_column < left)
+ next_column = left;
+ }
+
+ set_cur_col(screen, next_column);
return (screen->cur_col < saved_column);
}
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index f6ebfa221..43311c4af 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,7 +1,7 @@
-/* $XTermId: trace.c,v 1.133 2011/12/27 10:10:53 tom Exp $ */
+/* $XTermId: trace.c,v 1.140 2012/05/06 18:01:58 tom Exp $ */
/*
- * Copyright 1997-2010,2011 by Thomas E. Dickey
+ * Copyright 1997-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -503,6 +503,77 @@ LineTstFlag(LineData ld, int flag)
}
#endif /* OPT_TRACE_FLAGS */
+/*
+ * Trace the normal or alternate screen, showing color values up to 16, e.g.,
+ * for debugging with vttest.
+ */
+void
+TraceScreen(XtermWidget xw, int whichBuf)
+{
+ TScreen *screen = TScreenOf(xw);
+ int row, col;
+
+ if (screen->editBuf_index[whichBuf]) {
+ TRACE(("TraceScreen %d:\n", whichBuf));
+ for (row = 0; row <= screen->max_row; ++row) {
+ LineData *ld = getLineData(screen, row);
+ TRACE((" %3d:", row));
+ if (ld != 0) {
+ for (col = 0; col < ld->lineSize; ++col) {
+ int ch = (int) ld->charData[col];
+ if (ch < ' ')
+ ch = ' ';
+ if (ch >= 127)
+ ch = '#';
+ TRACE(("%c", ch));
+ }
+ TRACE((":\n"));
+
+ TRACE((" xx:"));
+ for (col = 0; col < ld->lineSize; ++col) {
+ unsigned attrs = ld->attribs[col];
+ char ch;
+ if (attrs & PROTECTED) {
+ ch = '*';
+ } else if (attrs & BLINK) {
+ ch = 'B';
+ } else if (attrs & CHARDRAWN) {
+ ch = '+';
+ } else {
+ ch = ' ';
+ }
+ TRACE(("%c", ch));
+ }
+ TRACE((":\n"));
+
+#if 0
+ TRACE((" fg:"));
+ for (col = 0; col < ld->lineSize; ++col) {
+ unsigned fg = extract_fg(xw, ld->color[col], ld->attribs[col]);
+ if (fg > 15)
+ fg = 15;
+ TRACE(("%1x", fg));
+ }
+ TRACE((":\n"));
+
+ TRACE((" bg:"));
+ for (col = 0; col < ld->lineSize; ++col) {
+ unsigned bg = extract_bg(xw, ld->color[col], ld->attribs[col]);
+ if (bg > 15)
+ bg = 15;
+ TRACE(("%1x", bg));
+ }
+ TRACE((":\n"));
+#endif
+ } else {
+ TRACE(("null lineData\n"));
+ }
+ }
+ } else {
+ TRACE(("TraceScreen %d is nil\n", whichBuf));
+ }
+}
+
void
TraceFocus(Widget w, XEvent * ev)
{
@@ -764,6 +835,7 @@ TraceXtermResources(void)
XRES_B(useInsertMode);
#if OPT_ZICONBEEP
XRES_I(zIconBeep);
+ XRES_S(zIconFormat);
#endif
#if OPT_PTY_HANDSHAKE
XRES_B(wait_for_map);
diff --git a/app/xterm/trace.h b/app/xterm/trace.h
index d9bab3e1b..75c807244 100644
--- a/app/xterm/trace.h
+++ b/app/xterm/trace.h
@@ -1,4 +1,4 @@
-/* $XTermId: trace.h,v 1.64 2011/09/11 14:56:42 tom Exp $ */
+/* $XTermId: trace.h,v 1.65 2012/04/18 23:29:10 tom Exp $ */
/*
* Copyright 1997-2010,2011 by Thomas E. Dickey
@@ -124,6 +124,8 @@ extern XtGeometryResult TraceResizeRequest(const char * /* fn */, int /* ln */,
#endif
+extern void TraceScreen(XtermWidget /* xw */, int /* whichBuf */);
+
/*
* The whole wnew->screen struct is zeroed in VTInitialize. Use these macros
* where applicable for copying the pieces from the request widget into the
diff --git a/app/xterm/util.c b/app/xterm/util.c
index 3b4f2bc6c..7fabe1aa3 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,7 +1,7 @@
-/* $XTermId: util.c,v 1.554 2011/12/30 21:56:42 tom Exp $ */
+/* $XTermId: util.c,v 1.587 2012/05/10 11:06:37 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -87,7 +87,9 @@ static void horizontal_copy_area(XtermWidget xw,
static void vertical_copy_area(XtermWidget xw,
int firstline,
int nlines,
- int amount);
+ int amount,
+ int left,
+ int right);
#if OPT_WIDE_CHARS
unsigned first_widechar;
@@ -175,72 +177,117 @@ FlushScroll(XtermWidget xw)
int refreshheight;
int scrolltop;
int scrollheight;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
+ Boolean full_lines = (Boolean) ((left == 0) && (right == screen->max_col));
if (screen->cursor_state)
HideCursor();
+
+ TRACE(("FlushScroll %s-lines scroll:%d refresh %d\n",
+ full_lines ? "full" : "partial",
+ screen->scroll_amt,
+ screen->refresh_amt));
+
if (screen->scroll_amt > 0) {
+ /*
+ * Lines will be scrolled "up".
+ */
refreshheight = screen->refresh_amt;
- scrollheight = screen->bot_marg - screen->top_marg -
- refreshheight + 1;
- if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) >
- (i = screen->max_row - screen->scroll_amt + 1))
+ scrollheight = screen->bot_marg - screen->top_marg - refreshheight + 1;
+ refreshtop = screen->bot_marg - refreshheight + 1 + shift;
+ i = screen->max_row - screen->scroll_amt + 1;
+ if (refreshtop > i) {
refreshtop = i;
+ }
+
+ /*
+ * If this is the normal (not alternate) screen, and the top margin is
+ * at the top of the screen, then we will shift full lines scrolled out
+ * of the scrolling region into the saved-lines.
+ */
if (screen->scrollWidget
&& !screen->whichBuf
+ && full_lines
&& screen->top_marg == 0) {
scrolltop = 0;
- if ((scrollheight += shift) > i)
+ scrollheight += shift;
+ if (scrollheight > i)
scrollheight = i;
- if ((i = screen->bot_marg - bot) > 0 &&
- (refreshheight -= i) < screen->scroll_amt)
- refreshheight = screen->scroll_amt;
- if ((i = screen->savedlines) < screen->savelines) {
- if ((i += screen->scroll_amt) >
- screen->savelines)
+ i = screen->bot_marg - bot;
+ if (i > 0) {
+ refreshheight -= i;
+ if (refreshheight < screen->scroll_amt) {
+ refreshheight = screen->scroll_amt;
+ }
+ }
+ i = screen->savedlines;
+ if (i < screen->savelines) {
+ i += screen->scroll_amt;
+ if (i > screen->savelines) {
i = screen->savelines;
+ }
screen->savedlines = i;
ScrollBarDrawThumb(screen->scrollWidget);
}
} else {
scrolltop = screen->top_marg + shift;
- if ((i = bot - (screen->bot_marg - screen->refresh_amt +
- screen->scroll_amt)) > 0) {
- if (bot < screen->bot_marg)
+ i = bot - (screen->bot_marg - screen->refresh_amt + screen->scroll_amt);
+ if (i > 0) {
+ if (bot < screen->bot_marg) {
refreshheight = screen->scroll_amt + i;
+ }
} else {
scrollheight += i;
refreshheight = screen->scroll_amt;
- if ((i = screen->top_marg + screen->scroll_amt -
- 1 - bot) > 0) {
+ i = screen->top_marg + screen->scroll_amt - 1 - bot;
+ if (i > 0) {
refreshtop += i;
refreshheight -= i;
}
}
}
} else {
+ /*
+ * Lines will be scrolled "down".
+ */
refreshheight = -screen->refresh_amt;
- scrollheight = screen->bot_marg - screen->top_marg -
- refreshheight + 1;
+ scrollheight = screen->bot_marg - screen->top_marg - refreshheight + 1;
refreshtop = screen->top_marg + shift;
scrolltop = refreshtop + refreshheight;
- if ((i = screen->bot_marg - bot) > 0)
+ i = screen->bot_marg - bot;
+ if (i > 0) {
scrollheight -= i;
- if ((i = screen->top_marg + refreshheight - 1 - bot) > 0)
+ }
+ i = screen->top_marg + refreshheight - 1 - bot;
+ if (i > 0) {
refreshheight -= i;
+ }
}
- scrolling_copy_area(xw, scrolltop + screen->scroll_amt,
- scrollheight, screen->scroll_amt);
+
+ vertical_copy_area(xw,
+ scrolltop + screen->scroll_amt,
+ scrollheight,
+ screen->scroll_amt,
+ left,
+ right);
ScrollSelection(screen, -(screen->scroll_amt), False);
screen->scroll_amt = 0;
screen->refresh_amt = 0;
+
if (refreshheight > 0) {
ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
- ScrnRefresh(xw, refreshtop, 0, refreshheight,
- MaxCols(screen), False);
+ refreshtop,
+ left,
+ (unsigned) refreshheight,
+ (unsigned) (right + 1 - left),
+ (unsigned) FontWidth(screen));
+ ScrnRefresh(xw,
+ refreshtop,
+ 0,
+ refreshheight,
+ MaxCols(screen),
+ False);
}
return;
}
@@ -250,22 +297,22 @@ FlushScroll(XtermWidget xw)
* include the current line. If false, the line is visible and we should
* paint it now rather than waiting for the line to become visible.
*/
-int
+static Bool
AddToRefresh(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
int amount = screen->refresh_amt;
int row = screen->cur_row;
- int result;
+ Bool result;
if (amount == 0) {
- result = 0;
+ result = False;
} else if (amount > 0) {
int bottom;
if (row == (bottom = screen->bot_marg) - amount) {
screen->refresh_amt++;
- result = 1;
+ result = True;
} else {
result = (row >= bottom - amount + 1 && row <= bottom);
}
@@ -275,7 +322,7 @@ AddToRefresh(XtermWidget xw)
amount = -amount;
if (row == (top = screen->top_marg) + amount) {
screen->refresh_amt--;
- result = 1;
+ result = True;
} else {
result = (row <= top + amount - 1 && row >= top);
}
@@ -313,7 +360,8 @@ AddToVisible(XtermWidget xw)
/*
* If we're scrolling, leave the selection intact if possible.
* If it will bump into one of the extremes of the saved-lines, truncate that.
- * If the selection is not contained within the scrolled region, clear it.
+ * If the selection is not entirely contained within the margins and not
+ * entirely outside the margins, clear it.
*/
static void
adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines)
@@ -323,6 +371,8 @@ adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines)
? (screen->bot_marg - screen->savelines)
: screen->top_marg);
int hi_row = screen->bot_marg;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
TRACE2(("adjustSelection FWD %s by %d (%s)\n",
screen->whichBuf ? "alternate" : "normal",
@@ -336,8 +386,19 @@ adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines)
TRACE2((" margins %d..%d\n", screen->top_marg, screen->bot_marg));
TRACE2((" limits %d..%d\n", lo_row, hi_row));
- if (screen->startH.row >= lo_row
- && screen->startH.row - amount < lo_row) {
+ if ((left > 0 || right < screen->max_col) &&
+ ((screen->startH.row >= lo_row &&
+ screen->startH.row - amount <= hi_row) ||
+ (screen->endH.row >= lo_row &&
+ screen->endH.row - amount <= hi_row))) {
+ /*
+ * This could be improved slightly by excluding the special case where
+ * the selection is on a single line outside left/right margins.
+ */
+ TRACE2(("deselect because selection overlaps with scrolled partial-line\n"));
+ ScrnDisownSelection(xw);
+ } else if (screen->startH.row >= lo_row
+ && screen->startH.row - amount < lo_row) {
/* truncate the selection because its start would move out of region */
if (lo_row + amount <= screen->endH.row) {
TRACE2(("truncate selection by changing start %d.%d to %d.%d\n",
@@ -359,8 +420,10 @@ adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines)
ScrnDisownSelection(xw);
}
} else if (screen->startH.row <= hi_row && screen->endH.row > hi_row) {
+ TRACE2(("deselect because selection straddles top-margin\n"));
ScrnDisownSelection(xw);
} else if (screen->startH.row < lo_row && screen->endH.row > lo_row) {
+ TRACE2(("deselect because selection straddles bottom-margin\n"));
ScrnDisownSelection(xw);
}
@@ -429,6 +492,46 @@ adjustHiliteOnBakScroll(XtermWidget xw, int amount)
}
/*
+ * Move cells in LineData's on the current screen to simulate scrolling by the
+ * given amount of lines.
+ */
+static void
+scrollInMargins(XtermWidget xw, int amount, int top)
+{
+ TScreen *screen = TScreenOf(xw);
+ LineData *src;
+ LineData *dst;
+ int row;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
+ int length = right + 1 - left;
+
+ if (amount > 0) {
+ for (row = top; row <= screen->bot_marg - amount; ++row) {
+ if ((src = getLineData(screen, row + amount)) != 0
+ && (dst = getLineData(screen, row)) != 0) {
+ CopyCells(screen, src, dst, left, length);
+ }
+ }
+ while (row <= screen->bot_marg) {
+ ClearCells(xw, 0, (unsigned) length, row, left);
+ ++row;
+ }
+ } else if (amount < 0) {
+ for (row = screen->bot_marg; row >= top - amount; --row) {
+ if ((src = getLineData(screen, row + amount)) != 0
+ && (dst = getLineData(screen, row)) != 0) {
+ CopyCells(screen, src, dst, left, length);
+ }
+ }
+ while (row >= top) {
+ ClearCells(xw, 0, (unsigned) length, row, left);
+ --row;
+ }
+ }
+}
+
+/*
* scrolls the screen by amount lines, erases bottom, doesn't alter
* cursor position (i.e. cursor moves down amount relative to text).
* All done within the scrolling region, of course.
@@ -438,13 +541,15 @@ void
xtermScroll(XtermWidget xw, int amount)
{
TScreen *screen = TScreenOf(xw);
- int i = screen->bot_marg - screen->top_marg + 1;
+ int i;
int shift;
int bot;
int refreshtop = 0;
int refreshheight;
int scrolltop;
int scrollheight;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
Boolean scroll_all_lines = (Boolean) (screen->scrollWidget
&& !screen->whichBuf
&& screen->top_marg == 0);
@@ -457,6 +562,7 @@ xtermScroll(XtermWidget xw, int amount)
if (screen->cursor_state)
HideCursor();
+ i = screen->bot_marg - screen->top_marg + 1;
if (amount > i)
amount = i;
@@ -541,14 +647,20 @@ xtermScroll(XtermWidget xw, int amount)
screen->scrolls++;
}
- scrolling_copy_area(xw, scrolltop + amount, scrollheight, amount);
+ vertical_copy_area(xw,
+ scrolltop + amount,
+ scrollheight,
+ amount,
+ left,
+ right);
if (refreshheight > 0) {
ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
+ refreshtop,
+ left,
+ (unsigned) refreshheight,
+ (unsigned) (right + 1 - left),
+ (unsigned) FontWidth(screen));
if (refreshheight > shift)
refreshheight = shift;
}
@@ -556,7 +668,9 @@ xtermScroll(XtermWidget xw, int amount)
}
if (amount > 0) {
- if (scroll_all_lines) {
+ if (left > 0 || right < screen->max_col) {
+ scrollInMargins(xw, amount, screen->top_marg);
+ } else if (scroll_all_lines) {
ScrnDeleteLine(xw,
screen->saveBuf_index,
screen->bot_marg + screen->savelines,
@@ -572,8 +686,12 @@ xtermScroll(XtermWidget xw, int amount)
}
if (refreshheight > 0) {
- ScrnRefresh(xw, refreshtop, 0, refreshheight,
- MaxCols(screen), False);
+ ScrnRefresh(xw,
+ refreshtop,
+ left,
+ refreshheight,
+ right + 1 - left,
+ False);
}
screen->cursor_busy -= 1;
@@ -598,18 +716,21 @@ void
xtermColIndex(XtermWidget xw, Bool toLeft)
{
TScreen *screen = TScreenOf(xw);
+ int margin;
if (toLeft) {
- if (screen->cur_col) {
+ margin = ScrnLeftMargin(xw);
+ if (screen->cur_col > margin) {
CursorBack(xw, 1);
- } else {
- xtermColScroll(xw, 1, False, 0);
+ } else if (screen->cur_col == margin) {
+ xtermColScroll(xw, 1, False, screen->cur_col);
}
} else {
- if (screen->cur_col < screen->max_col) {
- CursorForward(screen, 1);
- } else {
- xtermColScroll(xw, 1, True, 0);
+ margin = ScrnRightMargin(xw);
+ if (screen->cur_col < margin) {
+ CursorForward(xw, 1);
+ } else if (screen->cur_col == margin) {
+ xtermColScroll(xw, 1, True, ScrnLeftMargin(xw));
}
}
}
@@ -620,27 +741,44 @@ xtermColIndex(XtermWidget xw, Bool toLeft)
void
xtermColScroll(XtermWidget xw, int amount, Bool toLeft, int at_col)
{
+ TScreen *screen = TScreenOf(xw);
+
if (amount > 0) {
- TScreen *screen = TScreenOf(xw);
- int save_row = screen->cur_row;
- int save_col = screen->cur_col;
- int row;
+ int min_row;
+ int max_row;
- screen->cur_col = at_col;
- if (toLeft) {
- for (row = 0; row <= screen->max_row; row++) {
- screen->cur_row = row;
- ScrnDeleteChar(xw, (unsigned) amount);
- }
+ if (ScrnHaveRowMargins(screen)) {
+ min_row = screen->top_marg;
+ max_row = screen->bot_marg;
} else {
- for (row = 0; row <= screen->max_row; row++) {
- screen->cur_row = row;
- ScrnInsertChar(xw, (unsigned) amount);
+ min_row = 0;
+ max_row = screen->max_row;
+ }
+
+ if (screen->cur_row >= min_row
+ && screen->cur_row <= max_row
+ && screen->cur_col >= screen->lft_marg
+ && screen->cur_col <= screen->rgt_marg) {
+ int save_row = screen->cur_row;
+ int save_col = screen->cur_col;
+ int row;
+
+ screen->cur_col = at_col;
+ if (toLeft) {
+ for (row = min_row; row <= max_row; row++) {
+ screen->cur_row = row;
+ ScrnDeleteChar(xw, (unsigned) amount);
+ }
+ } else {
+ for (row = min_row; row <= max_row; row++) {
+ screen->cur_row = row;
+ ScrnInsertChar(xw, (unsigned) amount);
+ }
}
+ screen->cur_row = save_row;
+ screen->cur_col = save_col;
+ xtermRepaint(xw);
}
- screen->cur_row = save_row;
- screen->cur_col = save_col;
- xtermRepaint(xw);
}
}
@@ -661,6 +799,8 @@ RevScroll(XtermWidget xw, int amount)
int refreshheight;
int scrolltop;
int scrollheight;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
TRACE(("RevScroll count=%d\n", amount));
@@ -692,8 +832,7 @@ RevScroll(XtermWidget xw, int amount)
shift = INX2ROW(screen, 0);
bot = screen->max_row - shift;
refreshheight = amount;
- scrollheight = screen->bot_marg - screen->top_marg -
- refreshheight + 1;
+ scrollheight = screen->bot_marg - screen->top_marg - refreshheight + 1;
refreshtop = screen->top_marg + shift;
scrolltop = refreshtop + refreshheight;
if ((i = screen->bot_marg - bot) > 0)
@@ -709,27 +848,165 @@ RevScroll(XtermWidget xw, int amount)
screen->scrolls++;
}
- scrolling_copy_area(xw, scrolltop - amount, scrollheight, -amount);
+ vertical_copy_area(xw,
+ scrolltop - amount,
+ scrollheight,
+ -amount,
+ left,
+ right);
if (refreshheight > 0) {
ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
+ refreshtop,
+ left,
+ (unsigned) refreshheight,
+ (unsigned) (right + 1 - left),
+ (unsigned) FontWidth(screen));
}
}
if (amount > 0) {
- ScrnInsertLine(xw,
- screen->visbuf,
- screen->bot_marg,
- screen->top_marg,
- (unsigned) amount);
+ if (left > 0 || right < screen->max_col) {
+ scrollInMargins(xw, -amount, screen->top_marg);
+ } else {
+ ScrnInsertLine(xw,
+ screen->visbuf,
+ screen->bot_marg,
+ screen->top_marg,
+ (unsigned) amount);
+ }
}
screen->cursor_busy -= 1;
return;
}
+#if OPT_ZICONBEEP
+void
+initZIconBeep(void)
+{
+ if (resource.zIconBeep > 100 || resource.zIconBeep < -100) {
+ resource.zIconBeep = 0; /* was 100, but I prefer to defaulting off. */
+ xtermWarning("a number between -100 and 100 is required for zIconBeep. 0 used by default\n");
+ }
+}
+
+static void
+setZIconBeep(XtermWidget xw)
+{
+ TScreen *screen = TScreenOf(xw);
+
+ /* Flag icon name with "***" on window output when iconified.
+ */
+ if (resource.zIconBeep && mapstate == IsUnmapped && !screen->zIconBeep_flagged) {
+ static char *icon_name;
+ static Arg args[] =
+ {
+ {XtNiconName, (XtArgVal) & icon_name}
+ };
+
+ icon_name = NULL;
+ XtGetValues(toplevel, args, XtNumber(args));
+
+ if (icon_name != NULL) {
+ screen->zIconBeep_flagged = True;
+ ChangeIconName(xw, icon_name);
+ }
+ xtermBell(xw, XkbBI_Info, 0);
+ }
+ mapstate = -1;
+}
+
+/*
+ * If warning should be given then give it
+ */
+Boolean
+showZIconBeep(XtermWidget xw, char *name)
+{
+ Boolean code = False;
+
+ if (resource.zIconBeep && TScreenOf(xw)->zIconBeep_flagged) {
+ char *format = resource.zIconFormat;
+ char *newname = CastMallocN(char, strlen(name) + strlen(format) + 1);
+ if (!newname) {
+ xtermWarning("malloc failed in showZIconBeep\n");
+ } else {
+ char *marker = strstr(format, "%s");
+ char *result = newname;
+ if (marker != 0) {
+ size_t skip = (size_t) (marker - format);
+ if (skip) {
+ strncpy(result, format, skip);
+ result += skip;
+ }
+ strcpy(result, name);
+ strcat(result, marker + 2);
+ } else {
+ strcpy(result, format);
+ strcat(result, name);
+ }
+ ChangeGroup(xw, XtNiconName, newname);
+ free(newname);
+ }
+ code = True;
+ }
+ return code;
+}
+
+/*
+ * Restore the icon name, resetting the state for zIconBeep.
+ */
+void
+resetZIconBeep(XtermWidget xw)
+{
+ static char *icon_name;
+ static Arg args[] =
+ {
+ {XtNiconName, (XtArgVal) & icon_name}
+ };
+ TScreen *screen = TScreenOf(xw);
+
+ if (screen->zIconBeep_flagged) {
+ screen->zIconBeep_flagged = False;
+ icon_name = NULL;
+ XtGetValues(toplevel, args, XtNumber(args));
+ if (icon_name != NULL) {
+ char *buf = CastMallocN(char, strlen(icon_name));
+ if (buf == NULL) {
+ screen->zIconBeep_flagged = True;
+ } else {
+ char *format = resource.zIconFormat;
+ char *marker = strstr(format, "%s");
+ Boolean found = False;
+
+ if (marker != 0) {
+ if (marker == format
+ || !strncmp(icon_name, format, (size_t) (marker - format))) {
+ found = True;
+ strcpy(buf, icon_name + (marker - format));
+ marker += 2;
+ if (*marker != '\0') {
+ size_t len_m = strlen(marker);
+ size_t len_b = strlen(buf);
+ if (len_m < len_b
+ && !strcmp(buf + len_b - len_m, marker)) {
+ buf[len_b - len_m] = '\0';
+ }
+ }
+ }
+ } else if (!strncmp(icon_name, format, strlen(format))) {
+ strcpy(buf, icon_name + strlen(format));
+ found = True;
+ }
+ if (found)
+ ChangeIconName(xw, buf);
+ free(buf);
+ }
+ }
+ }
+}
+#else
+#define setZIconBeep(xw) /* nothing */
+#endif /* OPT_ZICONBEEP */
+
/*
* write a string str of length len onto the screen at
* the current cursor position. update cursor position.
@@ -757,7 +1034,7 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
}
if (ScrnHaveSelection(screen)
- && ScrnIsLineInSelection(screen, INX2ROW(screen, screen->cur_row))) {
+ && ScrnIsRowInSelection(screen, INX2ROW(screen, screen->cur_row))) {
ScrnDisownSelection(xw);
}
@@ -816,28 +1093,8 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
}
ScrnWriteText(xw, str, flags, fg_bg, len);
- CursorForward(screen, (int) cells);
-#if OPT_ZICONBEEP
- /* Flag icon name with "***" on window output when iconified.
- */
- if (resource.zIconBeep && mapstate == IsUnmapped && !screen->zIconBeep_flagged) {
- static char *icon_name;
- static Arg args[] =
- {
- {XtNiconName, (XtArgVal) & icon_name}
- };
-
- icon_name = NULL;
- XtGetValues(toplevel, args, XtNumber(args));
-
- if (icon_name != NULL) {
- screen->zIconBeep_flagged = True;
- ChangeIconName(xw, icon_name);
- }
- xtermBell(xw, XkbBI_Info, 0);
- }
- mapstate = -1;
-#endif /* OPT_ZICONBEEP */
+ CursorForward(xw, (int) cells);
+ setZIconBeep(xw);
return;
}
@@ -857,8 +1114,12 @@ InsertLine(XtermWidget xw, int n)
int refreshheight;
int scrolltop;
int scrollheight;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
- if (!ScrnIsLineInMargins(screen, screen->cur_row))
+ if (!ScrnIsRowInMargins(screen, screen->cur_row)
+ || screen->cur_col < left
+ || screen->cur_col > right)
return;
TRACE(("InsertLine count=%d\n", n));
@@ -867,12 +1128,12 @@ InsertLine(XtermWidget xw, int n)
HideCursor();
if (ScrnHaveSelection(screen)
- && ScrnAreLinesInSelection(screen,
- INX2ROW(screen, screen->top_marg),
- INX2ROW(screen, screen->cur_row - 1))
- && ScrnAreLinesInSelection(screen,
- INX2ROW(screen, screen->cur_row),
- INX2ROW(screen, screen->bot_marg))) {
+ && ScrnAreRowsInSelection(screen,
+ INX2ROW(screen, screen->top_marg),
+ INX2ROW(screen, screen->cur_row - 1))
+ && ScrnAreRowsInSelection(screen,
+ INX2ROW(screen, screen->cur_row),
+ INX2ROW(screen, screen->bot_marg))) {
ScrnDisownSelection(xw);
}
@@ -902,21 +1163,26 @@ InsertLine(XtermWidget xw, int n)
scrollheight -= i;
if ((i = screen->cur_row + refreshheight - 1 - bot) > 0)
refreshheight -= i;
- vertical_copy_area(xw, scrolltop - n, scrollheight, -n);
+ vertical_copy_area(xw, scrolltop - n, scrollheight, -n, left, right);
if (refreshheight > 0) {
ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
+ refreshtop,
+ left,
+ (unsigned) refreshheight,
+ (unsigned) (right + 1 - left),
+ (unsigned) FontWidth(screen));
}
}
if (n > 0) {
- ScrnInsertLine(xw,
- screen->visbuf,
- screen->bot_marg,
- screen->cur_row,
- (unsigned) n);
+ if (left > 0 || right < screen->max_col) {
+ scrollInMargins(xw, -n, screen->cur_row);
+ } else {
+ ScrnInsertLine(xw,
+ screen->visbuf,
+ screen->bot_marg,
+ screen->cur_row,
+ (unsigned) n);
+ }
}
}
@@ -935,11 +1201,15 @@ DeleteLine(XtermWidget xw, int n)
int refreshheight;
int scrolltop;
int scrollheight;
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
Boolean scroll_all_lines = (Boolean) (screen->scrollWidget
&& !screen->whichBuf
&& screen->cur_row == 0);
- if (!ScrnIsLineInMargins(screen, screen->cur_row))
+ if (!ScrnIsRowInMargins(screen, screen->cur_row)
+ || screen->cur_col < left
+ || screen->cur_col > right)
return;
TRACE(("DeleteLine count=%d\n", n));
@@ -951,9 +1221,9 @@ DeleteLine(XtermWidget xw, int n)
n = i;
}
if (ScrnHaveSelection(screen)
- && ScrnAreLinesInSelection(screen,
- INX2ROW(screen, screen->cur_row),
- INX2ROW(screen, screen->cur_row + n - 1))) {
+ && ScrnAreRowsInSelection(screen,
+ INX2ROW(screen, screen->cur_row),
+ INX2ROW(screen, screen->cur_row + n - 1))) {
ScrnDisownSelection(xw);
}
@@ -972,18 +1242,21 @@ DeleteLine(XtermWidget xw, int n)
/* adjust screen->buf */
if (n > 0) {
- if (scroll_all_lines)
+ if (left > 0 || right < screen->max_col) {
+ scrollInMargins(xw, n, screen->cur_row);
+ } else if (scroll_all_lines) {
ScrnDeleteLine(xw,
screen->saveBuf_index,
screen->bot_marg + screen->savelines,
0,
(unsigned) n);
- else
+ } else {
ScrnDeleteLine(xw,
screen->visbuf,
screen->bot_marg,
screen->cur_row,
(unsigned) n);
+ }
}
/* repaint the screen, as needed */
@@ -1014,7 +1287,7 @@ DeleteLine(XtermWidget xw, int n)
}
}
}
- vertical_copy_area(xw, scrolltop + n, scrollheight, n);
+ vertical_copy_area(xw, scrolltop + n, scrollheight, n, left, right);
if (shift > 0 && refreshheight > 0) {
int rows = refreshheight;
if (rows > shift)
@@ -1025,10 +1298,11 @@ DeleteLine(XtermWidget xw, int n)
}
if (refreshheight > 0) {
ClearCurBackground(xw,
- (int) refreshtop * FontHeight(screen) + screen->border,
- (int) OriginX(screen),
- (unsigned) (refreshheight * FontHeight(screen)),
- (unsigned) Width(screen));
+ refreshtop,
+ left,
+ (unsigned) refreshheight,
+ (unsigned) (right + 1 - left),
+ (unsigned) FontWidth(screen));
}
}
}
@@ -1043,6 +1317,8 @@ InsertChar(XtermWidget xw, unsigned n)
LineData *ld;
unsigned limit;
int row = INX2ROW(screen, screen->cur_row);
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
if (screen->cursor_state)
HideCursor();
@@ -1050,21 +1326,21 @@ InsertChar(XtermWidget xw, unsigned n)
TRACE(("InsertChar count=%d\n", n));
if (ScrnHaveSelection(screen)
- && ScrnIsLineInSelection(screen, row)) {
+ && ScrnIsRowInSelection(screen, row)) {
ScrnDisownSelection(xw);
}
screen->do_wrap = False;
- assert(screen->cur_col <= screen->max_col);
- limit = (unsigned) (MaxCols(screen) - screen->cur_col);
+ limit = (unsigned) (right + 1 - screen->cur_col);
if (n > limit)
n = limit;
- assert(n != 0);
- if (AddToVisible(xw)
- && (ld = getLineData(screen, screen->cur_row)) != 0) {
- int col = MaxCols(screen) - (int) n;
+ if (screen->cur_col < left || screen->cur_col > right) {
+ n = 0;
+ } else if (AddToVisible(xw)
+ && (ld = getLineData(screen, screen->cur_row)) != 0) {
+ int col = right + 1 - (int) n;
/*
* If we shift part of a multi-column character, fill the rest
@@ -1102,13 +1378,16 @@ InsertChar(XtermWidget xw, unsigned n)
}
ClearCurBackground(xw,
- CursorY(screen, screen->cur_row),
- LineCursorX(screen, ld, screen->cur_col),
- (unsigned) FontHeight(screen),
- n * (unsigned) LineFontWidth(screen, ld));
+ screen->cur_row,
+ screen->cur_col,
+ 1,
+ n,
+ (unsigned) LineFontWidth(screen, ld));
+ }
+ if (n != 0) {
+ /* adjust screen->buf */
+ ScrnInsertChar(xw, n);
}
- /* adjust screen->buf */
- ScrnInsertChar(xw, n);
}
/*
@@ -1121,6 +1400,8 @@ DeleteChar(XtermWidget xw, unsigned n)
LineData *ld;
unsigned limit;
int row = INX2ROW(screen, screen->cur_row);
+ int left = ScrnLeftMargin(xw);
+ int right = ScrnRightMargin(xw);
if (screen->cursor_state)
HideCursor();
@@ -1128,21 +1409,21 @@ DeleteChar(XtermWidget xw, unsigned n)
TRACE(("DeleteChar count=%d\n", n));
if (ScrnHaveSelection(screen)
- && ScrnIsLineInSelection(screen, row)) {
+ && ScrnIsRowInSelection(screen, row)) {
ScrnDisownSelection(xw);
}
screen->do_wrap = False;
- assert(screen->cur_col <= screen->max_col);
- limit = (unsigned) (MaxCols(screen) - screen->cur_col);
+ limit = (unsigned) (right + 1 - screen->cur_col);
if (n > limit)
n = limit;
- assert(n != 0);
- if (AddToVisible(xw)
- && (ld = getLineData(screen, screen->cur_row)) != 0) {
- int col = MaxCols(screen) - (int) n;
+ if (screen->cur_col < left || screen->cur_col > right) {
+ n = 0;
+ } else if (AddToVisible(xw)
+ && (ld = getLineData(screen, screen->cur_row)) != 0) {
+ int col = right + 1 - (int) n;
/*
* If we delete part of a multi-column character, fill the rest
@@ -1166,10 +1447,11 @@ DeleteChar(XtermWidget xw, unsigned n)
-((int) n));
ClearCurBackground(xw,
- CursorY(screen, screen->cur_row),
- LineCursorX(screen, ld, col),
- (unsigned) FontHeight(screen),
- n * (unsigned) LineFontWidth(screen, ld));
+ screen->cur_row,
+ col,
+ 1,
+ n,
+ (unsigned) LineFontWidth(screen, ld));
}
if (n != 0) {
/* adjust screen->buf */
@@ -1204,10 +1486,11 @@ ClearAbove(XtermWidget xw)
height = screen->max_row + 1;
if ((height -= top) > 0) {
ClearCurBackground(xw,
- top * FontHeight(screen) + screen->border,
- OriginX(screen),
- (unsigned) (height * FontHeight(screen)),
- (unsigned) (Width(screen)));
+ top,
+ 0,
+ (unsigned) height,
+ (unsigned) MaxCols(screen),
+ (unsigned) FontWidth(screen));
}
}
ClearBufRows(xw, 0, screen->cur_row - 1);
@@ -1241,11 +1524,11 @@ ClearBelow(XtermWidget xw)
FlushScroll(xw);
if (++top <= screen->max_row) {
ClearCurBackground(xw,
- top * FontHeight(screen) + screen->border,
- OriginX(screen),
- (unsigned) ((screen->max_row - top + 1)
- * FontHeight(screen)),
- (unsigned) (Width(screen)));
+ top,
+ 0,
+ (unsigned) (screen->max_row - top + 1),
+ (unsigned) MaxCols(screen),
+ (unsigned) FontWidth(screen));
}
}
ClearBufRows(xw, screen->cur_row + 1, screen->max_row);
@@ -1269,7 +1552,7 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len)
screen->startH.col));
if (ScrnHaveSelection(screen)
- && ScrnIsLineInSelection(screen, row)) {
+ && ScrnIsRowInSelection(screen, row)) {
ScrnDisownSelection(xw);
}
@@ -1328,10 +1611,11 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len)
&& (ld = getLineData(screen, row)) != 0) {
ClearCurBackground(xw,
- CursorY(screen, row),
- LineCursorX(screen, ld, col),
- (unsigned) FontHeight(screen),
- len * (unsigned) LineFontWidth(screen, ld));
+ row,
+ col,
+ 1,
+ len,
+ (unsigned) LineFontWidth(screen, ld));
}
if (len != 0) {
@@ -1466,11 +1750,11 @@ ClearScreen(XtermWidget xw)
if (screen->scroll_amt)
FlushScroll(xw);
ClearCurBackground(xw,
- top * FontHeight(screen) + screen->border,
- OriginX(screen),
- (unsigned) ((screen->max_row - top + 1)
- * FontHeight(screen)),
- (unsigned) Width(screen));
+ top,
+ 0,
+ (unsigned) (screen->max_row - top + 1),
+ (unsigned) MaxCols(screen),
+ (unsigned) FontWidth(screen));
}
ClearBufRows(xw, 0, screen->max_row);
}
@@ -1680,18 +1964,21 @@ static void
vertical_copy_area(XtermWidget xw,
int firstline, /* line on screen to start copying at */
int nlines,
- int amount) /* number of lines to move up (neg=down) */
+ int amount, /* number of lines to move up (neg=down) */
+ int left,
+ int right)
{
TScreen *screen = TScreenOf(xw);
if (nlines > 0) {
- int src_x = OriginX(screen);
+ int src_x = CursorX(screen, left);
int src_y = firstline * FontHeight(screen) + screen->border;
copy_area(xw, src_x, src_y,
- (unsigned) Width(screen),
+ (unsigned) ((right + 1 - left) * FontWidth(screen)),
(unsigned) (nlines * FontHeight(screen)),
src_x, src_y - amount * FontHeight(screen));
+
if (screen->show_wrap_marks) {
LineData *ld;
int row;
@@ -1715,7 +2002,7 @@ scrolling_copy_area(XtermWidget xw,
{
if (nlines > 0) {
- vertical_copy_area(xw, firstline, nlines, amount);
+ vertical_copy_area(xw, firstline, nlines, amount, 0, TScreenOf(xw)->max_col);
}
}
@@ -3676,18 +3963,27 @@ ClearCurBackground(XtermWidget xw,
int top,
int left,
unsigned height,
- unsigned width)
+ unsigned width,
+ unsigned fw)
{
TScreen *screen = TScreenOf(xw);
- TRACE(("ClearCurBackground(%d,%d,%d,%d) %d\n",
+ TRACE(("ClearCurBackground %d,%d %dx%d with %d\n",
top, left, height, width, xw->cur_background));
+ assert((int) width > 0);
+ assert((left + (int) width) <= screen->max_col + 1);
+ assert((int) height <= screen->max_row + 1);
+
if (VWindow(screen)) {
set_background(xw, xw->cur_background);
XClearArea(screen->display, VWindow(screen),
- left, top, width, height, False);
+ CursorX2(screen, left, fw),
+ CursorY(screen, top),
+ (width * fw),
+ (height * (unsigned) FontHeight(screen)),
+ False);
set_background(xw, -1);
}
@@ -3750,6 +4046,13 @@ addXtermCombining(TScreen * screen, int row, int col, unsigned ch)
}
}
}
+
+unsigned
+getXtermCombining(TScreen * screen, int row, int col, int off)
+{
+ LineData *ld = getLineData(screen, row);
+ return ld->combData[off][col];
+}
#endif
#ifdef HAVE_CONFIG_H
diff --git a/app/xterm/version.h b/app/xterm/version.h
index d7b2a46b2..456550050 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,7 +1,7 @@
-/* $XTermId: version.h,v 1.337 2012/01/12 12:45:36 tom Exp $ */
+/* $XTermId: version.h,v 1.339 2012/03/15 00:00:22 tom Exp $ */
/*
- * Copyright 1998-2010,2011 by Thomas E. Dickey
+ * Copyright 1998-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -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 278
+#define XTERM_PATCH 279
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/xstrings.c b/app/xterm/xstrings.c
index 5fe083536..395def5ab 100644
--- a/app/xterm/xstrings.c
+++ b/app/xterm/xstrings.c
@@ -1,7 +1,7 @@
-/* $XTermId: xstrings.c,v 1.47 2011/09/11 20:20:12 tom Exp $ */
+/* $XTermId: xstrings.c,v 1.50 2012/03/30 10:54:12 tom Exp $ */
/*
- * Copyright 2000-2010,2011 by Thomas E. Dickey
+ * Copyright 2000-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -141,42 +141,21 @@ x_encode_hex(const char *source)
char *
x_getenv(const char *name)
{
- return x_strdup(x_nonempty(getenv(name)));
+ char *result;
+ result = x_strdup(x_nonempty(getenv(name)));
+ TRACE2(("getenv(%s) %s\n", name, result));
+ return result;
}
-/*
- * Call this with in_out pointing to data filled in by x_getpwnam() or by
- * x_getpwnam(). It finds the user's logon name, if possible. As a side
- * effect, it updates in_out to fill in possibly more-relevant data, i.e.,
- * in case there is more than one alias for the same uid.
- */
-char *
-x_getlogin(uid_t uid, struct passwd *in_out)
+static char *
+login_alias(char *login_name, uid_t uid, struct passwd *in_out)
{
- char *login_name = NULL;
-
-#ifdef HAVE_GETLOGIN
- login_name = getlogin();
-#endif
-
- /*
- * Of course getlogin() will fail if we're started from a window-manager,
- * since there's no controlling terminal to fuss with. In that case, try
- * to get something useful from the user's $LOGNAME or $USER environment
- * variables.
- */
- if (login_name == NULL) {
- login_name = x_getenv("LOGNAME");
- if (login_name == NULL)
- login_name = x_getenv("USER");
- }
-
/*
* If the logon-name differs from the value we get by looking in the
* password file, check if it does correspond to the same uid. If so,
* allow that as an alias for the uid.
*/
- if (login_name != NULL
+ if (!IsEmpty(login_name)
&& strcmp(login_name, in_out->pw_name)) {
struct passwd pw2;
@@ -184,23 +163,52 @@ x_getlogin(uid_t uid, struct passwd *in_out)
uid_t uid2 = pw2.pw_uid;
struct passwd pw3;
- if (!x_getpwuid(uid, &pw3)
- || (uid_t) pw3.pw_uid != uid2) {
- login_name = NULL;
- } else {
+ if (x_getpwuid(uid, &pw3)
+ && ((uid_t) pw3.pw_uid == uid2)) {
/* use the other passwd-data including shell */
alloc_pw(in_out, &pw2);
+ } else {
+ login_name = NULL;
}
- } else {
- (void) x_getpwuid(uid, in_out);
}
}
+ return login_name;
+}
+
+/*
+ * Call this with in_out pointing to data filled in by x_getpwnam() or by
+ * x_getpwnam(). It finds the user's logon name, if possible. As a side
+ * effect, it updates in_out to fill in possibly more-relevant data, i.e.,
+ * in case there is more than one alias for the same uid.
+ */
+char *
+x_getlogin(uid_t uid, struct passwd *in_out)
+{
+ char *login_name = NULL;
+
+ login_name = login_alias(x_getenv("LOGNAME"), uid, in_out);
+ if (IsEmpty(login_name)) {
+ login_name = login_alias(x_getenv("USER"), uid, in_out);
+ }
+#ifdef HAVE_GETLOGIN
+ /*
+ * Of course getlogin() will fail if we're started from a window-manager,
+ * since there's no controlling terminal to fuss with. For that reason, we
+ * tried first to get something useful from the user's $LOGNAME or $USER
+ * environment variables.
+ */
+ if (IsEmpty(login_name)) {
+ TRACE2(("...try getlogin\n"));
+ login_name = login_alias(getlogin(), uid, in_out);
+ }
+#endif
- if (login_name == NULL)
+ if (IsEmpty(login_name))
login_name = in_out->pw_name;
- if (login_name != NULL)
+ if (!IsEmpty(login_name))
login_name = x_strdup(login_name);
+ TRACE2(("x_getloginid ->%s\n", NonNull(login_name)));
return login_name;
}
@@ -214,7 +222,7 @@ x_getpwnam(const char *name, struct passwd * result)
struct passwd *ptr = getpwnam(name);
Boolean code;
- if (OkPasswd(ptr)) {
+ if (ptr != 0 && OkPasswd(ptr)) {
code = True;
alloc_pw(result, ptr);
} else {
@@ -234,13 +242,14 @@ x_getpwuid(uid_t uid, struct passwd * result)
struct passwd *ptr = getpwuid((uid_t) uid);
Boolean code;
- if (OkPasswd(ptr)) {
+ if (ptr != 0 && OkPasswd(ptr)) {
code = True;
alloc_pw(result, ptr);
} else {
code = False;
memset(result, 0, sizeof(*result));
}
+ TRACE2(("x_getpwuid(%d) %d\n", (int) uid, (int) code));
return code;
}
diff --git a/app/xterm/xstrings.h b/app/xterm/xstrings.h
index 31ec408ca..372d949e8 100644
--- a/app/xterm/xstrings.h
+++ b/app/xterm/xstrings.h
@@ -1,7 +1,7 @@
-/* $XTermId: xstrings.h,v 1.25 2011/09/11 20:20:22 tom Exp $ */
+/* $XTermId: xstrings.h,v 1.27 2012/03/25 23:31:52 tom Exp $ */
/*
- * Copyright 2000-2009,2011 by Thomas E. Dickey
+ * Copyright 2000-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index d552da433..36b279992 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,7 +1,7 @@
-/* $XTermId: xterm.h,v 1.673 2011/12/27 09:51:07 tom Exp $ */
+/* $XTermId: xterm.h,v 1.694 2012/05/09 10:47:22 tom Exp $ */
/*
- * Copyright 1999-2010,2011 by Thomas E. Dickey
+ * Copyright 1999-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -467,6 +467,7 @@ extern char **environ;
#define XtNpointerMode "pointerMode"
#define XtNpointerShape "pointerShape"
#define XtNpopOnBell "popOnBell"
+#define XtNprecompose "precompose"
#define XtNprintAttributes "printAttributes"
#define XtNprinterAutoClose "printerAutoClose"
#define XtNprinterCommand "printerCommand"
@@ -477,7 +478,7 @@ extern char **environ;
#define XtNquietGrab "quietGrab"
#define XtNrenderFont "renderFont"
#define XtNresizeGravity "resizeGravity"
-#define XtNretryInputMethod "retryInputMethod"
+#define XtNretryInputMethod "retryInputMethod"
#define XtNreverseWrap "reverseWrap"
#define XtNrightScrollBar "rightScrollBar"
#define XtNsaveLines "saveLines"
@@ -634,6 +635,7 @@ extern char **environ;
#define XtCOldXtermFKeys "OldXtermFKeys"
#define XtCPointerMode "PointerMode"
#define XtCPopOnBell "PopOnBell"
+#define XtCPrecompose "Precompose"
#define XtCPrintAttributes "PrintAttributes"
#define XtCPrinterAutoClose "PrinterAutoClose"
#define XtCPrinterCommand "PrinterCommand"
@@ -644,7 +646,7 @@ extern char **environ;
#define XtCQuietGrab "QuietGrab"
#define XtCRenderFont "RenderFont"
#define XtCResizeGravity "ResizeGravity"
-#define XtCRetryInputMethod "RetryInputMethod"
+#define XtCRetryInputMethod "RetryInputMethod"
#define XtCReverseWrap "ReverseWrap"
#define XtCRightScrollBar "RightScrollBar"
#define XtCSaveLines "SaveLines"
@@ -838,6 +840,7 @@ extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/);
extern void resetCharsets (TScreen * /* screen */);
extern void set_max_col(TScreen * /* screen */, int /* cols */);
extern void set_max_row(TScreen * /* screen */, int /* rows */);
+extern void set_lr_margins (TScreen * /* screen */, int /* left */, int /* right */);
extern void set_tb_margins (TScreen * /* screen */, int /* top */, int /* bottom */);
extern void unparse_end (XtermWidget /* xw */);
extern void unparseputc (XtermWidget /* xw */, int /* c */);
@@ -852,6 +855,10 @@ extern void xtermAddInput(Widget /* w */);
extern void ToggleCursorBlink(TScreen * /* screen */);
#endif
+#if OPT_BLINK_TEXT
+extern Bool LineHasBlinking(TScreen * /* screen */, LineData * /* ld */);
+#endif
+
#if OPT_INPUT_METHOD
extern TInput *lookupTInput (XtermWidget /* xw */, Widget /* w */);
#endif
@@ -870,13 +877,15 @@ extern unsigned xtermCharSetIn (unsigned /* code */, int /* charset */);
extern int xtermCharSetOut (XtermWidget /* xw */, IChar * /* buf */, IChar * /* ptr */, int /* charset */);
/* cursor.c */
+extern int CursorCol (XtermWidget /* xw */);
+extern int CursorRow (XtermWidget /* xw */);
extern void AdjustSavedCursor (XtermWidget /* xw */, int /* adjust */);
-extern void CarriageReturn (TScreen * /* screen */);
-extern void CursorBack (XtermWidget /* xw */, int /* n */);
-extern void CursorDown (TScreen * /* screen */, int /* n */);
-extern void CursorForward (TScreen * /* screen */, int /* n */);
-extern void CursorNextLine (TScreen * /* screen */, int /* count */);
-extern void CursorPrevLine (TScreen * /* screen */, int /* count */);
+extern void CarriageReturn (XtermWidget /* xw */);
+extern void CursorBack (XtermWidget /* xw */, int /* n */);
+extern void CursorDown (TScreen * /* screen */, int /* n */);
+extern void CursorForward (XtermWidget /* xw */, int /* n */);
+extern void CursorNextLine (XtermWidget /* xw */, int /* count */);
+extern void CursorPrevLine (XtermWidget /* xw */, int /* count */);
extern void CursorRestore (XtermWidget /* xw */);
extern void CursorSave (XtermWidget /* xw */);
extern void CursorSet (TScreen * /* screen */, int /* row */, int /* col */, unsigned /* flags */);
@@ -896,6 +905,7 @@ extern int set_cur_row(TScreen * /* screen */, int /* value */);
extern void xterm_DECDHL (XtermWidget /* xw */, Bool /* top */);
extern void xterm_DECSWL (XtermWidget /* xw */);
extern void xterm_DECDWL (XtermWidget /* xw */);
+extern void xterm_ResetDouble(XtermWidget /* xw */);
#if OPT_DEC_CHRSET
extern int xterm_Double_index(XtermWidget /* xw */, unsigned /* chrset */, unsigned /* flags */);
extern GC xterm_DoubleGC(XtermWidget /* xw */, unsigned /* chrset */, unsigned /* flags */, GC /* old_gc */, int * /* inxp */);
@@ -984,6 +994,7 @@ extern int xerror (Display * /* d */, XErrorEvent * /* ev */);
extern int xioerror (Display * /* dpy */);
extern int xtermResetIds(TScreen * /* screen */);
extern void Bell (XtermWidget /* xw */, int /* which */, int /* percent */);
+extern void ChangeGroup(XtermWidget /* xw */, const char * /* attribute */, char * /* value */);
extern void ChangeIconName (XtermWidget /* xw */, char * /* name */);
extern void ChangeTitle (XtermWidget /* xw */, char * /* name */);
extern void ChangeXprop (char * /* name */);
@@ -1139,14 +1150,15 @@ extern void writePtyData (int /* f */, IChar * /* d */, unsigned /* len */);
/* screen.c */
extern Bool non_blank_line (TScreen */* screen */, int /* row */, int /* col */, int /* len */);
-extern Char * allocScrnData(TScreen * /* screen */, unsigned /* nrow */, unsigned /* ncol */);
+extern Char * allocScrnData (TScreen * /* screen */, unsigned /* nrow */, unsigned /* ncol */);
extern ScrnBuf allocScrnBuf (XtermWidget /* xw */, unsigned /* nrow */, unsigned /* ncol */, ScrnPtr * /* addr */);
extern ScrnBuf scrnHeadAddr (TScreen * /* screen */, ScrnBuf /* base */, unsigned /* offset */);
extern int ScreenResize (XtermWidget /* xw */, int /* width */, int /* height */, unsigned * /* flags */);
extern size_t ScrnPointers (TScreen * /* screen */, size_t /* len */);
extern void ClearBufRows (XtermWidget /* xw */, int /* first */, int /* last */);
extern void ClearCells (XtermWidget /* xw */, int /* flags */, unsigned /* len */, int /* row */, int /* col */);
-extern void FullScreen(XtermWidget /* xw */, Bool /* enabled */);
+extern void CopyCells (TScreen * /* screen */, LineData * /* src */, LineData * /* dst */, int /* col */, int /* len */);
+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 */);
@@ -1190,23 +1202,38 @@ extern void LineSetFlag(LineData /* ld */, int /* flag */);
((screen)->startH.row != (screen)->endH.row \
|| (screen)->startH.col != (screen)->endH.col)
-#define ScrnAreLinesInSelection(screen, first, last) \
+#define ScrnAreRowsInSelection(screen, first, last) \
((last) >= (screen)->startH.row && (first) <= (screen)->endH.row)
-#define ScrnIsLineInSelection(screen, line) \
+#define ScrnIsRowInSelection(screen, line) \
((line) >= (screen)->startH.row && (line) <= (screen)->endH.row)
-#define ScrnHaveLineMargins(screen) \
+#define ScrnHaveRowMargins(screen) \
((screen)->top_marg != 0 \
|| ((screen)->bot_marg != screen->max_row))
-#define ScrnIsLineInMargins(screen, line) \
+#define ScrnIsRowInMargins(screen, line) \
((line) >= (screen)->top_marg && (line) <= (screen)->bot_marg)
+#define ScrnHaveColMargins(screen) \
+ ((screen)->rgt_marg > (screen)->max_col)
+
+#define ScrnIsColInMargins(screen, col) \
+ ((col) >= (screen)->lft_marg && (col) <= (screen)->rgt_marg)
+
+#define IsLeftRightMode(xw) ((xw)->flags & LEFT_RIGHT)
+#define ScrnLeftMargin(xw) (IsLeftRightMode(xw) \
+ ? TScreenOf(xw)->lft_marg \
+ : 0)
+#define ScrnRightMargin(xw) (IsLeftRightMode(xw) \
+ ? TScreenOf(xw)->rgt_marg \
+ : MaxCols(TScreenOf(xw)) - 1)
+
#if OPT_DEC_RECTOPS
extern void ScrnCopyRectangle (XtermWidget /* xw */, XTermRect *, int, int *);
extern void ScrnMarkRectangle (XtermWidget /* xw */, XTermRect *, Bool, int, int *);
extern void ScrnWipeRectangle (XtermWidget /* xw */, XTermRect *);
+extern void xtermCheckRect(XtermWidget /* xw */, int /* nparam */, int */* params */, int * /* result */);
#endif
#if OPT_WIDE_CHARS
@@ -1248,7 +1275,6 @@ extern void TabZonk (Tabs /* tabs */);
extern Boolean isDefaultBackground(const char * /* name */);
extern Boolean isDefaultForeground(const char * /* name */);
extern GC updatedXtermGC (XtermWidget /* xw */, unsigned /* flags */, unsigned /* fg_bg */, Bool /* hilite */);
-extern int AddToRefresh (XtermWidget /* xw */);
extern int ClearInLine (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */);
extern int HandleExposure (XtermWidget /* xw */, XEvent * /* event */);
extern int dimRound (double /* value */);
@@ -1291,7 +1317,7 @@ extern void xtermSizeHints (XtermWidget /* xw */, int /* scrollbarWidth */);
extern unsigned extract_fg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */);
extern unsigned extract_bg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */);
extern CellColor makeColorPair (int /* fg */, int /* bg */);
-extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* left */, unsigned /* height */, unsigned /* width */);
+extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* left */, unsigned /* height */, unsigned /* width */, unsigned /* fw */);
#define xtermColorPair(xw) makeColorPair(xw->sgr_foreground, xw->sgr_background)
@@ -1347,12 +1373,14 @@ extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */);
#define MapToColorMode(fg, screen, flags) fg
-#define ClearDFtBackground(xw, top, left, height, width) \
- ClearCurBackground(xw, top, left, height, width)
-
-#define ClearCurBackground(xw, top, left, height, width) \
- XClearArea (TScreenOf(xw)->display, VWindow(TScreenOf(xw)), \
- left, top, width, height, False)
+#define ClearCurBackground(xw, top, left, height, width, fw) \
+ XClearArea (TScreenOf(xw)->display, \
+ VWindow(TScreenOf(xw)), \
+ CursorX2(TScreenOf(xw), left, fw), \
+ CursorY(TScreenOf(xw), top), \
+ width * fw, \
+ height * FontHeight(TScreenOf(xw)), \
+ False)
#define extract_fg(xw, color, flags) (xw)->cur_foreground
#define extract_bg(xw, color, flags) (xw)->cur_background
@@ -1368,11 +1396,23 @@ extern Pixel xtermGetColorRes(XtermWidget /* xw */, ColorRes * /* res */);
#endif /* OPT_ISO_COLORS */
+#if OPT_ZICONBEEP
+extern void initZIconBeep(void);
+extern void resetZIconBeep(XtermWidget /* xw */);
+extern Boolean showZIconBeep(XtermWidget /* xw */, char * /* name */);
+#else
+#define initZIconBeep() /* nothing */
+#define showZIconBeep(xw, name) False
+#endif
+
#define XTERM_CELL(row,col) getXtermCell(screen, ROW2INX(screen, row), col)
extern unsigned getXtermCell (TScreen * /* screen */, int /* row */, int /* col */);
+extern unsigned getXtermCombining(TScreen * /* screen */, int /* row */, int /* col */, int /* off */);
extern void putXtermCell (TScreen * /* screen */, int /* row */, int /* col */, int /* ch */);
+#define IsCellCombined(screen, row, col) (getXtermCombining(screen, row, col, 0) != 0)
+
#if OPT_HIGHLIGHT_COLOR
#define isNotForeground(xw, fg, bg, sel) \
(Boolean) ((sel) != T_COLOR(TScreenOf(xw), TEXT_FG) \
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index 1510c4c3d..7b7dbcadf 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -3,7 +3,7 @@
*****************************************************************************
* this file is part of xterm *
* *
- * Copyright 1997-2010,2011 by Thomas E. Dickey *
+ * Copyright 1997-2011,2012 by Thomas E. Dickey *
* *
* All Rights Reserved *
* *
@@ -31,7 +31,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.1133 2012/01/19 01:54:00 tom Exp $
+ $XTermId: xterm.log.html,v 1.1167 2012/05/09 21:21:44 tom Exp $
-->
<HTML>
<HEAD>
@@ -43,7 +43,7 @@
<HR>
<a href=
"http://invisible-island.net/">http://invisible-island.net/</a><a href="http://invisible-island.net/xterm/">xterm/</a><br>
-Copyright &copy; 1997-2010,2011 by <A
+Copyright &copy; 1997-2011,2012 by <A
HREF="mailto:dickey@invisible-island.net">Thomas E. Dickey</A>
<HR>
<H1>Contents</H1>
@@ -58,6 +58,7 @@ Most of these are summarized in the XFree86 CHANGELOG
is the latest version of this file.
<UL>
+<LI><A HREF="#xterm_279">Patch #279 - 2012/05/10</A>
<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>
@@ -339,6 +340,108 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
+<H1><A NAME="xterm_279">Patch #279 - 2012/05/10</A></H1>
+<ul>
+ <li>fill in missing cases in the save/restore modes feature
+ (report by Thomas Wolff).
+
+ <li>add check to ensure that combining characters are precomposed in
+ the order given (report/analysis by Andries E Brouwer).
+
+ <li>improve workability check for posix_openpt(), to take into account
+ BSD systems which do not complete initialization until both sides
+ of the pseudoterminal are opened (report by Christian Weisgerber).
+
+ <li>amend fix for Debian #650291 in
+ <a href="#xterm_277">patch #277</a> changes to account for
+ different data returned by vnc4server
+ (Debian #670638).
+
+ <li>add check in DECCRA operation to make copies of blinking text also
+ blink by updating a line-level flag.
+
+ <li>modify rectangle operations to work with DECOM.
+
+ <li>modify DECSERA to use the current protected state rather than
+ preserving it.
+
+ <li>add <code>precompose</code> resource to allow storing character
+ data in Normalized Form D as described in
+ <a href="http://unicode.org/reports/tr15/">http://unicode.org/reports/tr15/</a>
+ (report/discussion with Andries E Brouwer).
+
+ <li>modify CBT, other ISO-6429 controls which are used by VT520 to
+ work with DECOM.
+
+ <li>add HPR and VPR controls, ISO 6429 cursor movement used in VT520.
+
+ <li>remove "linux" restriction for IUTF8 ifdef in main.c (prompted by
+ Matthew Dempsky posting on mailing.openbsd.tech).
+
+ <li>implement the remaining VT420-level device status reports.
+
+ <li>change DECXCPR to return page 1, rather than 0.
+
+ <li>improve VT-level checks on reporting functions, such as DECXCPR.
+
+ <li>change limit on <code>decTerminalID</code> to 525.
+
+ <li>fixes to improve vttest vt52 screen when running as a VT420:
+ <ul>
+ <li>add checks for some VT2xx and up controls for consistency:
+ DECSCL, S1C8T, S1C7T.
+ <li>modify DECRQSS return for DECSCL to only return that when
+ running as VT2xx and up.
+ <li>when exiting from VT52-mode, resume in VT100 level rather
+ than the level before starting VT52-mode.
+ </ul>
+
+ <li>implement DECLRMM, DECSLRMM and DECNCSM (prompted by discussions
+ with Ailin Nemui and Paul LeoNerd Evans). This modifies several
+ controls to obey top/bottom and left/right margins.
+
+ <li>correct macro definition used for testing modes used in ANSI/DEC
+ request-mode controls introduced
+ in <a href="#xterm_262">patch #262</a>.
+
+ <li>modify <code>x_getlogin</code> to check $LOGNAME and $USER before
+ fallback to <code>getlogin</code>, so that user's choice for these
+ variables can be carried forward to the xterm process
+ (Debian #611487).
+
+ <li>document DECSCUSR response for DECRQSS in ctlseqs.ms
+
+ <li>add <code>zIconTitleFormat</code> resource to allow customizing
+ the "***&nbsp;" prefixed to the icon title when the
+ <code>zIconBeep</code> feature is activated
+ (request by Thomas Adam).
+
+ <li>modify DECSCUSR to update the same internal variable as RM/SM 12,
+ and document in manpage the two variables used for controlling
+ blinking cursor (report by Paul LeoNerd Evans).
+
+ <li>correct response data for DECSCUSR in reply for DECRQSS response,
+ which had inverted the blink-value
+ (reports by Ailin Nemui, Paul LeoNerd Evans).
+
+ <li>add a null-pointer check in <code>OkPasswd</code> macro
+ to fix a problem in <code>resize</code> with Fedora 17
+ and a serial console (report/patch by Daniel Drake).
+
+ <li>add workaround for Mac OS X, which loses the window size of
+ a pseudo-terminal when the tty device is opened (report/analysis
+ by Egmont Koblinger).
+
+ <li>updated configure check for workable <code>posix_openpt</code>
+ versus <code>grantpt</code>, from <code>luit</code> fixes.
+
+ <li>modify DECIC/DECDC/DECBI/DECFI
+ implemented in <a href="#xterm_277">patch #277</a>
+ to enable them only in VT4xx mode and up (report by Ailin Nemui).
+
+ <li>update config.guess, config.sub
+</ul>
+
<H1><A NAME="xterm_278">Patch #278 - 2012/01/18</A></H1>
<ul>
<li>correct initialization for <code>eightBitMeta</code> resource
@@ -703,7 +806,7 @@ is the latest version of this file.
<li>modify configure script to work with systems that have both
ncurses (or other terminfo) as well as a real termcap library,
- e.g., Slackware (report by Alan Watts).
+ e.g., Slackware (report by Andrew Watts).
<li>modify configure script to work around special case where user's
environment adds compiler flags to the <code>CC</code> variable
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 9b2dab6cf..b47ff328d 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,7 +1,7 @@
'\" t
-.\" $XTermId: xterm.man,v 1.522 2012/01/08 18:21:15 tom Exp $
+.\" $XTermId: xterm.man,v 1.528 2012/05/10 13:35:30 tom Exp $
.\"
-.\" Copyright 1996-2010,2011 by Thomas E. Dickey
+.\" Copyright 1996-2011,2012 by Thomas E. Dickey
.\"
.\" All Rights Reserved
.\"
@@ -89,9 +89,10 @@ xterm \- terminal emulator for X
[\-\fItoolkitoption\fP ...] [\-\fIoption\fP ...] [\fIshell\fP]
.SH DESCRIPTION
The \fIxterm\fP program is a terminal emulator for the X Window System.
-It provides DEC VT102/VT220 (VTxxx) and Tektronix 4014
-compatible terminals for programs that cannot
-use the window system directly.
+It provides DEC VT102/VT220 and selected features from higher-level
+terminals such as VT320/VT420/VT520 (VTxxx).
+It also provides Tektronix 4014 emulation
+for programs that cannot use the window system directly.
If the underlying operating system supports
terminal resizing capabilities (for example, the SIGWINCH signal in systems
derived from 4.3bsd), \fIxterm\fP will use the facilities to notify programs
@@ -1561,11 +1562,20 @@ The default is \*(``false\*(''.
Same as \-ziconbeep command line argument.
If the value of this resource is non-zero, xterms that produce output
while iconified will cause an XBell sound at the given volume
-and have \*(``***\*('' prepended to their icon titles.
+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\*(''.
+.TP 8
+.B "zIconTitleFormat (\fPclass\fB ZIconTitleFormat)"
+Allow customization of the string used in the \fBzIconBeep\fP feature.
+The default value is \*(``***\ %s\*(''.
+.IP
+If the resource value contains a \*(``%s\*('',
+then \fIxterm\fP inserts the icon title at that point rather
+than prepending the string to the icon title.
+(Only the first \*(``%s\*('' is used).
.\"
.SS VT100 Widget Resources
.PP
@@ -1652,14 +1662,12 @@ A few programs, e.g., \fIvim\fP, use this feature to get an accurate
description of the terminal's capabilities,
independent of the termcap/terminfo setting:
.RS
-.TP 3
--
+.bP
\fIxterm\fP can tell the querying program how many colors it supports.
This is a constant, depending on how it is compiled, typically 16.
It does not change if you alter resource settings,
e.g., the \fBboldColors\fP resource.
-.TP 3
--
+.bP
\fIxterm\fP can tell the querying program what strings are sent by modified
(shift-, control-, alt-) function- and keypad-keys.
Reporting control- and alt-modifiers is a feature that relies on the
@@ -2137,6 +2145,11 @@ The default is \*(``false\*(''.
.B "cursorBlink (\fPclass\fB CursorBlink)"
Specifies whether to make the cursor blink.
The default is \*(``false\*(''.
+.IP
+\fIXterm\fP uses two variables to determine whether the cursor blinks.
+One is set by this resource.
+The other is set by control sequences (private mode 12 and DECSCUSR).
+\fIXterm\fP tests the XOR of the two variables.
.TP 8
.B "cursorColor (\fPclass\fB CursorColor)"
Specifies the color to use for the text cursor.
@@ -2627,13 +2640,11 @@ The default is \*(``1\*(''.
Specifies whether \fIxterm\fP should assume the normal and bold fonts
have VT100 line-drawing characters:
.RS
-.TP 5
--
+.bP
The fixed-pitch ISO-8859-*-encoded fonts used by \fIxterm\fP
normally have the VT100 line-drawing glyphs in cells 1-31.
Other fixed-pitch fonts may be more attractive, but lack these glyphs.
-.TP
--
+.bP
When using an ISO-10646-1 font and the \fBwideChars\fP resource is true,
\fIxterm\fP uses the Unicode glyphs which match the VT100 line-drawing glyphs.
.RE
@@ -3187,6 +3198,12 @@ If the window is iconified, this has no effect.
However, the \fBzIconBeep\fP resource provides you with the ability to
see which iconified windows have sounded a bell.
.TP 8
+.B "precompose (\fPclass\fB XtCPrecompose)"
+Tells \fIxterm\fP whether to precompose UTF-8 data into Normalization Form C,
+which combines commonly-used accents onto base characters.
+If it does not do this, accents are left as separatate characters.
+The default is \*(``true\*(''.
+.TP 8
.B "preeditType (\fPclass\fB XtCPreeditType)"
Tells \fIxterm\fP which types of preedit (preconversion) string to display.
The default is \*(``OverTheSpot,Root\*(''.
@@ -4148,15 +4165,12 @@ The selected text is highlighted and is saved in the global cut buffer
and made the PRIMARY selection when the button is released.
Normally (but see the discussion of \fBon2Clicks\fP, etc):
.RS
-.TP 3
--
+.bP
Double-clicking selects by words.
-.TP
--
+.bP
Triple-clicking
selects by lines.
-.TP
--
+.bP
Quadruple-clicking goes back to characters, etc.
.RE
.PP
diff --git a/app/xterm/xterm_io.h b/app/xterm/xterm_io.h
index d24da4d6e..7c6f5deca 100644
--- a/app/xterm/xterm_io.h
+++ b/app/xterm/xterm_io.h
@@ -1,7 +1,7 @@
-/* $XTermId: xterm_io.h,v 1.53 2011/12/30 22:45:49 tom Exp $ */
+/* $XTermId: xterm_io.h,v 1.54 2012/03/16 09:48:56 tom Exp $ */
/*
- * Copyright 2000-2006,2010 by Thomas E. Dickey
+ * Copyright 2000-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -293,15 +293,33 @@ extern int ptioctl(int fd, int func, void* data);
#endif /* TTYSIZE_STRUCT */
#if defined(USE_STRUCT_TTYSIZE)
+
#define TTYSIZE_STRUCT struct ttysize
-#define SET_TTYSIZE(fd, data) ioctl(fd, TIOCSSIZE, &data);
+#define GET_TTYSIZE(fd, data) ioctl(fd, TIOCGSIZE, &data)
+#define SET_TTYSIZE(fd, data) ioctl(fd, TIOCSSIZE, &data)
#define TTYSIZE_COLS(data) data.ts_cols
#define TTYSIZE_ROWS(data) data.ts_lines
+
#elif defined(USE_STRUCT_WINSIZE)
+
#define TTYSIZE_STRUCT struct winsize
+#define GET_TTYSIZE(fd, data) ioctl(fd, TIOCGWINSZ, (char *) &data)
#define SET_TTYSIZE(fd, data) ioctl(fd, TIOCSWINSZ, (char *) &data)
#define TTYSIZE_COLS(data) data.ws_col
#define TTYSIZE_ROWS(data) data.ws_row
+
+#endif /* (USE_STRUCT_TTYSIZE) */
+
+#if OPT_TRACE
+#define TRACE_TTYSIZE(fd, id) { \
+ TTYSIZE_STRUCT debug_ttysize; \
+ if (GET_TTYSIZE(fd, debug_ttysize) == 0) \
+ TRACE(("%s@%d, TTYSIZE %s %d %d\n", __FILE__, __LINE__, id, TTYSIZE_ROWS(debug_ttysize), TTYSIZE_COLS(debug_ttysize))); \
+ else \
+ TRACE(("%s@%d, TTYSIZE failed %s\n", __FILE__, __LINE__, strerror(errno))); \
+ }
+#else
+#define TRACE_TTYSIZE(fd, id) /* nothing */
#endif
typedef unsigned short ttySize_t;
diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin
index 32b22e3fc..76de637de 100644
--- a/app/xterm/xtermcfg.hin
+++ b/app/xterm/xtermcfg.hin
@@ -1,7 +1,7 @@
-/* $XTermId: xtermcfg.hin,v 1.188 2012/01/05 10:28:29 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.190 2012/05/07 23:28:24 tom Exp $ */
/*
- * Copyright 1997-2010,2011 by Thomas E. Dickey
+ * Copyright 1997-2011,2012 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -48,6 +48,7 @@
#undef HAVE_GETHOSTNAME /* AC_CHECK_FUNCS(gethostname) */
#undef HAVE_GETLOGIN /* AC_CHECK_FUNCS(getlogin) */
#undef HAVE_GRANTPT /* CF_FUNC_GRANTPT */
+#undef HAVE_GRANTPT_PTY_ISATTY /* 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) */
diff --git a/app/xterm/xutf8.c b/app/xterm/xutf8.c
index 8b99f6052..d7356a3f1 100644
--- a/app/xterm/xutf8.c
+++ b/app/xterm/xutf8.c
@@ -1,4 +1,4 @@
-/* $XTermId: xutf8.c,v 1.11 2011/09/11 14:59:37 tom Exp $ */
+/* $XTermId: xutf8.c,v 1.13 2012/05/09 20:56:09 tom Exp $ */
/*
* Copyright (c) 2001 by Juliusz Chroboczek
@@ -68,7 +68,7 @@ utf8countBytes(int c)
}
static void
-utf8insert(char *dest, int c, int *len_return)
+utf8insert(char *dest, int c, size_t *len_return)
{
if (c < 0)
return;
@@ -95,10 +95,10 @@ utf8insert(char *dest, int c, int *len_return)
}
static int
-l1countUtf8Bytes(char *s, int len)
+l1countUtf8Bytes(char *s, size_t len)
{
int l = 0;
- while (len > 0) {
+ while (len != 0) {
if ((*s & 0x80) == 0)
l++;
else
@@ -110,12 +110,12 @@ l1countUtf8Bytes(char *s, int len)
}
static void
-l1utf8copy(char *d, char *s, int len)
+l1utf8copy(char *d, char *s, size_t len)
{
- int l;
- while (len > 0) {
+ size_t l;
+ while (len != 0) {
utf8insert(d, (*s) & 0xFF, &l);
- d += l;
+ d += (int) l;
s++;
len--;
}
@@ -334,7 +334,7 @@ Xutf8LookupString(XIC ic GCC_UNUSED,
int rc;
KeySym keysym;
int codepoint;
- int len;
+ size_t len;
rc = XLookupString(ev, buffer, nbytes, &keysym, NULL);
@@ -367,7 +367,7 @@ Xutf8LookupString(XIC ic GCC_UNUSED,
} else {
*status_return = XLookupChars;
}
- return len;
+ return (int) len;
}
#else /* X_HAVE_UTF8_STRING */
/* Silence the compiler */