diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-09-05 15:58:10 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2009-09-05 15:58:10 +0000 |
commit | 0bfe30f1f8426d3e7c82459bca752530d6a1e469 (patch) | |
tree | 2e494b4882bc80ad74f39181476d95b64a340dfa | |
parent | 7e6bbbf222239c48377c748a99a9996f66fe68ac (diff) |
update to xterm 246. Has been in snapshots for some time.
46 files changed, 3887 insertions, 2545 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL index 1485bfb16..2f85f3a40 100644 --- a/app/xterm/INSTALL +++ b/app/xterm/INSTALL @@ -1,4 +1,4 @@ --- $XTermId: INSTALL,v 1.118 2008/12/30 11:43:45 tom Exp $ +-- $XTermId: INSTALL,v 1.121 2009/08/06 00:39:09 tom Exp $ ------------------------------------------------------------------------------- -- Copyright 1997-2007,2008 by Thomas E. Dickey -- @@ -146,6 +146,12 @@ The options (in alphabetic order): not shown. This makes it simpler to read a build log and see the actual warning messages. + --disable-fifo-lines enable FIFO-storage for saved-lines + + With patch #244, xterm by default stores saved-lines in a FIFO + (circular buffer), which improves performance when the number of saved + lines is large. Disable this option to revert to the pre-244 layout. + --disable-freetype disable freetype library-support Do not use freetype libraries if they are found. Normally they will @@ -311,6 +317,13 @@ The options (in alphabetic order): Do not compile-in code that modifies the icon's title and sounds a beep when they receive output. + --enable-16bit-chars enable 16-bit characters support + + Enable wide-character support, but store only 16-bits for each wide + character. Unicode values can be larger than 16-bits, up to 21-bits. + This uses less memory, but is less complete. However, most languages + are covered by the 16-bit encoding. + --enable-256-color enable 256-color support Compile-in code that interprets SGR 38 and 48 for 256-colors. diff --git a/app/xterm/Imakefile b/app/xterm/Imakefile index 99c8a0ea1..57a7fd06b 100644 --- a/app/xterm/Imakefile +++ b/app/xterm/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XTermId: Imakefile,v 1.99 2006/07/21 00:11:15 tom Exp $ +XCOMM $XTermId: Imakefile,v 1.102 2009/04/27 19:26:34 tom Exp $ XCOMM XCOMM Attention xterm porters XCOMM @@ -192,16 +192,16 @@ module.o: ; $(CC) -c defines $(CFLAGS) module.c TRACESRC = trace.c TRACEOBJ = trace.o #endif - SRCS1 = button.c charproc.c charsets.c cursor.c \ + SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ data.c doublechr.c fontutils.c input.c \ - menu.c misc.c print.c ptydata.c \ - screen.c scrollbar.c tabs.c util.c xstrings.c \ + linedata.c menu.c misc.c print.c ptydata.c scrollback.c \ + screen.c scrollbar.c tabs.c util.c xstrings.c xtermcap.c \ TekPrsTbl.c Tekproc.c VTPrsTbl.c \ $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(TRACESRC) - OBJS1 = button.o charproc.o charsets.o cursor.o \ + OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \ data.o doublechr.o fontutils.o input.o \ - menu.o misc.o print.o ptydata.o \ - screen.o scrollbar.o tabs.o util.o xstrings.o \ + linedata.o menu.o misc.o print.o ptydata.o scrollback.o \ + screen.o scrollbar.o tabs.o util.o xstrings.o xtermcap.o \ TekPrsTbl.o Tekproc.o VTPrsTbl.o \ $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(TRACEOBJ) SRCS2 = resize.c xstrings.c diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST index 0a8ae68ad..bcd71a769 100644 --- a/app/xterm/MANIFEST +++ b/app/xterm/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-243, version xterm-243 +MANIFEST for xterm-246, version xterm-246 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -52,6 +52,7 @@ keysym2ucs.c lookup-table for UTF-8 to keysyms keysym2ucs.h interface of keysym2ucs.c koi8rxterm KOI-8 wrapper from Debian (originally me) koi8rxterm.man manpage for koi8rxterm +linedata.c manage all line-data for VT100 widget link_axp.com build-script for VMS port of xterm main.c main program of 'xterm' main.h default definitions for 'xterm' @@ -73,6 +74,7 @@ resize.c program to compute/modify xterm's window size resize.man manual page for 'resize' run-tic.sh run tic, filtering out harmless messages screen.c VT100 screen update functions +scrollback.c manage scrollback (a big FIFO) scrollbar.c VT100 scrollbar support functions sinstall.sh install setuid if existing program was tabs.c VT100 tabstop support-functions diff --git a/app/xterm/Makefile b/app/xterm/Makefile index e58e79efc..fbb8f77b1 100644 --- a/app/xterm/Makefile +++ b/app/xterm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2009/05/31 16:22:34 matthieu Exp $ +# $OpenBSD: Makefile,v 1.14 2009/09/05 15:58:09 matthieu Exp $ .include <bsd.xconf.mk> SUBDIR= icons resize @@ -21,9 +21,9 @@ LDADD+= -L${X11BASE}/lib -lXaw -lXpm -lXt -lSM -lICE \ SRCS= TekPrsTbl.c Tekproc.c VTPrsTbl.c button.c cachedGCs.c \ charclass.c xtermcap.c charproc.c charsets.c cursor.c \ - data.c doublechr.c fontutils.c input.c main.c menu.c \ + data.c doublechr.c fontutils.c input.c linedata.c main.c menu.c \ misc.c precompose.c print.c ptydata.c wcwidth.c screen.c \ - scrollbar.c tabs.c util.c xstrings.c + scrollback.c scrollbar.c tabs.c util.c xstrings.c MANDIR= ${X11BASE}/man/cat XETC?= /etc/X11 diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c index 608146832..531c31a56 100644 --- a/app/xterm/Tekproc.c +++ b/app/xterm/Tekproc.c @@ -1,9 +1,8 @@ -/* $XTermId: Tekproc.c,v 1.167 2009/03/28 17:03:35 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.172 2009/08/09 17:22:34 tom Exp $ */ /* * Warning, there be crufty dragons here. */ -/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.57 2006/02/13 01:14:57 dickey Exp $ */ /* @@ -596,7 +595,7 @@ Tekparse(TekWidget tw) case CASE_CHAR_SIZE: TRACE(("case: character size selector\n")); - TekSetFontSize(tw, (int) (c & 03)); + TekSetFontSize(tw, False, (int) (c & 03)); Tparsestate = curstate; break; @@ -795,7 +794,7 @@ Tinput(TekWidget tw) tekRefreshList = tek; rptr = tek->data; rcnt = tek->count - 1; - TekSetFontSize(tw, tek->fontsize); + TekSetFontSize(tw, False, tek->fontsize); return (IChar) (*rptr++); } tekRefreshList = (TekLink *) 0; @@ -940,7 +939,7 @@ TekExpose(Widget w, tekscr->cur_X = 0; tekscr->cur_Y = TEKHOME; tekscr->cur = tekscr->page; - TekSetFontSize(tw, tekscr->cur.fontsize); + TekSetFontSize(tw, False, tekscr->cur.fontsize); tekscr->margin = MARGIN1; if (tekscr->TekGIN) { tekscr->TekGIN = NULL; @@ -1394,9 +1393,10 @@ TekRealize(Widget gw, int border = 2 * screen->border; int pr; XGCValues gcv; - int winX, winY, width, height; + int winX, winY; + unsigned width, height; char Tdefault[32]; - unsigned TEKgcFontMask; + unsigned long TEKgcFontMask; TRACE(("TekRealize\n")); memset(tekscr, 0, sizeof(tekscr)); @@ -1442,22 +1442,22 @@ TekRealize(Widget gw, winX = 1; winY = 1; - width = TEKDEFWIDTH + border; - height = TEKDEFHEIGHT + border; + width = (unsigned) (TEKDEFWIDTH + border); + height = (unsigned) (TEKDEFHEIGHT + border); TRACE(("parsing T_geometry %s\n", NonNull(term->misc.T_geometry))); pr = XParseGeometry(term->misc.T_geometry, &winX, &winY, - (unsigned int *) &width, - (unsigned int *) &height); + &width, + &height); TRACE(("... position %d,%d size %dx%d\n", winY, winX, height, width)); if ((pr & XValue) && (pr & XNegative)) winX += DisplayWidth(XtDisplay(tw), DefaultScreen(XtDisplay(tw))) - - width - (BorderWidth(SHELL_OF(term)) * 2); + - (int) width - (BorderWidth(SHELL_OF(term)) * 2); if ((pr & YValue) && (pr & YNegative)) winY += DisplayHeight(XtDisplay(tw), DefaultScreen(XtDisplay(tw))) - - height - (BorderWidth(SHELL_OF(term)) * 2); + - (int) height - (BorderWidth(SHELL_OF(term)) * 2); /* set up size hints */ tw->hints.min_width = TEKMINWIDTH + border; @@ -1488,15 +1488,15 @@ TekRealize(Widget gw, /* set a default size, but do *not* set position */ tw->hints.flags |= PSize; } - tw->hints.width = width; - tw->hints.height = height; + tw->hints.width = (int) width; + tw->hints.height = (int) height; if ((WidthValue & pr) || (HeightValue & pr)) tw->hints.flags |= USSize; else tw->hints.flags |= PSize; (void) REQ_RESIZE((Widget) tw, - width, height, + (Dimension) width, (Dimension) height, &tw->core.width, &tw->core.height); /* XXX This is bogus. We are parsing geometries too late. This @@ -1525,8 +1525,8 @@ TekRealize(Widget gw, TFullWidth(tekscr) = (Dimension) width; TFullHeight(tekscr) = (Dimension) height; - TWidth(tekscr) = width - border; - THeight(tekscr) = height - border; + TWidth(tekscr) = (int) width - border; + THeight(tekscr) = (int) height - border; TekScale(tekscr) = (double) TWidth(tekscr) / TEKWIDTH; if ((d = (double) THeight(tekscr) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) < TekScale(tekscr)) @@ -1558,7 +1558,7 @@ TekRealize(Widget gw, /* if font wasn't successfully opened, then gcv.font will contain the Default GC's ID, meaning that we must use the server default font. */ - TEKgcFontMask = (gcv.font == DefaultGCID) ? 0 : GCFont; + TEKgcFontMask = (unsigned long) ((gcv.font == DefaultGCID) ? 0 : GCFont); tekscr->TnormalGC = XCreateGC(XtDisplay(tw), TWindow(tekscr), (TEKgcFontMask | GCGraphicsExposures | GCForeground | GCBackground), @@ -1651,7 +1651,7 @@ TekGetFontSize(const char *param) } void -TekSetFontSize(TekWidget tw, int newitem) +TekSetFontSize(TekWidget tw, Bool fromMenu, int newitem) { if (tw != 0) { TekScreen *tekscr = TekScreenOf(tw); @@ -1668,7 +1668,8 @@ TekSetFontSize(TekWidget tw, int newitem) set_tekfont_menu_item(oldsize, False); tekscr->cur.fontsize = newsize; - tekscr->page.fontsize = newsize; + if (fromMenu) + tekscr->page.fontsize = newsize; fid = tw->tek.Tfont[newsize]->fid; if (fid == DefaultGCID) { @@ -1685,11 +1686,13 @@ TekSetFontSize(TekWidget tw, int newitem) if (!Ttoggled) TCursorToggle(tw, TOGGLE); - /* we'll get an exposure event after changing fontsize, so we - * have to clear the screen to avoid painting over the previous - * text. - */ - TekClear(tw); + if (fromMenu) { + /* we'll get an exposure event after changing fontsize, so we + * have to clear the screen to avoid painting over the previous + * text. + */ + TekClear(tw); + } } } } @@ -1845,7 +1848,7 @@ TekSimulatePageButton(TekWidget tw, Bool reset) TekScreen *tekscr = TekScreenOf(tw); if (reset) { - bzero((char *) &tekscr->cur, sizeof tekscr->cur); + memset(&tekscr->cur, 0, sizeof tekscr->cur); } tekRefreshList = (TekLink *) 0; TekPage(tw); @@ -1886,10 +1889,10 @@ TekCopy(TekWidget tw) sprintf(initbuf, "%c%c%c%c", ANSI_ESC, (char) (tekscr->page.fontsize + '8'), ANSI_ESC, (char) (tekscr->page.linetype + '`')); - write(tekcopyfd, initbuf, 4); + write(tekcopyfd, initbuf, (size_t) 4); Tp = &Tek0; do { - write(tekcopyfd, Tp->data, Tp->count); + write(tekcopyfd, Tp->data, (size_t) Tp->count); Tp = Tp->next; } while (Tp); close(tekcopyfd); diff --git a/app/xterm/XTerm-col.ad b/app/xterm/XTerm-col.ad index a21fee9ab..9de5098e7 100644 --- a/app/xterm/XTerm-col.ad +++ b/app/xterm/XTerm-col.ad @@ -1,5 +1,4 @@ -! $XTermId: XTerm-col.ad,v 1.20 2006/06/24 14:57:29 tom Exp $ -! $XFree86: xc/programs/xterm/XTerm-col.ad,v 3.7 2005/09/18 23:48:12 dickey Exp $ +! $XTermId: XTerm-col.ad,v 1.21 2009/08/15 15:56:29 tom Exp $ #include "XTerm" @@ -20,7 +19,7 @@ ! leave the foreground/background colors alone (at the mercy of your desktop ! designer). -! Color the popup/pulldown menu border to match the text widget's foreground. +! Color the popup/pulldown menu border to match the text widget foreground. !*SimpleMenu*borderColor: gray15 ! Uncomment this to use color for underline attribute diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad index 8074053a3..7ec5c6ece 100644 --- a/app/xterm/XTerm.ad +++ b/app/xterm/XTerm.ad @@ -1,4 +1,4 @@ -! $XTermId: XTerm.ad,v 1.88 2009/02/13 00:14:13 tom Exp $ +! $XTermId: XTerm.ad,v 1.89 2009/08/15 15:58:44 tom Exp $ *scrollBar: true *saveLines: 1024 @@ -149,7 +149,7 @@ ! vt100/VT100 ! tektronix/TopLevelShell ! shellext/VendorShellExt -! tek4014/Tek4014 +! tek4014/Tek4014 ! ! If built without a toolbar, the widget hierarchy is simpler, because there ! is no form, and the popup menu widgets are created only when they are first @@ -164,7 +164,7 @@ ! vt100/VT100 ! tektronix/TopLevelShell ! shellext/VendorShellExt -! tek4014/Tek4014 +! tek4014/Tek4014 ! ! A more complete list of the widget/class names can be obtained using editres ! to dump a file. Some widget names are not available until the corresponding @@ -194,7 +194,7 @@ ! Alternatively, !*on2Clicks: regex [[:alpha:]]+://([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+ -! vt100's and similar terminals recognize escape sequences and control +! VT100s and similar terminals recognize escape sequences and control ! characters to which they reply to the host with other escape sequences, ! to provide information. The "resize" program uses this feature. ! diff --git a/app/xterm/button.c b/app/xterm/button.c index 86e739227..526a90247 100644 --- a/app/xterm/button.c +++ b/app/xterm/button.c @@ -1,4 +1,4 @@ -/* $XTermId: button.c,v 1.320 2009/03/27 00:00:56 tom Exp $ */ +/* $XTermId: button.c,v 1.349 2009/08/07 23:24:10 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -94,12 +94,22 @@ button.c Handles button events in the terminal emulator. charClass[value & ((sizeof(charClass)/sizeof(charClass[0]))-1)] #endif - /* - * We reserve shift modifier for cut/paste operations. In principle we - * can pass through control and meta modifiers, but in practice, the - * popup menu uses control, and the window manager is likely to use meta, - * so those events are not delivered to SendMousePosition. - */ + /* + * We'll generally map rows to indices when doing selection. + * Simplify that with a macro. + * + * Note that ROW2INX() is safe to use with auto increment/decrement for + * the row expression since that is evaluated once. + */ +#define GET_LINEDATA(screen, row) \ + getLineData(screen, ROW2INX(screen, row)) + + /* + * We reserve shift modifier for cut/paste operations. In principle we + * can pass through control and meta modifiers, but in practice, the + * popup menu uses control, and the window manager is likely to use meta, + * so those events are not delivered to SendMousePosition. + */ #define OurModifiers (ShiftMask | ControlMask | Mod1Mask) #define AllModifiers (ShiftMask | LockMask | ControlMask | Mod1Mask | \ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) @@ -732,23 +742,29 @@ rowOnCurrentLine(TScreen * screen, int line, int *deltap) /* must be XButtonEvent */ { + int result = 1; int l1, l2; *deltap = 0; - if (line == screen->cur_row) - return 1; - - if (line < screen->cur_row) - l1 = line, l2 = screen->cur_row; - else - l2 = line, l1 = screen->cur_row; - l1--; - while (++l1 < l2) - if (!ScrnTstWrapped(screen, l1)) - return 0; - /* Everything is on one "wrapped line" now */ - *deltap = line - screen->cur_row; - return 1; + if (line != screen->cur_row) { + if (line < screen->cur_row) + l1 = line, l2 = screen->cur_row; + else + l2 = line, l1 = screen->cur_row; + l1--; + while (++l1 < l2) { + LineData *ld = GET_LINEDATA(screen, l1); + if (!LineTstWrapped(ld)) { + result = 0; + break; + } + } + if (result) { + /* Everything is on one "wrapped line" now */ + *deltap = line - screen->cur_row; + } + } + return result; } static int @@ -867,20 +883,8 @@ ReadLineButton(Widget w, goto finish; /* All this work for this... */ } line = (event->xbutton.y - screen->border) / FontHeight(screen); - if (line != screen->cur_row) { - int l1, l2; - - if (line < screen->cur_row) - l1 = line, l2 = screen->cur_row; - else - l2 = line, l1 = screen->cur_row; - l1--; - while (++l1 < l2) - if (!ScrnTstWrapped(screen, l1)) - goto finish; - /* Everything is on one "wrapped line" now */ - ldelta = line - screen->cur_row; - } + if (!rowOnCurrentLine(screen, line, &ldelta)) + goto finish; /* Correct by half a width - we are acting on a boundary, not on a cell. */ col = (event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2) @@ -1264,7 +1268,7 @@ allocUtf8Targets(Widget w, TScreen * screen) Atom *result; if (!overrideTargets(w, screen->utf8_select_types, &result)) { - result = (Atom *) XtMalloc(5 * sizeof(Atom)); + result = (Atom *) XtMalloc((Cardinal) (5 * sizeof(Atom))); if (result == NULL) { TRACE(("Couldn't allocate utf-8 selection targets\n")); } else { @@ -1298,7 +1302,7 @@ alloc8bitTargets(Widget w, TScreen * screen) Atom *result = 0; if (!overrideTargets(w, screen->eightbit_select_types, &result)) { - result = (Atom *) XtMalloc(5 * sizeof(Atom)); + result = (Atom *) XtMalloc((Cardinal) (5 * sizeof(Atom))); if (result == NULL) { TRACE(("Couldn't allocate 8bit selection targets\n")); } else { @@ -1571,7 +1575,7 @@ GettingSelection(Display * dpy, Atom type, Char * line, unsigned long len) TRACE(("Getting %s (%ld)\n", name, (long int) type)); for (cp = line; cp < line + len; cp++) { - TRACE(("[%d:%lu]", cp + 1 - line, len)); + TRACE(("[%d:%lu]", (int) (cp + 1 - line), len)); if (isprint(*cp)) { TRACE(("%c\n", *cp)); } else { @@ -2467,19 +2471,20 @@ PointToCELL(TScreen * screen, * Find the last column at which text was drawn on the given row. */ static int -LastTextCol(TScreen * screen, int row) +LastTextCol(TScreen * screen, LineData * ld, int row) { - int inx = ROW2INX(screen, row); int i; Char *ch; - if (inx + screen->savedlines >= 0) { + if (okScrnRow(screen, row)) { for (i = screen->max_col, - ch = SCRN_BUF_ATTRS(screen, inx) + i; + ch = ld->attribs + i; i >= 0 && !(*ch & CHARDRAWN); - ch--, i--) ; + ch--, i--) { + ; + } #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, inx)[0])) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { i *= 2; } #endif @@ -2587,56 +2592,58 @@ SetCharacterClassRange(int low, /* in range of [0..255] */ #if OPT_WIDE_CHARS static int -class_of(TScreen * screen, CELL * cell) +class_of(TScreen * screen, LineData * ld, CELL * cell) { CELL temp = *cell; int value; #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, ROW2INX(screen, temp.row))[0])) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { temp.col /= 2; } #endif value = (int) XTERM_CELL(temp.row, temp.col); - if_OPT_WIDE_CHARS(screen, { - return CharacterClass(value); - }); return CharacterClass(value); } -#define ClassSelects(screen, cell, cclass) \ - (class_of(screen, cell) == cclass \ - || XTERM_CELL((cell)->row, (cell)->col) == HIDDEN_CHAR) +#define CClassSelects(name, cclass) \ + (CClassOf(name) == cclass \ + || XTERM_CELL(screen->name.row, screen->name.col) == HIDDEN_CHAR) #else -#define class_of(screen, cell) charClass[XTERM_CELL((cell)->row, (cell)->col)] -#define ClassSelects(screen, cell, cclass) \ - (class_of(screen, (cell)) == cclass) +#define class_of(screen, ld, cell) charClass[XTERM_CELL((cell)->row, (cell)->col)] +#define CClassSelects(name, cclass) \ + (class_of(screen, ld.name, &((screen->name))) == cclass) #endif +#define CClassOf(name) class_of(screen, ld.name, &((screen->name))) + /* * If the given column is past the end of text on the given row, bump to the * beginning of the next line. */ static Boolean okPosition(TScreen * screen, + LineData ** ld, CELL * cell) { - if (cell->col > (LastTextCol(screen, cell->row) + 1)) { + if (cell->col > (LastTextCol(screen, *ld, cell->row) + 1)) { cell->col = 0; - cell->row += 1; + *ld = GET_LINEDATA(screen, ++cell->row); return False; } return True; } static void -trimLastLine(TScreen * screen, CELL * last) +trimLastLine(TScreen * screen, + LineData ** ld, + CELL * last) { if (screen->cutNewline) { last->col = 0; - ++last->row; + *ld = GET_LINEDATA(screen, ++last->row); } else { - last->col = LastTextCol(screen, last->row) + 1; + last->col = LastTextCol(screen, *ld, last->row) + 1; } } @@ -2647,11 +2654,14 @@ trimLastLine(TScreen * screen, CELL * last) static int firstRowOfLine(TScreen * screen, int row, Bool visible) { + LineData *ld = 0; int limit = visible ? 0 : -screen->savedlines; while (row > limit && - ScrnTstWrapped(screen, row - 1)) + (ld = GET_LINEDATA(screen, row - 1)) != 0 && + LineTstWrapped(ld)) { --row; + } return row; } @@ -2661,9 +2671,13 @@ firstRowOfLine(TScreen * screen, int row, Bool visible) static int lastRowOfLine(TScreen * screen, int row) { + LineData *ld; + while (row < screen->max_row && - ScrnTstWrapped(screen, row)) + (ld = GET_LINEDATA(screen, row)) != 0 && + LineTstWrapped(ld)) { ++row; + } return row; } @@ -2677,7 +2691,8 @@ lengthOfLines(TScreen * screen, int firstRow, int lastRow) int n; for (n = firstRow; n <= lastRow; ++n) { - int value = LastTextCol(screen, n); + LineData *ld = GET_LINEDATA(screen, n); + int value = LastTextCol(screen, ld, n); if (value >= 0) length += (unsigned) (value + 1); } @@ -2700,16 +2715,17 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) * string were UTF-8. */ if_OPT_WIDE_CHARS(screen, { - need *= (unsigned) (MAX_PTRS * 6); + need *= ((screen->lineExtra + 1) * 6); }); if ((result = TypeCallocN(Char, need + 1)) != 0) { + LineData *ld = GET_LINEDATA(screen, row); unsigned used = 0; Char *last = result; do { int col = 0; - int limit = LastTextCol(screen, row); + int limit = LastTextCol(screen, ld, row); while (col <= limit) { Char *next = last; @@ -2727,9 +2743,10 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) }); if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - if ((data = XTERM_CELLC(row, col, off)) == 0) + size_t off; + for_each_combData(off, ld) { + data = XTERM_CELLC(row, col, off); + if (data == 0) break; next = convertToUTF8(next, data); } @@ -2744,8 +2761,9 @@ make_indexed_text(TScreen * screen, int row, unsigned length, int *indexed) indexed[used] = next - result; } } while (used < length && - ScrnTstWrapped(screen, row) && - ++row < screen->max_row); + LineTstWrapped(ld) && + (ld = GET_LINEDATA(screen, ++row)) != 0 && + row < screen->max_row); } /* TRACE(("result:%s\n", result)); */ return (char *) result; @@ -2775,7 +2793,8 @@ static void columnToCell(TScreen * screen, int row, int col, CELL * cell) { while (row < screen->max_row) { - int last = LastTextCol(screen, row); + LineData *ld = GET_LINEDATA(screen, row); + int last = LastTextCol(screen, ld, row); /* TRACE(("last(%d) = %d, have %d\n", row, last, col)); */ if (col <= last) { @@ -2785,7 +2804,7 @@ columnToCell(TScreen * screen, int row, int col, CELL * cell) * Stop if the current row does not wrap (does not continue the current * line). */ - if (!ScrnTstWrapped(screen, row)) { + if (!LineTstWrapped(ld)) { col = last + 1; break; } @@ -2804,17 +2823,26 @@ columnToCell(TScreen * screen, int row, int col, CELL * cell) static int cellToColumn(TScreen * screen, CELL * cell) { + LineData *ld = 0; int col = cell->col; int row = firstRowOfLine(screen, cell->row, False); while (row < cell->row) { - col += LastTextCol(screen, row++); + ld = GET_LINEDATA(screen, row); + col += LastTextCol(screen, ld, row++); } +#if OPT_DEC_CHRSET + if (ld == 0) + ld = GET_LINEDATA(screen, row); + if (CSET_DOUBLE(GetLineDblCS(ld))) + col /= 2; +#endif return col; } static void do_select_regex(TScreen * screen, CELL * startc, CELL * endc) { + LineData *ld = GET_LINEDATA(screen, startc->row); int inx = ((screen->numberOfClicks - 1) % screen->maxClicks); char *expr = screen->selectExpr[inx]; regex_t preg; @@ -2823,7 +2851,7 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) int *indexed; TRACE(("Select_REGEX:%s\n", NonNull(expr))); - if (okPosition(screen, startc) && expr != 0) { + if (okPosition(screen, &ld, startc) && expr != 0) { if (regcomp(&preg, expr, REG_EXTENDED) == 0) { int firstRow = firstRowOfLine(screen, startc->row, True); int lastRow = lastRowOfLine(screen, firstRow); @@ -2877,9 +2905,7 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) TRACE(("matched:%d:%s\n", indexed[best_nxt] + 1 - indexed[best_col], - visibleChars(PAIRED_CHARS((Char *) (search + - indexed[best_col]), - 0), + visibleChars((Char *) (search + indexed[best_col]), (unsigned) (indexed[best_nxt] + 1 - indexed[best_col])))); @@ -2887,6 +2913,16 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) free(search); } free(indexed); +#if OPT_DEC_CHRSET + if ((ld = GET_LINEDATA(screen, startc->row)) != 0) { + if (CSET_DOUBLE(GetLineDblCS(ld))) + startc->col *= 2; + } + if ((ld = GET_LINEDATA(screen, endc->row)) != 0) { + if (CSET_DOUBLE(GetLineDblCS(ld))) + endc->col *= 2; + } +#endif } regfree(&preg); } @@ -2894,6 +2930,20 @@ do_select_regex(TScreen * screen, CELL * startc, CELL * endc) } #endif /* OPT_SELECT_REGEX */ +#define InitRow(name) \ + ld.name = GET_LINEDATA(screen, screen->name.row) + +#define NextRow(name) \ + ld.name = GET_LINEDATA(screen, ++screen->name.row) + +#define PrevRow(name) \ + ld.name = GET_LINEDATA(screen, --screen->name.row) + +#define isPrevWrapped(name) \ + (screen->name.row > 0 \ + && (ltmp = GET_LINEDATA(screen, screen->name.row - 1)) != 0 \ + && LineTstWrapped(ltmp)) + /* * sets startSel endSel * ensuring that they have legal values @@ -2905,10 +2955,18 @@ ComputeSelect(XtermWidget xw, Bool extend) { TScreen *screen = TScreenOf(xw); + int length; int cclass; CELL first = *startc; CELL last = *endc; + Boolean ignored = False; + + struct { + LineData *startSel; + LineData *endSel; + } ld; + LineData *ltmp; TRACE(("ComputeSelect(startRow=%d, startCol=%d, endRow=%d, endCol=%d, %sextend)\n", first.row, first.col, @@ -2940,26 +2998,28 @@ ComputeSelect(XtermWidget xw, screen->endSel = screen->endRaw = first; } + InitRow(startSel); + InitRow(endSel); + switch (screen->selectUnit) { case Select_CHAR: - (void) okPosition(screen, &(screen->startSel)); - (void) okPosition(screen, &(screen->endSel)); + (void) okPosition(screen, &(ld.startSel), &(screen->startSel)); + (void) okPosition(screen, &(ld.endSel), &(screen->endSel)); break; case Select_WORD: TRACE(("Select_WORD\n")); - if (okPosition(screen, &(screen->startSel))) { - cclass = class_of(screen, &(screen->startSel)); + if (okPosition(screen, &(ld.startSel), &(screen->startSel))) { + cclass = CClassOf(startSel); do { --screen->startSel.col; - if (screen->startSel.row > 0 - && screen->startSel.col < 0 - && ScrnTstWrapped(screen, screen->startSel.row - 1)) { - --screen->startSel.row; - screen->startSel.col = LastTextCol(screen, screen->startSel.row); + if (screen->startSel.col < 0 + && isPrevWrapped(startSel)) { + PrevRow(startSel); + screen->startSel.col = LastTextCol(screen, ld.startSel, screen->startSel.row); } } while (screen->startSel.col >= 0 - && ClassSelects(screen, &(screen->startSel), cclass)); + && CClassSelects(startSel, cclass)); ++screen->startSel.col; } #if OPT_WIDE_CHARS @@ -2969,26 +3029,26 @@ ComputeSelect(XtermWidget xw, screen->startSel.col++; #endif - if (okPosition(screen, &(screen->endSel))) { - length = LastTextCol(screen, screen->endSel.row); - cclass = class_of(screen, &(screen->endSel)); + if (okPosition(screen, &(ld.endSel), &(screen->endSel))) { + length = LastTextCol(screen, ld.endSel, screen->endSel.row); + cclass = CClassOf(endSel); do { ++screen->endSel.col; if (screen->endSel.col > length - && ScrnTstWrapped(screen, screen->endSel.row)) { + && LineTstWrapped(ld.endSel)) { screen->endSel.col = 0; - ++screen->endSel.row; - length = LastTextCol(screen, screen->endSel.row); + NextRow(endSel); + length = LastTextCol(screen, ld.endSel, screen->endSel.row); } } while (screen->endSel.col <= length - && ClassSelects(screen, &(screen->endSel), cclass)); + && CClassSelects(endSel, cclass)); /* Word-select selects if pointing to any char in "word", * especially note that it includes the last character in a word. * So we do no --endSel.col and do special eol handling. */ if (screen->endSel.col > length + 1) { screen->endSel.col = 0; - ++screen->endSel.row; + NextRow(endSel); } } #if OPT_WIDE_CHARS @@ -3003,49 +3063,49 @@ ComputeSelect(XtermWidget xw, case Select_LINE: TRACE(("Select_LINE\n")); - while (ScrnTstWrapped(screen, screen->endSel.row)) { - ++screen->endSel.row; + while (LineTstWrapped(ld.endSel)) { + NextRow(endSel); } if (screen->cutToBeginningOfLine || screen->startSel.row < screen->saveStartW.row) { screen->startSel.col = 0; - while (screen->startSel.row > 0 - && ScrnTstWrapped(screen, screen->startSel.row - 1)) { - --screen->startSel.row; + while (isPrevWrapped(startSel)) { + PrevRow(startSel); } } else if (!extend) { if ((first.row < screen->saveStartW.row) || (isSameRow(&first, &(screen->saveStartW)) && first.col < screen->saveStartW.col)) { screen->startSel.col = 0; - while (screen->startSel.row > 0 - && ScrnTstWrapped(screen, screen->startSel.row - 1)) { - --screen->startSel.row; + while (isPrevWrapped(startSel)) { + PrevRow(startSel); } } else { screen->startSel = screen->saveStartW; } } - trimLastLine(screen, &(screen->endSel)); + trimLastLine(screen, &(ld.endSel), &(screen->endSel)); break; case Select_GROUP: /* paragraph */ TRACE(("Select_GROUP\n")); - if (okPosition(screen, &(screen->startSel))) { + if (okPosition(screen, &(ld.startSel), &(screen->startSel))) { /* scan backward for beginning of group */ while (screen->startSel.row > 0 && - (LastTextCol(screen, screen->startSel.row - 1) > 0 || - ScrnTstWrapped(screen, screen->startSel.row - 1))) { - --screen->startSel.row; + (LastTextCol(screen, ld.startSel, screen->startSel.row - + 1) > 0 || + isPrevWrapped(startSel))) { + PrevRow(startSel); } screen->startSel.col = 0; /* scan forward for end of group */ while (screen->endSel.row < screen->max_row && - (LastTextCol(screen, screen->endSel.row + 1) > 0 || - ScrnTstWrapped(screen, screen->endSel.row))) { - ++screen->endSel.row; + (LastTextCol(screen, ld.endSel, screen->endSel.row + 1) > + 0 || + LineTstWrapped(ld.endSel))) { + NextRow(endSel); } - trimLastLine(screen, &(screen->endSel)); + trimLastLine(screen, &(ld.endSel), &(screen->endSel)); } break; @@ -3072,13 +3132,16 @@ ComputeSelect(XtermWidget xw, #endif case NSELECTUNITS: /* always ignore */ - return; + ignored = True; + break; } - /* check boundaries */ - ScrollSelection(screen, 0, False); + if (!ignored) { + /* check boundaries */ + ScrollSelection(screen, 0, False); + TrackText(xw, &(screen->startSel), &(screen->endSel)); + } - TrackText(xw, &(screen->startSel), &(screen->endSel)); return; } @@ -3249,8 +3312,8 @@ SaltTextAway(XtermWidget xw, } *lp = '\0'; /* make sure we have end marked */ - TRACE(("Salted TEXT:%d:%s\n", lp - line, - visibleChars(PAIRED_CHARS(line, 0), (unsigned) (lp - line)))); + TRACE(("Salted TEXT:%d:%s\n", (int) (lp - line), + visibleChars(line, (unsigned) (lp - line)))); screen->selection_length = (unsigned long) (lp - line); _OwnSelection(xw, params, num_params); @@ -3452,7 +3515,7 @@ ConvertSelection(Widget w, std_targets = (Atom *) (std_return); *length = std_length + 6; - targetP = (Atom *) XtMalloc(sizeof(Atom) * (*length)); + targetP = (Atom *) XtMalloc((Cardinal) (sizeof(Atom) * (*length))); allocP = targetP; *value = (XtPointer) targetP; @@ -3635,7 +3698,7 @@ _OwnSelection(XtermWidget xw, if (count > screen->sel_atoms_size) { XtFree((char *) atoms); - atoms = (Atom *) XtMalloc(count * sizeof(Atom)); + atoms = (Atom *) XtMalloc((Cardinal) (count * sizeof(Atom))); screen->selection_atoms = atoms; screen->sel_atoms_size = count; } @@ -3743,12 +3806,13 @@ UnhiliteSelection(XtermWidget xw) /* returns number of chars in line from scol to ecol out */ /* ARGSUSED */ static int -Length(TScreen * screen GCC_UNUSED, +Length(TScreen * screen, int row, int scol, int ecol) { - int lastcol = LastTextCol(screen, row); + LineData *ld = GET_LINEDATA(screen, row); + int lastcol = LastTextCol(screen, ld, row); if (ecol > lastcol) ecol = lastcol; @@ -3764,6 +3828,7 @@ SaveText(TScreen * screen, Char * lp, /* pointer to where to put the text */ int *eol) { + LineData *ld; int i = 0; unsigned c; Char *result = lp; @@ -3771,15 +3836,16 @@ SaveText(TScreen * screen, unsigned previous = 0; #endif + ld = GET_LINEDATA(screen, row); i = Length(screen, row, scol, ecol); ecol = scol + i; #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, ROW2INX(screen, row))[0])) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { scol = (scol + 0) / 2; ecol = (ecol + 1) / 2; } #endif - *eol = !ScrnTstWrapped(screen, row); + *eol = !LineTstWrapped(ld); for (i = scol; i < ecol; i++) { c = E2A(XTERM_CELL(row, i)); #if OPT_WIDE_CHARS @@ -3793,9 +3859,10 @@ SaveText(TScreen * screen, if_OPT_WIDE_CHARS(screen, { if (screen->utf8_mode != uFalse) { unsigned ch; - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - if ((ch = XTERM_CELLC(row, i, off)) == 0) + size_t off; + for_each_combData(off, ld) { + ch = XTERM_CELLC(row, i, off); + if (ch == 0) break; lp = convertToUTF8(lp, ch); } @@ -3808,9 +3875,10 @@ SaveText(TScreen * screen, lp = convertToUTF8(lp, (c != 0) ? c : ' '); if_OPT_WIDE_CHARS(screen, { unsigned ch; - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - if ((ch = XTERM_CELLC(row, i, off)) == 0) + size_t off; + for_each_combData(off, ld) { + ch = XTERM_CELLC(row, i, off); + if (ch == 0) break; lp = convertToUTF8(lp, ch); } diff --git a/app/xterm/cachedGCs.c b/app/xterm/cachedGCs.c index 3c525ee5e..8c26aa6d5 100644 --- a/app/xterm/cachedGCs.c +++ b/app/xterm/cachedGCs.c @@ -1,4 +1,4 @@ -/* $XTermId: cachedGCs.c,v 1.52 2009/03/26 23:59:32 tom Exp $ */ +/* $XTermId: cachedGCs.c,v 1.54 2009/08/07 00:06:33 tom Exp $ */ /************************************************************ @@ -84,10 +84,10 @@ typedef struct { #if OPT_TRACE #define CASE(name) case gc##name: result = #name; break -static String +static const char * traceCgsEnum(CgsEnum value) { - String result = "?"; + const char *result = "?"; switch (value) { CASE(Norm); CASE(Bold); @@ -121,10 +121,10 @@ traceCgsEnum(CgsEnum value) #undef CASE -static String +static const char * traceVTwin(XtermWidget xw, VTwin * value) { - String result = "?"; + const char *result = "?"; if (value == 0) result = "null"; else if (value == &(xw->screen.fullVwin)) @@ -254,7 +254,7 @@ allocCache(void **cache_pointer) { if (*cache_pointer == 0) { *cache_pointer = TypeCallocN(CgsCache, gcMAX); - TRACE(("allocCache %p\n", cache_pointer)); + TRACE(("allocCache %p\n", *cache_pointer)); } return *((CgsCache **) cache_pointer); } @@ -389,7 +389,7 @@ newCache(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, CgsCache * me) THIS(gc) = XCreateGC(myDisplay(xw), myDrawable(xw, cgsWin), mask, &xgcv); TRACE(("getCgsGC(%s) created gc %p(%d)\n", - traceCgsEnum(cgsId), THIS(gc), ITEM())); + traceCgsEnum(cgsId), (void *) THIS(gc), ITEM())); THIS(used) = 0; return THIS(gc); @@ -459,10 +459,8 @@ setCgsFore(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel fg) CgsCache *me; if ((me = myCache(xw, cgsWin, cgsId)) != 0) { - if (!SameColor(NEXT(fg), fg)) { - NEXT(fg) = fg; - me->mask |= GCForeground; - } + NEXT(fg) = fg; + me->mask |= GCForeground; } } @@ -472,10 +470,8 @@ setCgsBack(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, Pixel bg) CgsCache *me; if ((me = myCache(xw, cgsWin, cgsId)) != 0) { - if (!SameColor(NEXT(bg), bg)) { - NEXT(bg) = bg; - me->mask |= GCBackground; - } + NEXT(bg) = bg; + me->mask |= GCBackground; } } @@ -486,10 +482,8 @@ setCgsCSet(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, unsigned cset) CgsCache *me; if ((me = myCache(xw, cgsWin, cgsId)) != 0) { - if (!SameCSet(NEXT(cset), cset)) { - NEXT(cset) = cset; - me->mask |= GC_CSet; - } + NEXT(cset) = cset; + me->mask |= GC_CSet; } } #else @@ -512,9 +506,9 @@ setCgsFont(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId, XTermFonts * font) #endif font = &(xw->screen.fnts[fNorm]); } - if (HaveFont(font) && okFont(font->fs) && !SameFont(NEXT(font), font)) { - TRACE2(("...updated next font for %s to %s\n", - traceCgsEnum(cgsId), traceFont(font))); + if (HaveFont(font) && okFont(font->fs)) { + TRACE2(("...updated next font in %p for %s to %s\n", + me, traceCgsEnum(cgsId), traceFont(font))); TRACE2(("...next font was %s\n", traceFont(NEXT(font)))); NEXT(font) = font; me->mask |= GCFont; @@ -752,10 +746,18 @@ copyCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId) TRACE(("copyCgs from %s to %s\n", traceCgsEnum(srcCgsId), traceCgsEnum(dstCgsId))); - setCgsFont(xw, cgsWin, dstCgsId, THIS(font)); + TRACE2(("copyCgs from %s (me %p, fg %s, bg %s, cset %s) to %s {{\n", + traceCgsEnum(srcCgsId), + me, + tracePixel(xw, THIS(fg)), + tracePixel(xw, THIS(bg)), + traceCSet(THIS(cset)), + traceCgsEnum(dstCgsId))); setCgsCSet(xw, cgsWin, dstCgsId, THIS(cset)); setCgsFore(xw, cgsWin, dstCgsId, THIS(fg)); setCgsBack(xw, cgsWin, dstCgsId, THIS(bg)); + setCgsFont(xw, cgsWin, dstCgsId, THIS(font)); + TRACE2(("...copyCgs }}\n")); } } } @@ -835,7 +837,7 @@ freeCgs(XtermWidget xw, VTwin * cgsWin, CgsEnum cgsId) if (LIST(j).gc != 0) { TRACE(("freeCgs(%s, %s) gc %p(%d)\n", traceVTwin(xw, cgsWin), - traceCgsEnum(cgsId), LIST(j).gc, j)); + traceCgsEnum(cgsId), (void *) LIST(j).gc, j)); clrCgsFonts(xw, cgsWin, LIST(j).font); #if OPT_BOX_CHARS if (cgsId == gcDots) { diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c index 11964d3ac..9a93cff4d 100644 --- a/app/xterm/charproc.c +++ b/app/xterm/charproc.c @@ -1,4 +1,4 @@ -/* $XTermId: charproc.c,v 1.897 2009/03/29 00:23:12 tom Exp $ */ +/* $XTermId: charproc.c,v 1.971 2009/08/09 13:59:06 tom Exp $ */ /* @@ -137,7 +137,6 @@ static void FromAlternate(XtermWidget /* xw */ ); static void RequestResize(XtermWidget termw, int rows, int cols, Bool text); static void SwitchBufs(XtermWidget xw); static void ToAlternate(XtermWidget /* xw */ ); -static void VTallocbuf(void); static void ansi_modes(XtermWidget termw, void (*func) (unsigned *p, unsigned mask)); static void bitclr(unsigned *p, unsigned mask); @@ -269,6 +268,7 @@ static XtActionsRec actionsList[] = { { "keymap", HandleKeymapChange }, { "popup-menu", HandlePopupMenu }, { "print", HandlePrintScreen }, + { "print-everything", HandlePrintEverything }, { "print-redir", HandlePrintControlMode }, { "quit", HandleQuit }, { "redraw", HandleRedraw }, @@ -427,8 +427,9 @@ static XtResource resources[] = screen.highlight_selection, False), Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, False), Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, True), + Bres(XtNfastScroll, XtCFastScroll, screen.fastscroll, False), Bres(XtNjumpScroll, XtCJumpScroll, screen.jumpscroll, True), - Bres(XtNkeepSelection, XtCKeepSelection, screen.keepSelection, False), + Bres(XtNkeepSelection, XtCKeepSelection, screen.keepSelection, True), Bres(XtNloginShell, XtCLoginShell, misc.login_shell, False), Bres(XtNmarginBell, XtCMarginBell, screen.marginbell, False), Bres(XtNmetaSendsEscape, XtCMetaSendsEscape, screen.meta_sends_esc, False), @@ -567,6 +568,7 @@ static XtResource resources[] = Sres(XtNinputMethod, XtCInputMethod, misc.input_method, NULL), Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, "OverTheSpot,Root"), + Ires(XtNretryInputMethod, XtCRetryInputMethod, misc.retry_im, 3), #endif #if OPT_ISO_COLORS @@ -723,7 +725,7 @@ static void VTRealize(Widget w, XtValueMask * valuemask, static void VTResize(Widget w); #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD -static void VTInitI18N(void); +static void VTInitI18N(XtermWidget); #endif #ifdef VMS @@ -837,6 +839,7 @@ xtermAddInput(Widget w) } #if OPT_ISO_COLORS +#ifdef EXP_BOGUS_FG static Bool CheckBogusForeground(TScreen * screen, const char *tag) { @@ -847,12 +850,14 @@ CheckBogusForeground(TScreen * screen, const char *tag) for (pass = 0; pass < 2; ++pass) { row = screen->cur_row; for (; isClear && (row <= screen->max_row); ++row) { + Char *attribs = getLineData(screen, row)->attribs; + col = (row == screen->cur_row) ? screen->cur_col : 0; for (; isClear && (col <= screen->max_col); ++col) { - unsigned flags = SCRN_BUF_ATTRS(screen, row)[col]; + unsigned flags = attribs[col]; if (pass) { flags &= ~FG_COLOR; - SCRN_BUF_ATTRS(screen, row)[col] = (Char) flags; + attribs[col] = (Char) flags; } else if ((flags & BG_COLOR)) { isClear = False; } else if ((flags & FG_COLOR)) { @@ -872,6 +877,7 @@ CheckBogusForeground(TScreen * screen, const char *tag) return isClear; } +#endif /* * The terminal's foreground and background colors are set via two mechanisms: @@ -899,6 +905,7 @@ SGR_Foreground(XtermWidget xw, int color) setCgsFore(xw, WhichVWin(screen), gcBold, fg); setCgsBack(xw, WhichVWin(screen), gcBoldReverse, fg); +#ifdef EXP_BOGUS_FG /* * If we've just turned off the foreground color, check for blank cells * which have no background color, but do have foreground color. This @@ -911,6 +918,7 @@ SGR_Foreground(XtermWidget xw, int color) if (color < 0) { CheckBogusForeground(screen, "SGR_Foreground"); } +#endif } void @@ -1204,17 +1212,18 @@ which_table(Const PARSE_T * table) if (screen->curss) { \ dotext(xw, \ screen->gsets[(int) (screen->curss)], \ - print_area, 1); \ + sp->print_area, \ + (Cardinal) 1); \ screen->curss = 0; \ single++; \ } \ - if (print_used > single) { \ + if (sp->print_used > single) { \ dotext(xw, \ screen->gsets[(int) (screen->curgl)], \ - print_area + single, \ - print_used - single); \ + sp->print_area + single, \ + (Cardinal) (sp->print_used - single)); \ } \ - print_used = 0; \ + sp->print_used = 0; \ } \ struct ParseState { @@ -1232,6 +1241,14 @@ struct ParseState { #if OPT_WIDE_CHARS int last_was_wide; #endif + /* Buffer for processing printable text */ + IChar *print_area; + size_t print_size; + size_t print_used; + /* Buffer for processing strings (e.g., OSC ... ST) */ + Char *string_area; + size_t string_size; + size_t string_used; }; static struct ParseState myState; @@ -1239,6 +1256,8 @@ static struct ParseState myState; static void init_groundtable(TScreen * screen, struct ParseState *sp) { + (void) screen; + #if OPT_VT52_MODE if (!(screen->vtXX_level)) { sp->groundtable = vt52_table; @@ -1265,14 +1284,6 @@ select_charset(struct ParseState *sp, int type, int size) static Boolean doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) { - /* Buffer for processing printable text */ - static IChar *print_area; - static size_t print_size, print_used; - - /* Buffer for processing strings (e.g., OSC ... ST) */ - static Char *string_area; - static size_t string_size, string_used; - TScreen *screen = &xw->screen; int row; int col; @@ -1331,7 +1342,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) /* Intercept characters for printer controller mode */ if (screen->printer_controlmode == 2) { - if ((c = (unsigned) xtermPrinterControl((int) c)) == 0) + if ((c = (unsigned) xtermPrinterControl(xw, (int) c)) == 0) continue; } @@ -1403,10 +1414,10 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) */ if (screen->brokenLinuxOSC && sp->parsestate == sos_table) { - if (string_used) { - switch (string_area[0]) { + if (sp->string_used) { + switch (sp->string_area[0]) { case 'P': - if (string_used <= 7) + if (sp->string_used <= 7) break; /* FALLTHRU */ case 'R': @@ -1494,7 +1505,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) * characters. */ if (sp->nextstate == CASE_PRINT) { - SafeAlloc(IChar, print_area, print_used, print_size); + SafeAlloc(IChar, sp->print_area, sp->print_used, sp->print_size); if (new_string == 0) { fprintf(stderr, "Cannot allocate %u bytes for printable text\n", @@ -1510,9 +1521,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) if (screen->vtXX_level < 1) c &= 0x7f; #endif - print_area = new_string; - print_size = new_length; - print_area[print_used++] = c; + sp->print_area = new_string; + sp->print_size = new_length; + sp->print_area[sp->print_used++] = (IChar) c; sp->lastchar = thischar = (int) c; #if OPT_WIDE_CHARS sp->last_was_wide = this_is_wide; @@ -1523,7 +1534,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) } if (sp->nextstate == CASE_PRINT - || (laststate == CASE_PRINT && print_used)) { + || (laststate == CASE_PRINT && sp->print_used)) { WriteNow(); } @@ -1532,7 +1543,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) * This should always be 8-bit characters. */ if (sp->parsestate == sos_table) { - SafeAlloc(Char, string_area, string_used, string_size); + SafeAlloc(Char, sp->string_area, sp->string_used, sp->string_size); if (new_string == 0) { fprintf(stderr, "Cannot allocate %u bytes for string mode %d\n", @@ -1550,13 +1561,13 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) c = '?'; } #endif - string_area = new_string; - string_size = new_length; - string_area[string_used++] = CharOf(c); + sp->string_area = new_string; + sp->string_size = new_length; + sp->string_area[(sp->string_used)++] = CharOf(c); } else if (sp->parsestate != esc_table) { /* if we were accumulating, we're not any more */ sp->string_mode = 0; - string_used = 0; + sp->string_used = 0; } TRACE(("parse %04X -> %d %s\n", c, sp->nextstate, which_table(sp->parsestate))); @@ -1585,9 +1596,9 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case CASE_BELL: TRACE(("CASE_BELL - bell\n")); if (sp->string_mode == ANSI_OSC) { - if (string_used) - string_area[--string_used] = '\0'; - do_osc(xw, string_area, string_used, (int) c); + if (sp->string_used) + sp->string_area[--(sp->string_used)] = '\0'; + do_osc(xw, sp->string_area, sp->string_used, (int) c); sp->parsestate = sp->groundtable; } else { /* bell */ @@ -1630,7 +1641,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) /* * form feed, line feed, vertical tab */ - xtermAutoPrint(c); + xtermAutoPrint(xw, c); xtermIndex(xw, 1); if (xw->flags & LINEFEED) CarriageReturn(screen); @@ -2307,13 +2318,13 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) case CASE_MC: TRACE(("CASE_MC - media control\n")); - xtermMediaControl(param[0], False); + xtermMediaControl(xw, param[0], False); sp->parsestate = sp->groundtable; break; case CASE_DEC_MC: TRACE(("CASE_DEC_MC - DEC media control\n")); - xtermMediaControl(param[0], True); + xtermMediaControl(xw, param[0], True); sp->parsestate = sp->groundtable; break; @@ -2522,20 +2533,20 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) break; case CASE_ST: - TRACE(("CASE_ST: End of String (%d bytes)\n", string_used)); + TRACE(("CASE_ST: End of String (%d bytes)\n", sp->string_used)); sp->parsestate = sp->groundtable; - if (!string_used) + if (!sp->string_used) break; - string_area[--string_used] = '\0'; + sp->string_area[--(sp->string_used)] = '\0'; switch (sp->string_mode) { case ANSI_APC: /* ignored */ break; case ANSI_DCS: - do_dcs(xw, string_area, string_used); + do_dcs(xw, sp->string_area, sp->string_used); break; case ANSI_OSC: - do_osc(xw, string_area, string_used, ANSI_ST); + do_osc(xw, sp->string_area, sp->string_used, ANSI_ST); break; case ANSI_PM: /* ignored */ @@ -3061,7 +3072,7 @@ v_write(int f, Char * data, unsigned len) if (len > 0) { #if OPT_DABBREV - term->screen.dabbrev_working = 0; /* break dabbrev sequence */ + term->screen.dabbrev_working = False; /* break dabbrev sequence */ #endif if (v_bufend < v_bufptr + len) { /* we've run out of room */ if (v_bufstr != v_buffer) { @@ -3449,20 +3460,22 @@ doinput(void) static void PreeditPosition(TScreen * screen) { + LineData *ld; XPoint spot; XVaNestedList list; - if (!screen->xic) - return; - spot.x = (short) CurCursorX(screen, screen->cur_row, screen->cur_col); - spot.y = (short) (CursorY(screen, screen->cur_row) + screen->fs_ascent); - list = XVaCreateNestedList(0, - XNSpotLocation, &spot, - XNForeground, T_COLOR(screen, TEXT_FG), - XNBackground, T_COLOR(screen, TEXT_BG), - NULL); - XSetICValues(screen->xic, XNPreeditAttributes, list, NULL); - XFree(list); + if (screen->xic + && (ld = getLineData(screen, screen->cur_row)) != 0) { + spot.x = (short) LineCursorX(screen, ld, screen->cur_col); + spot.y = (short) (CursorY(screen, screen->cur_row) + screen->fs_ascent); + list = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNForeground, T_COLOR(screen, TEXT_FG), + XNBackground, T_COLOR(screen, TEXT_BG), + NULL); + XSetICValues(screen->xic, XNPreeditAttributes, list, NULL); + XFree(list); + } } #endif @@ -3470,12 +3483,15 @@ static void WrapLine(XtermWidget xw) { TScreen *screen = &(xw->screen); + LineData *ld = getLineData(screen, screen->cur_row); - /* mark that we had to wrap this line */ - ScrnSetFlag(screen, screen->cur_row, LINEWRAPPED); - xtermAutoPrint('\n'); - xtermIndex(xw, 1); - set_cur_col(screen, 0); + if (ld != 0) { + /* mark that we had to wrap this line */ + LineSetFlag(ld, LINEWRAPPED); + xtermAutoPrint(xw, '\n'); + xtermIndex(xw, 1); + set_cur_col(screen, 0); + } } /* @@ -3577,7 +3593,11 @@ dotext(XtermWidget xw, #else /* ! OPT_WIDE_CHARS */ for (offset = 0; offset < len; offset += this_col) { - last_col = CurMaxCol(screen, screen->cur_row); +#if OPT_DEC_CHRSET + LineData *ld = getLineData(screen, screen->cur_row); +#endif + + last_col = LineMaxCol(screen, ld); this_col = last_col - screen->cur_col + 1; if (this_col <= 1) { if (screen->do_wrap) { @@ -4001,7 +4021,7 @@ dpmodes(XtermWidget xw, if (IsSM()) { ToAlternate(xw); } else { - if (screen->alternate + if (screen->whichBuf && (param[i] == 1047)) ClearScreen(xw); FromAlternate(xw); @@ -4237,7 +4257,7 @@ savemodes(XtermWidget xw) case 1047: /* alternate buffer */ /* FALLTHRU */ case 47: /* alternate buffer */ - DoSM(DP_X_ALTSCRN, screen->alternate); + DoSM(DP_X_ALTSCRN, screen->whichBuf); break; case SET_VT200_MOUSE: /* mouse bogus sequence */ case SET_VT200_HIGHLIGHT_MOUSE: @@ -4504,17 +4524,20 @@ window_ops(XtermWidget xw) TRACE(("window_ops %d\n", param[0])); switch (param[0]) { case 1: /* Restore (de-iconify) window */ + TRACE(("...de-iconify window\n")); XMapWindow(screen->display, VShellWindow); break; case 2: /* Minimize (iconify) window */ + TRACE(("...iconify window\n")); XIconifyWindow(screen->display, VShellWindow, DefaultScreen(screen->display)); break; case 3: /* Move the window to the given position */ + TRACE(("...move window to %d,%d\n", param[1], param[2])); values.x = param[1]; values.y = param[2]; value_mask = (CWX | CWY); @@ -4530,14 +4553,17 @@ window_ops(XtermWidget xw) break; case 5: /* Raise the window to the front of the stack */ + TRACE(("...raise window\n")); XRaiseWindow(screen->display, VShellWindow); break; case 6: /* Lower the window to the bottom of the stack */ + TRACE(("...lower window\n")); XLowerWindow(screen->display, VShellWindow); break; case 7: /* Refresh the window */ + TRACE(("...redraw window\n")); Redraw(); break; @@ -4552,6 +4578,7 @@ window_ops(XtermWidget xw) #endif case 11: /* Report the window's state */ + TRACE(("...get window attributes\n")); XGetWindowAttributes(screen->display, VWindow(screen), &win_attrs); @@ -4567,6 +4594,7 @@ window_ops(XtermWidget xw) break; case 13: /* Report the window's position */ + TRACE(("...get window position\n")); XGetWindowAttributes(screen->display, WMFrameWindow(xw), &win_attrs); @@ -4582,6 +4610,7 @@ window_ops(XtermWidget xw) break; case 14: /* Report the window's size in pixels */ + TRACE(("...get window size in pixels\n")); XGetWindowAttributes(screen->display, VWindow(screen), &win_attrs); @@ -4601,6 +4630,7 @@ window_ops(XtermWidget xw) break; case 18: /* Report the text's size in characters */ + TRACE(("...get window size in characters\n")); reply.a_type = ANSI_CSI; reply.a_pintro = 0; reply.a_nparam = 3; @@ -4792,7 +4822,7 @@ unparse_end(XtermWidget xw) void ToggleAlternate(XtermWidget xw) { - if (xw->screen.alternate) + if (xw->screen.whichBuf) FromAlternate(xw); else ToAlternate(xw); @@ -4803,13 +4833,18 @@ ToAlternate(XtermWidget xw) { TScreen *screen = &(xw->screen); - if (!screen->alternate) { + if (screen->whichBuf == 0) { TRACE(("ToAlternate\n")); - if (!screen->altbuf) - screen->altbuf = Allocate(MaxRows(screen), MaxCols(screen), - &screen->abuf_address); + if (!screen->editBuf_index[1]) + screen->editBuf_index[1] = allocScrnBuf(xw, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen), + &screen->editBuf_data[1]); SwitchBufs(xw); - screen->alternate = True; + screen->whichBuf = 1; +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[screen->whichBuf]; +#endif update_altscreen(); } } @@ -4819,12 +4854,15 @@ FromAlternate(XtermWidget xw) { TScreen *screen = &(xw->screen); - if (screen->alternate) { + if (screen->whichBuf != 0) { TRACE(("FromAlternate\n")); if (screen->scroll_amt) FlushScroll(xw); - screen->alternate = False; + screen->whichBuf = 0; SwitchBufs(xw); +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[screen->whichBuf]; +#endif update_altscreen(); } } @@ -4859,32 +4897,35 @@ Bool CheckBufPtrs(TScreen * screen) { return (screen->visbuf != 0 - && screen->altbuf != 0); +#if OPT_SAVE_LINES + && screen->editBuf_index[0] != 0 +#endif + && screen->editBuf_index[1] != 0); } /* * Swap buffer line pointers between alternate and regular screens. - * visbuf contains pointers from allbuf or altbuf for the visible screen, - * and pointers from allbuf for the saved lines. That makes it simple to - * scroll back over the saved lines without juggling pointers for the - * regular and alternate screens. */ void SwitchBufPtrs(TScreen * screen) { if (CheckBufPtrs(screen)) { +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[screen->whichBuf]; +#else size_t len = ScrnPointers(screen, (unsigned) MaxRows(screen)); - memcpy((char *) screen->save_ptr, (char *) screen->visbuf, len); - memcpy((char *) screen->visbuf, (char *) screen->altbuf, len); - memcpy((char *) screen->altbuf, (char *) screen->save_ptr, len); + memcpy(screen->save_ptr, screen->visbuf, len); + memcpy(screen->visbuf, screen->editBuf_index[1], len); + memcpy(screen->editBuf_index[1], screen->save_ptr, len); +#endif } } void -VTRun(void) +VTRun(XtermWidget xw) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); TRACE(("VTRun ...\n")); @@ -4896,8 +4937,7 @@ VTRun(void) update_tekshow(); set_vthide_sensitivity(); - if (screen->allbuf == NULL) - VTallocbuf(); + ScrnAllocBuf(xw); screen->cursor_state = OFF; screen->cursor_set = ON; @@ -4914,7 +4954,7 @@ VTRun(void) #endif screen->is_running = True; if (!setjmp(VTend)) - VTparse(term); + VTparse(xw); StopBlinking(screen); HideCursor(); screen->cursor_set = OFF; @@ -5056,6 +5096,7 @@ RequestResize(XtermWidget xw, int rows, int cols, Bool text) getXtermSizeHints(xw); #endif + TRACE(("...requesting resize %dx%d\n", askedHeight, askedWidth)); status = REQ_RESIZE((Widget) xw, askedWidth, askedHeight, &replyWidth, &replyHeight); @@ -5096,10 +5137,9 @@ static String xterm_trans = <MappingNotify>: KeyboardMapping()\n"; int -VTInit(void) +VTInit(XtermWidget xw) { - TScreen *screen = TScreenOf(term); - Widget vtparent = SHELL_OF(term); + Widget vtparent = SHELL_OF(xw); TRACE(("VTInit {{\n")); @@ -5108,34 +5148,15 @@ VTInit(void) (void) XSetWMProtocols(XtDisplay(vtparent), XtWindow(vtparent), &wm_delete_window, 1); TRACE_TRANS("shell", vtparent); - TRACE_TRANS("vt100", (Widget) (term)); + TRACE_TRANS("vt100", (Widget) (xw)); - if (screen->allbuf == NULL) - VTallocbuf(); + ScrnAllocBuf(xw); TRACE(("...}} VTInit\n")); return (1); } static void -VTallocbuf(void) -{ - TScreen *screen = TScreenOf(term); - int nrows = MaxRows(screen); - - /* allocate screen buffer now, if necessary. */ - if (screen->scrollWidget) - nrows += screen->savelines; - screen->allbuf = Allocate(nrows, MaxCols(screen), - &screen->sbuf_address); - if (screen->scrollWidget) - screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; - else - screen->visbuf = screen->allbuf; - return; -} - -static void VTClassInit(void) { XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, @@ -5425,12 +5446,12 @@ VTInitialize(Widget wrequest, * field-by-field assignment of "screen" fields that are named in the * resource list. */ - bzero((char *) &wnew->screen, sizeof(wnew->screen)); + memset(&wnew->screen, 0, sizeof(wnew->screen)); /* DESCO Sys#67660 * Zero out the entire "keyboard" component of "wnew" widget. */ - bzero((char *) &wnew->keyboard, sizeof(wnew->keyboard)); + memset(&wnew->keyboard, 0, sizeof(wnew->keyboard)); /* dummy values so that we don't try to Realize the parent shell with height * or width of 0, which is illegal in X. The real size is computed in the @@ -5500,6 +5521,7 @@ VTInitialize(Widget wrequest, #endif init_Ires(screen.border); init_Bres(screen.jumpscroll); + init_Bres(screen.fastscroll); init_Bres(screen.old_fkeys); init_Bres(screen.delete_is_del); wnew->keyboard.type = wnew->screen.old_fkeys @@ -5680,9 +5702,6 @@ VTInitialize(Widget wrequest, wnew->screen.cache_doublesize)); #endif -#if OPT_WIDE_CHARS - wnew->num_ptrs = (OFF_CHARS + 1); /* minimum needed for cell */ -#endif #if OPT_ISO_COLORS init_Ires(screen.veryBoldColors); init_Bres(screen.boldColors); @@ -5918,9 +5937,6 @@ VTInitialize(Widget wrequest, TRACE(("initialized unicode_font to %d\n", wnew->screen.unicode_font)); #endif - if (wnew->screen.wide_chars != False) - wnew->num_ptrs = OFF_FINAL + (wnew->screen.max_combining * 2); - decode_wcwidth((wnew->misc.cjk_width ? 2 : 0) + (wnew->misc.mk_width ? 1 : 0) + 1, @@ -5974,11 +5990,11 @@ VTInitialize(Widget wrequest, set_character_class(wnew->screen.charClass); /* create it, but don't realize it */ - ScrollBarOn(wnew, True, False); + ScrollBarOn(wnew, True); /* make sure that the resize gravity acceptable */ - if (wnew->misc.resizeGravity != NorthWestGravity && - wnew->misc.resizeGravity != SouthWestGravity) { + if (!GravityIsNorthWest(wnew) && + !GravityIsSouthWest(wnew)) { char value[80]; char *temp[2]; Cardinal nparams = 1; @@ -6031,6 +6047,7 @@ VTInitialize(Widget wrequest, if (wnew->misc.appkeypadDefault) wnew->keyboard.flags |= MODE_DECKPAM; + initLineData(wnew); return; } @@ -6072,16 +6089,28 @@ releaseWindowGCs(XtermWidget xw, VTwin * win) #ifdef NO_LEAKS #if OPT_RENDERFONT static void -xtermCloseXft(TScreen * screen, XftFont ** pub) +xtermCloseXft(TScreen * screen, XTermXftFonts * pub) { - if (*pub != 0) { - XftFontClose(screen->display, *pub); - *pub = 0; + if (pub->font != 0) { + XftFontClose(screen->display, pub->font); + pub->font = 0; } } #endif #endif +#if OPT_INPUT_METHOD +static void +cleanupInputMethod(TScreen * screen) +{ + if (screen->xim) { + XCloseIM(screen->xim); + screen->xim = 0; + TRACE(("freed screen->xim\n")); + } +} +#endif + static void VTDestroy(Widget w GCC_UNUSED) { @@ -6096,26 +6125,28 @@ VTDestroy(Widget w GCC_UNUSED) XtUninstallTranslations(screen->scrollWidget); XtDestroyWidget(screen->scrollWidget); } - +#if OPT_FIFO_LINES + while (screen->saved_fifo-- > 0) { + deleteScrollback(screen, 0); + } +#endif TRACE_FREE_LEAK(screen->save_ptr); - TRACE_FREE_LEAK(screen->sbuf_address); - TRACE_FREE_LEAK(screen->allbuf); - TRACE_FREE_LEAK(screen->abuf_address); - TRACE_FREE_LEAK(screen->altbuf); + TRACE_FREE_LEAK(screen->saveBuf_data); + TRACE_FREE_LEAK(screen->saveBuf_index); + for (n = 0; n < 2; ++n) { + TRACE_FREE_LEAK(screen->editBuf_data[n]); + TRACE_FREE_LEAK(screen->editBuf_index[n]); + } TRACE_FREE_LEAK(screen->keyboard_dialect); TRACE_FREE_LEAK(screen->term_id); #if OPT_WIDE_CHARS - TRACE_FREE_LEAK(screen->draw_buf); #if OPT_LUIT_PROG TRACE_FREE_LEAK(xw->misc.locale_str); TRACE_FREE_LEAK(xw->misc.localefilter); #endif #endif #if OPT_INPUT_METHOD - if (screen->xim) { - XCloseIM(screen->xim); - TRACE(("freed screen->xim\n")); - } + cleanupInputMethod(screen); #endif releaseCursorGCs(xw); releaseWindowGCs(xw, &(screen->fullVwin)); @@ -6139,9 +6170,11 @@ VTDestroy(Widget w GCC_UNUSED) xtermCloseXft(screen, &(screen->renderFontNorm[n])); xtermCloseXft(screen, &(screen->renderFontBold[n])); xtermCloseXft(screen, &(screen->renderFontItal[n])); +#if OPT_RENDERWIDE xtermCloseXft(screen, &(screen->renderWideNorm[n])); xtermCloseXft(screen, &(screen->renderWideBold[n])); xtermCloseXft(screen, &(screen->renderWideItal[n])); +#endif } #endif @@ -6176,6 +6209,23 @@ VTDestroy(Widget w GCC_UNUSED) TRACE_FREE_LEAK(xw->keyboard.extra_translations); TRACE_FREE_LEAK(xw->keyboard.shell_translations); TRACE_FREE_LEAK(xw->keyboard.xterm_translations); + +#if OPT_WIDE_CHARS + FreeTypedBuffer(XChar2b); + FreeTypedBuffer(char); +#endif +#if OPT_RENDERFONT +#if OPT_RENDERWIDE + FreeTypedBuffer(XftCharSpec); +#else + FreeTypedBuffer(XftChar8); +#endif +#endif + + TRACE_FREE_LEAK(myState.print_area); + TRACE_FREE_LEAK(myState.string_area); + memset(&myState, 0, sizeof(myState)); + #endif /* defined(NO_LEAKS) */ } @@ -6357,7 +6407,7 @@ VTRealize(Widget w, /* use ForgetGravity instead of SouthWestGravity because translating the Expose events for ConfigureNotifys is too hard */ - values->bit_gravity = ((xw->misc.resizeGravity == NorthWestGravity) + values->bit_gravity = (GravityIsNorthWest(xw) ? NorthWestGravity : ForgetGravity); xw->screen.fullVwin.window = XtWindow(xw) = @@ -6428,7 +6478,7 @@ VTRealize(Widget w, #endif /* NO_ACTIVE_ICON */ #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD - VTInitI18N(); + VTInitI18N(xw); #else xw->screen.xic = NULL; #endif @@ -6465,7 +6515,10 @@ VTRealize(Widget w, #if OPT_TEK4014 if (!tekWidget) /* if not called after fork */ #endif - screen->visbuf = screen->allbuf = NULL; + { + screen->visbuf = NULL; + screen->saveBuf_index = NULL; + } screen->do_wrap = False; screen->scrolls = screen->incopy = 0; @@ -6474,7 +6527,7 @@ VTRealize(Widget w, screen->savedlines = 0; for (i = 0; i < 2; ++i) { - screen->alternate = (Boolean) (!screen->alternate); + screen->whichBuf = !screen->whichBuf; CursorSave(xw); } @@ -6483,7 +6536,7 @@ VTRealize(Widget w, */ if (xw->misc.scrollbar) { screen->fullVwin.sb_info.width = 0; - ScrollBarOn(xw, False, True); + ScrollBarOn(xw, False); } return; } @@ -6502,7 +6555,7 @@ xim_instantiate_cb(Display * display, if (display != XtDisplay(term)) return; - VTInitI18N(); + VTInitI18N(term); } static void @@ -6518,8 +6571,9 @@ xim_destroy_cb(XIM im GCC_UNUSED, #endif /* X11R6+ */ static void -xim_real_init(void) +xim_real_init(XtermWidget xw) { + TScreen *screen = TScreenOf(xw); unsigned i, j; char *p, *s, *t, *ns, *end, buf[32]; XIMStyles *xim_styles; @@ -6540,17 +6594,17 @@ xim_real_init(void) }, }; - term->screen.xic = NULL; + screen->xic = NULL; - if (term->misc.cannot_im) { + if (xw->misc.cannot_im) { return; } - if (!term->misc.input_method || !*term->misc.input_method) { + if (!xw->misc.input_method || !*xw->misc.input_method) { if ((p = XSetLocaleModifiers("")) != NULL && *p) - term->screen.xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL); + screen->xim = XOpenIM(XtDisplay(xw), NULL, NULL, NULL); } else { - s = term->misc.input_method; + s = xw->misc.input_method; i = 5 + strlen(s); t = (char *) MyStackAlloc(i, buf); if (t == NULL) @@ -6571,10 +6625,10 @@ xim_real_init(void) strncat(t, s, (unsigned) (end - s)); if ((p = XSetLocaleModifiers(t)) != 0 && *p - && (term->screen.xim = XOpenIM(XtDisplay(term), - NULL, - NULL, - NULL)) != 0) + && (screen->xim = XOpenIM(XtDisplay(xw), + NULL, + NULL, + NULL)) != 0) break; } @@ -6583,29 +6637,29 @@ xim_real_init(void) MyStackFree(t, buf); } - if (term->screen.xim == NULL + if (screen->xim == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL && *p) { - term->screen.xim = XOpenIM(XtDisplay(term), NULL, NULL, NULL); + screen->xim = XOpenIM(XtDisplay(xw), NULL, NULL, NULL); } - if (!term->screen.xim) { + if (!screen->xim) { fprintf(stderr, "Failed to open input method\n"); return; } TRACE(("VTInitI18N opened input method\n")); - if (XGetIMValues(term->screen.xim, XNQueryInputStyle, &xim_styles, NULL) + if (XGetIMValues(screen->xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles || !xim_styles->count_styles) { fprintf(stderr, "input method doesn't support any style\n"); - XCloseIM(term->screen.xim); - term->misc.cannot_im = True; + cleanupInputMethod(screen); + xw->misc.cannot_im = True; return; } found = False; - for (s = term->misc.preedit_type; s && !found;) { + for (s = xw->misc.preedit_type; s && !found;) { while (*s && isspace(CharOf(*s))) s++; if (!*s) @@ -6642,9 +6696,9 @@ xim_real_init(void) if (!found) { fprintf(stderr, "input method doesn't support my preedit type (%s)\n", - term->misc.preedit_type); - XCloseIM(term->screen.xim); - term->misc.cannot_im = True; + xw->misc.preedit_type); + cleanupInputMethod(screen); + xw->misc.cannot_im = True; return; } @@ -6655,8 +6709,8 @@ xim_real_init(void) if (input_style == (XIMPreeditArea | XIMStatusArea)) { fprintf(stderr, "This program doesn't support the 'OffTheSpot' preedit type\n"); - XCloseIM(term->screen.xim); - term->misc.cannot_im = True; + cleanupInputMethod(screen); + xw->misc.cannot_im = True; return; } @@ -6677,53 +6731,53 @@ xim_real_init(void) XFontStruct **fonts; char **font_name_list; - term->screen.fs = XCreateFontSet(XtDisplay(term), - term->misc.f_x, - &missing_charset_list, - &missing_charset_count, - &def_string); - if (term->screen.fs == NULL) { + screen->fs = XCreateFontSet(XtDisplay(xw), + xw->misc.f_x, + &missing_charset_list, + &missing_charset_count, + &def_string); + if (screen->fs == NULL) { fprintf(stderr, "Preparation of font set " - "\"%s\" for XIM failed.\n", term->misc.f_x); - term->screen.fs = XCreateFontSet(XtDisplay(term), - DEFXIMFONT, - &missing_charset_list, - &missing_charset_count, - &def_string); + "\"%s\" for XIM failed.\n", xw->misc.f_x); + screen->fs = XCreateFontSet(XtDisplay(xw), + DEFXIMFONT, + &missing_charset_list, + &missing_charset_count, + &def_string); } - if (term->screen.fs == NULL) { + if (screen->fs == NULL) { fprintf(stderr, "Preparation of default font set " "\"%s\" for XIM failed.\n", DEFXIMFONT); - XCloseIM(term->screen.xim); - term->misc.cannot_im = True; + cleanupInputMethod(screen); + xw->misc.cannot_im = True; return; } - (void) XExtentsOfFontSet(term->screen.fs); - j = (unsigned) XFontsOfFontSet(term->screen.fs, &fonts, &font_name_list); - for (i = 0, term->screen.fs_ascent = 0; i < j; i++) { - if (term->screen.fs_ascent < (*fonts)->ascent) - term->screen.fs_ascent = (*fonts)->ascent; + (void) XExtentsOfFontSet(screen->fs); + j = (unsigned) XFontsOfFontSet(screen->fs, &fonts, &font_name_list); + for (i = 0, screen->fs_ascent = 0; i < j; i++) { + if (screen->fs_ascent < (*fonts)->ascent) + screen->fs_ascent = (*fonts)->ascent; } p_list = XVaCreateNestedList(0, XNSpotLocation, &spot, - XNFontSet, term->screen.fs, - NULL); - term->screen.xic = XCreateIC(term->screen.xim, - XNInputStyle, input_style, - XNClientWindow, XtWindow(term), - XNFocusWindow, XtWindow(term), - XNPreeditAttributes, p_list, + XNFontSet, screen->fs, NULL); + screen->xic = XCreateIC(screen->xim, + XNInputStyle, input_style, + XNClientWindow, XtWindow(xw), + XNFocusWindow, XtWindow(xw), + XNPreeditAttributes, p_list, + NULL); } else { - term->screen.xic = XCreateIC(term->screen.xim, XNInputStyle, input_style, - XNClientWindow, XtWindow(term), - XNFocusWindow, XtWindow(term), - NULL); + screen->xic = XCreateIC(screen->xim, XNInputStyle, input_style, + XNClientWindow, XtWindow(xw), + XNFocusWindow, XtWindow(xw), + NULL); } - if (!term->screen.xic) { + if (!screen->xic) { fprintf(stderr, "Failed to create input context\n"); - XCloseIM(term->screen.xim); + cleanupInputMethod(screen); } #if defined(USE_XIM_INSTANTIATE_CB) else { @@ -6731,7 +6785,7 @@ xim_real_init(void) destroy_cb.callback = xim_destroy_cb; destroy_cb.client_data = NULL; - if (XSetIMValues(term->screen.xim, XNDestroyCallback, &destroy_cb, NULL)) + if (XSetIMValues(screen->xim, XNDestroyCallback, &destroy_cb, NULL)) fprintf(stderr, "Could not set destroy callback to IM\n"); } #endif @@ -6740,15 +6794,17 @@ xim_real_init(void) } static void -VTInitI18N(void) +VTInitI18N(XtermWidget xw) { - if (term->misc.open_im) { - xim_real_init(); + if (xw->misc.open_im) { + xim_real_init(xw); #if defined(USE_XIM_INSTANTIATE_CB) - if (term->screen.xic == NULL && !term->misc.cannot_im) { + if (xw->screen.xic == NULL + && !xw->misc.cannot_im + && xw->misc.retry_im-- > 0) { sleep(3); - XRegisterIMInstantiateCallback(XtDisplay(term), NULL, NULL, NULL, + XRegisterIMInstantiateCallback(XtDisplay(xw), NULL, NULL, NULL, xim_instantiate_cb, NULL); } #endif @@ -6835,10 +6891,9 @@ ShowCursor(void) XtermWidget xw = term; TScreen *screen = &xw->screen; int x, y; - int base; - Char clo; + IChar base; unsigned flags; - unsigned fg_bg = 0; + CellColor fg_bg = 0; GC currentGC; CgsEnum currentCgs = gcMAX; VTwin *currentWin = WhichVWin(screen); @@ -6856,11 +6911,11 @@ ShowCursor(void) Boolean use_selfg; #endif #if OPT_WIDE_CHARS - Char chi = 0; - int off; + size_t off; int my_col = 0; #endif int cursor_col; + LineData *ld = 0; if (screen->cursor_state == BLINKED_OFF) return; @@ -6882,37 +6937,35 @@ ShowCursor(void) } #endif /* NO_ACTIVE_ICON */ - base = - clo = SCRN_BUF_CHARS(screen, screen->cursorp.row)[cursor_col]; - flags = SCRN_BUF_ATTRS(screen, screen->cursorp.row)[cursor_col]; + ld = getLineData(screen, screen->cur_row); + + base = ld->charData[cursor_col]; + flags = ld->attribs[cursor_col]; if_OPT_WIDE_CHARS(screen, { - chi = SCRN_BUF_WIDEC(screen, screen->cursorp.row)[cursor_col]; - if (clo == HIDDEN_LO && chi == HIDDEN_HI && cursor_col > 0) { + if (base == HIDDEN_CHAR && cursor_col > 0) { /* if cursor points to non-initial part of wide character, * back it up */ --cursor_col; - clo = SCRN_BUF_CHARS(screen, screen->cursorp.row)[cursor_col]; - chi = SCRN_BUF_WIDEC(screen, screen->cursorp.row)[cursor_col]; + base = ld->charData[cursor_col]; } my_col = cursor_col; - base = (chi << 8) | clo; if (base == 0) - base = clo = ' '; - if (isWide(base)) + base = ' '; + if (isWide((int) base)) my_col += 1; }); if (base == 0) { - base = clo = ' '; + base = ' '; } - +#if OPT_ISO_COLORS +#ifdef EXP_BOGUS_FG /* * If the cursor happens to be on blanks, and we have not set both * foreground and background color, do not treat it as a colored cell. */ -#if OPT_ISO_COLORS if (base == ' ') { if ((flags & (FG_COLOR | BG_COLOR)) == BG_COLOR) { TRACE(("ShowCursor - do not treat as a colored cell\n")); @@ -6924,18 +6977,24 @@ ShowCursor(void) flags &= ~(FG_COLOR | BG_COLOR); } } +#else /* !EXP_BOGUS_FG */ + /* + * If the cursor happens to be on blanks, and the foreground color is set + * but not the background, do not treat it as a colored cell. + */ + if ((flags & TERM_COLOR_FLAGS(xw)) == BG_COLOR + && base == ' ') { + flags &= ~TERM_COLOR_FLAGS(xw); + } +#endif #endif /* * Compare the current cell to the last set of colors used for the * cursor and update the GC's if needed. */ - (void) fg_bg; - if_OPT_EXT_COLORS(screen, { - fg_bg = PACK_FGBG(screen, screen->cursorp.row, cursor_col); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - fg_bg = SCRN_BUF_COLOR(screen, screen->cursorp.row)[cursor_col]; + if_OPT_ISO_COLORS(screen, { + fg_bg = ld->color[cursor_col]; }); fg_pix = getXtermForeground(xw, flags, extract_fg(xw, fg_bg, flags)); bg_pix = getXtermBackground(xw, flags, extract_bg(xw, fg_bg, flags)); @@ -7046,22 +7105,21 @@ ShowCursor(void) currentGC = getCgsGC(xw, currentWin, currentCgs); drawXtermText(xw, flags & DRAWX_MASK, currentGC, - x = CurCursorX(screen, screen->cur_row, cursor_col), + x = LineCursorX(screen, ld, cursor_col), y = CursorY(screen, screen->cur_row), - curXtermChrSet(xw, screen->cur_row), - PAIRED_CHARS(&clo, &chi), 1, 0); + LineCharSet(screen, ld), + &base, 1, 0); #if OPT_WIDE_CHARS if_OPT_WIDE_CHARS(screen, { - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - clo = SCREEN_PTR(screen, screen->cursorp.row, off + 0)[my_col]; - chi = SCREEN_PTR(screen, screen->cursorp.row, off + 1)[my_col]; - if (!(clo || chi)) + for_each_combData(off, ld) { + if (!(ld->combData[off][my_col])) break; drawXtermText(xw, (flags & DRAWX_MASK) | NOBACKGROUND, currentGC, x, y, - curXtermChrSet(xw, screen->cur_row), - PAIRED_CHARS(&clo, &chi), 1, isWide(base)); + LineCharSet(screen, ld), + ld->combData[off] + my_col, + 1, isWide((int) base)); } }); #endif @@ -7081,6 +7139,8 @@ ShowCursor(void) } } screen->cursor_state = ON; + + return; } /* @@ -7093,17 +7153,16 @@ HideCursor(void) TScreen *screen = &xw->screen; GC currentGC; int x, y; - int base; - Char clo; + IChar base; unsigned flags; - unsigned fg_bg = 0; + CellColor fg_bg = 0; Bool in_selection; #if OPT_WIDE_CHARS - Char chi = 0; - int off; + size_t off; int my_col = 0; #endif int cursor_col; + LineData *ld = 0; if (screen->cursor_state == OFF) /* FIXME */ return; @@ -7119,32 +7178,30 @@ HideCursor(void) } #endif /* NO_ACTIVE_ICON */ - base = - clo = SCRN_BUF_CHARS(screen, screen->cursorp.row)[cursor_col]; - flags = SCRN_BUF_ATTRS(screen, screen->cursorp.row)[cursor_col]; + ld = getLineData(screen, screen->cursorp.row); + + base = ld->charData[cursor_col]; + flags = ld->attribs[cursor_col]; if_OPT_WIDE_CHARS(screen, { - chi = SCRN_BUF_WIDEC(screen, screen->cursorp.row)[cursor_col]; - if (clo == HIDDEN_LO && chi == HIDDEN_HI && cursor_col > 0) { + if (base == HIDDEN_CHAR && cursor_col > 0) { /* if cursor points to non-initial part of wide character, * back it up */ --cursor_col; - clo = SCRN_BUF_CHARS(screen, screen->cursorp.row)[cursor_col]; - chi = SCRN_BUF_WIDEC(screen, screen->cursorp.row)[cursor_col]; + base = ld->charData[cursor_col]; } my_col = cursor_col; - base = (chi << 8) | clo; if (base == 0) - base = clo = ' '; - if (isWide(base)) + base = ' '; + if (isWide((int) base)) my_col += 1; }); if (base == 0) { - base = clo = ' '; + base = ' '; } - +#ifdef EXP_BOGUS_FG /* * If the cursor happens to be on blanks, and we have not set both * foreground and background color, do not treat it as a colored cell. @@ -7162,16 +7219,17 @@ HideCursor(void) } } #endif +#endif +#if OPT_ISO_COLORS + fg_bg = 0; +#endif /* * Compare the current cell to the last set of colors used for the * cursor and update the GC's if needed. */ - if_OPT_EXT_COLORS(screen, { - fg_bg = PACK_FGBG(screen, screen->cursorp.row, cursor_col); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - fg_bg = SCRN_BUF_COLOR(screen, screen->cursorp.row)[cursor_col]; + if_OPT_ISO_COLORS(screen, { + fg_bg = ld->color[cursor_col]; }); if (OutsideSelection(screen, screen->cursorp.row, screen->cursorp.col)) @@ -7184,27 +7242,28 @@ HideCursor(void) TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n", screen->cursorp.row, screen->cursorp.col)); drawXtermText(xw, flags & DRAWX_MASK, currentGC, - x = CurCursorX(screen, screen->cursorp.row, cursor_col), + x = LineCursorX(screen, ld, cursor_col), y = CursorY(screen, screen->cursorp.row), - curXtermChrSet(xw, screen->cursorp.row), - PAIRED_CHARS(&clo, &chi), 1, 0); + LineCharSet(screen, ld), + &base, 1, 0); #if OPT_WIDE_CHARS if_OPT_WIDE_CHARS(screen, { - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - clo = SCREEN_PTR(screen, screen->cursorp.row, off + 0)[my_col]; - chi = SCREEN_PTR(screen, screen->cursorp.row, off + 1)[my_col]; - if (!(clo || chi)) + for_each_combData(off, ld) { + if (!(ld->combData[off][my_col])) break; drawXtermText(xw, (flags & DRAWX_MASK) | NOBACKGROUND, currentGC, x, y, - curXtermChrSet(xw, screen->cur_row), - PAIRED_CHARS(&clo, &chi), 1, isWide(base)); + LineCharSet(screen, ld), + ld->combData[off] + my_col, + 1, isWide((int) base)); } }); #endif screen->cursor_state = OFF; resetXtermGC(xw, flags, in_selection); + + return; } #if OPT_BLINK_CURS || OPT_BLINK_TEXT @@ -7234,14 +7293,13 @@ StopBlinking(TScreen * screen) #if OPT_BLINK_TEXT static Bool -ScrnHasBlinking(TScreen * screen, int row) +LineHasBlinking(TScreen * screen, LineData * ld) { - Char *attrs = SCRN_BUF_ATTRS(screen, row); int col; Bool result = False; for (col = 0; col < MaxCols(screen); ++col) { - if (attrs[col] & BLINK) { + if (ld->attribs[col] & BLINK) { result = True; break; } @@ -7294,15 +7352,16 @@ HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED) int last_row = -1; for (row = screen->max_row; row >= 0; row--) { - if (ScrnTstBlinked(screen, row)) { - if (ScrnHasBlinking(screen, row)) { + LineData *ld = getLineData(screen, ROW2INX(screen, row)); + if (LineTstBlinked(ld)) { + if (LineHasBlinking(screen, ld)) { resume = True; if (row > last_row) last_row = row; if (row < first_row) first_row = row; } else { - ScrnClrBlinked(screen, row); + LineClrBlinked(ld); } } } @@ -7463,8 +7522,8 @@ VTReset(XtermWidget xw, Bool full, Bool saved) update_reversewrap(); CursorSave(xw); - screen->sc[screen->alternate != False].row = - screen->sc[screen->alternate != False].col = 0; + screen->sc[screen->whichBuf].row = + screen->sc[screen->whichBuf].col = 0; } longjmp(vtjmpbuf, 1); /* force ground state in parser */ } diff --git a/app/xterm/configure.in b/app/xterm/configure.in index bf21ad426..53dcf698d 100644 --- a/app/xterm/configure.in +++ b/app/xterm/configure.in @@ -1,4 +1,4 @@ -dnl $XTermId: configure.in,v 1.246 2008/12/30 11:30:48 tom Exp $ +dnl $XTermId: configure.in,v 1.252 2009/08/13 19:41:01 tom Exp $ dnl dnl --------------------------------------------------------------------------- dnl @@ -565,6 +565,16 @@ if test "$enable_sun_fkeys" = no ; then AC_DEFINE(OPT_SUN_FUNC_KEYS,0) fi +AC_MSG_CHECKING(if you want saved-lines stored as a FIFO) +CF_ARG_DISABLE(fifo-lines, + [ --enable-fifo-lines disable FIFO-storage for saved-lines], + [enable_fifo_lines=no], + [enable_fifo_lines=yes]) +AC_MSG_RESULT($enable_fifo_lines) +if test "$enable_fifo_lines" = yes ; then + AC_DEFINE(OPT_FIFO_LINES,1) +fi + AC_MSG_CHECKING(if you want support for internationalization) CF_ARG_DISABLE(i18n, [ --disable-i18n disable internationalization], @@ -797,6 +807,19 @@ CF_ARG_OPTION(wide-chars, [enable_wchar=$enable_luit], [$enable_luit]) AC_MSG_RESULT($enable_wchar) + +AC_MSG_CHECKING(if you want only 16-bit character support) +CF_ARG_ENABLE(16bit-chars, + [ --enable-16bit-chars enable 16-bit character support], + [enable_16bit_chars=yes], + [enable_16bit_chars=no]) +AC_MSG_RESULT($enable_16bit_chars) + +if test "$enable_16bit_chars" = yes ; then + AC_DEFINE(OPT_WIDER_ICHAR,0) + enable_wchar=yes +fi + if test "$enable_wchar" = yes ; then AC_DEFINE(OPT_WIDE_CHARS,1) EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms index 8520cefdc..6fdd467a9 100644 --- a/app/xterm/ctlseqs.ms +++ b/app/xterm/ctlseqs.ms @@ -1,6 +1,6 @@ .\"#! troff -ms $1 -*- Nroff -*- .\" "Xterm Control Sequences" document -.\" $XTermId: ctlseqs.ms,v 1.190 2008/05/26 22:24:56 tom Exp $ +.\" $XTermId: ctlseqs.ms,v 1.191 2009/08/03 21:16:54 tom Exp $ .\" .\" .\" Copyright 1996-2007,2008 by Thomas E. Dickey @@ -1124,7 +1124,7 @@ Reverse Attributes in Rectangular Area (DECRARA). \*(Ps denotes the attributes to reverse. 1, 4, 5, 7 . .IP \\*(Cs\\*u -Save cursor (ANSI.SYS) +Restore cursor (ANSI.SYS) . .IP \\*(Cs\\*(Pt\\*;\\*(Pl\\*;\\*(Pb\\*;\\*(Pr\\*;\\*(Pp\\*;\\*(Pt\\*;\\*(Pl\\*;\\*(Pp\\*$\\*v Copy Rectangular Area (DECCRA) diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt index b4e763668..5644dc8af 100644 --- a/app/xterm/ctlseqs.txt +++ b/app/xterm/ctlseqs.txt @@ -636,7 +636,7 @@ CSI Pt; Pl; Pb; Pr; Ps$ t Reverse Attributes in Rectangular Area (DECRARA). Pt; Pl; Pb; Pr denotes the rectangle. Ps denotes the attributes to reverse. 1, 4, 5, 7 -CSI u Save cursor (ANSI.SYS) +CSI u Restore cursor (ANSI.SYS) CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v Copy Rectangular Area (DECCRA) Pt; Pl; Pb; Pr denotes the rectangle. diff --git a/app/xterm/cursor.c b/app/xterm/cursor.c index 49c51ea58..86817eca9 100644 --- a/app/xterm/cursor.c +++ b/app/xterm/cursor.c @@ -1,9 +1,7 @@ -/* $XTermId: cursor.c,v 1.46 2008/10/05 20:12:16 tom Exp $ */ - -/* $XFree86: xc/programs/xterm/cursor.c,v 3.20 2006/02/13 01:14:58 dickey Exp $ */ +/* $XTermId: cursor.c,v 1.53 2009/08/09 17:23:25 tom Exp $ */ /* - * Copyright 2002-2007,2008 by Thomas E. Dickey + * Copyright 2002-2008,2009 by Thomas E. Dickey * * All Rights Reserved * @@ -128,8 +126,11 @@ CursorBack(XtermWidget xw, int n) void CursorForward(TScreen * screen, int n) { +#if OPT_DEC_CHRSET + LineData *ld = getLineData(screen, screen->cur_row); +#endif int next = screen->cur_col + n; - int max = CurMaxCol(screen, screen->cur_row); + int max = LineMaxCol(screen, ld); if (next > max) next = max; @@ -250,8 +251,8 @@ AdjustSavedCursor(XtermWidget xw, int adjust) { TScreen *screen = &xw->screen; - if (screen->alternate) { - SavedCursor *sc = &screen->sc[screen->alternate == False]; + if (screen->whichBuf) { + SavedCursor *sc = &screen->sc[0]; if (adjust > 0) { TRACE(("AdjustSavedCursor %d -> %d\n", sc->row, sc->row - adjust)); @@ -267,7 +268,7 @@ void CursorSave(XtermWidget xw) { TScreen *screen = &xw->screen; - SavedCursor *sc = &screen->sc[screen->alternate != False]; + SavedCursor *sc = &screen->sc[screen->whichBuf]; sc->saved = True; sc->row = screen->cur_row; @@ -296,7 +297,7 @@ void CursorRestore(XtermWidget xw) { TScreen *screen = &xw->screen; - SavedCursor *sc = &screen->sc[screen->alternate != False]; + SavedCursor *sc = &screen->sc[screen->whichBuf]; /* Restore the character sets, unless we never did a save-cursor op. * In that case, we'll reset the character sets. @@ -351,6 +352,8 @@ CursorPrevLine(TScreen * screen, int count) int set_cur_row(TScreen * screen, int value) { + TRACE(("set_cur_row %d vs %d\n", value, screen ? screen->max_row : -1)); + assert(screen != 0); assert(value >= 0); assert(value <= screen->max_row); @@ -361,6 +364,8 @@ set_cur_row(TScreen * screen, int value) int set_cur_col(TScreen * screen, int value) { + TRACE(("set_cur_col %d vs %d\n", value, screen ? screen->max_col : -1)); + assert(screen != 0); assert(value >= 0); assert(value <= screen->max_col); diff --git a/app/xterm/data.c b/app/xterm/data.c index 8938442fd..795e75374 100644 --- a/app/xterm/data.c +++ b/app/xterm/data.c @@ -1,9 +1,7 @@ -/* $XTermId: data.c,v 1.79 2006/02/13 01:14:58 tom Exp $ */ - -/* $XFree86: xc/programs/xterm/data.c,v 3.34 2006/02/13 01:14:58 dickey Exp $ */ +/* $XTermId: data.c,v 1.90 2009/08/09 17:22:56 tom Exp $ */ /* - * Copyright 2002-2005,2006 by Thomas E. Dickey + * Copyright 2002-2006,2007 by Thomas E. Dickey * * All Rights Reserved * @@ -60,7 +58,7 @@ Widget toplevel; /* top-most widget in xterm */ #if OPT_TEK4014 Char *Tpushb; Char *Tpushback; -TekLink *TekRefresh; +TekLink *tekRefreshList; TekWidget tekWidget; Widget tekshellwidget; int T_lastx = -1; @@ -73,13 +71,11 @@ char *ProgramName; Arg ourTopLevelShellArgs[] = { - {XtNallowShellResize, (XtArgVal) TRUE}, - {XtNinput, (XtArgVal) TRUE}, + {XtNallowShellResize, (XtArgVal) True}, + {XtNinput, (XtArgVal) True}, }; Cardinal number_ourTopLevelShellArgs = 2; -Bool waiting_for_initial_map; - Atom wm_delete_window; /* for ICCCM delete window */ XTERM_RESOURCE resource; @@ -97,19 +93,7 @@ XtermWidget term; /* master data structure for client */ char *xterm_name; /* argv[0] */ int hold_screen; -SIG_ATOMIC_T need_cleanup = FALSE; - -#if OPT_ZICONBEEP -int zIconBeep; /* non-zero means beep; see charproc.c for details -IAN! */ -Boolean zIconBeep_flagged; /* True if the icon name has been changed */ -#endif /* OPT_ZICONBEEP */ - -#if OPT_SAME_NAME -Boolean sameName; /* Don't change the title or icon name if it - is the same. This prevents flicker on the - screen at the cost of an extra request to - the server */ -#endif +SIG_ATOMIC_T need_cleanup = False; int am_slave = -1; /* set to file-descriptor if we're a slave process */ int max_plus1; @@ -119,5 +103,10 @@ PtySelect pty_mask; char *ptydev; char *ttydev; -Boolean waitingForTrackInfo = False; -EventMode eventMode = NORMAL; +#if HANDLE_STRUCT_NOTIFY +int mapstate = -1; +#endif /* HANDLE_STRUCT_NOTIFY */ + +#if OPT_SESSION_MGT +int ice_fd = -1; +#endif diff --git a/app/xterm/data.h b/app/xterm/data.h index 53bdd4427..41f152a39 100644 --- a/app/xterm/data.h +++ b/app/xterm/data.h @@ -1,6 +1,4 @@ -/* $XTermId: data.h,v 1.106 2009/01/24 16:24:06 tom Exp $ */ - -/* $XFree86: xc/programs/xterm/data.h,v 3.39 2006/02/13 01:14:58 dickey Exp $ */ +/* $XTermId: data.h,v 1.109 2009/08/09 17:23:01 tom Exp $ */ /* * Copyright 2002-2007,2009 by Thomas E. Dickey diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c index a59831ef0..26cd4e3c6 100644 --- a/app/xterm/doublechr.c +++ b/app/xterm/doublechr.c @@ -1,4 +1,4 @@ -/* $XTermId: doublechr.c,v 1.64 2009/02/12 01:23:54 tom Exp $ */ +/* $XTermId: doublechr.c,v 1.72 2009/08/07 00:25:02 tom Exp $ */ /************************************************************ @@ -45,58 +45,58 @@ authorization. * controls apply to a whole line). However, it's easier to maintain the * information for special fonts by writing to all cells. */ -#define curChrSet SCRN_BUF_CSETS(screen, screen->cur_row)[0] - #if OPT_DEC_CHRSET static void repaint_line(XtermWidget xw, unsigned newChrSet) { - register TScreen *screen = &xw->screen; + TScreen *screen = &xw->screen; + LineData *ld; int curcol = screen->cur_col; int currow = screen->cur_row; int width = MaxCols(screen); unsigned len = (unsigned) width; - unsigned oldChrSet = SCRN_BUF_CSETS(screen, currow)[0]; assert(width > 0); /* * Ignore repetition. */ - if (oldChrSet == newChrSet) - return; - - TRACE(("repaint_line(%2d,%2d) (%s -> %s)\n", currow, screen->cur_col, - visibleChrsetName(oldChrSet), - visibleChrsetName(newChrSet))); - HideCursor(); + if ((ld = getLineData(screen, currow)) != 0) { + unsigned oldChrSet = GetLineDblCS(ld); + + if (oldChrSet != newChrSet) { + TRACE(("repaint_line(%2d,%2d) (%s -> %s)\n", currow, screen->cur_col, + visibleChrsetName(oldChrSet), + visibleChrsetName(newChrSet))); + HideCursor(); + + /* If switching from single-width, keep the cursor in the visible part + * of the line. + */ + if (CSET_DOUBLE(newChrSet)) { + width /= 2; + if (curcol > width) + curcol = width; + } - /* If switching from single-width, keep the cursor in the visible part - * of the line. - */ - if (CSET_DOUBLE(newChrSet)) { - width /= 2; - if (curcol > width) - curcol = width; + /* + * ScrnRefresh won't paint blanks for us if we're switching between a + * 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)); + + SetLineDblCS(ld, newChrSet); + + set_cur_col(screen, 0); + ScrnUpdate(xw, currow, 0, 1, (int) len, True); + set_cur_col(screen, curcol); + } } - - /* - * ScrnRefresh won't paint blanks for us if we're switching between a - * single-size and double-size font. So we paint our own. - */ - ClearCurBackground(xw, - CursorY(screen, currow), - CurCursorX(screen, currow, 0), - (unsigned) FontHeight(screen), - len * (unsigned) CurFontWidth(screen, currow)); - - /* FIXME: do VT220 softchars allow double-sizes? */ - memset(SCRN_BUF_CSETS(screen, currow), (Char) newChrSet, len); - - set_cur_col(screen, 0); - ScrnUpdate(xw, currow, 0, 1, (int) len, True); - set_cur_col(screen, curcol); } #endif diff --git a/app/xterm/error.h b/app/xterm/error.h index 50b187bb8..6e95055e1 100644 --- a/app/xterm/error.h +++ b/app/xterm/error.h @@ -1,7 +1,5 @@ -/* $XTermId: error.h,v 1.18 2006/02/13 01:14:58 tom Exp $ */ +/* $XTermId: error.h,v 1.22 2009/08/09 17:23:31 tom Exp $ */ - -/* $XFree86: xc/programs/xterm/error.h,v 1.10 2006/02/13 01:14:58 dickey Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * @@ -76,13 +74,7 @@ /* screen.c */ #define ERROR_SCALLOC 90 /* Alloc: calloc() failed on base */ #define ERROR_SCALLOC2 91 /* Alloc: calloc() failed on rows */ -#define ERROR_SREALLOC 92 /* ScreenResize: realloc() failed on alt base */ -#define ERROR_RESIZE 96 /* ScreenResize: malloc() or realloc() failed */ #define ERROR_SAVE_PTR 102 /* ScrnPointers: malloc/realloc() failed */ -/* scrollbar.c */ -#define ERROR_SBRALLOC 110 /* ScrollBarOn: realloc() failed on base */ -#define ERROR_SBRALLOC2 111 /* ScrollBarOn: realloc() failed on rows */ - /* util.c */ #define ERROR_MMALLOC 121 /* my_memmove: malloc/realloc failed */ diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c index 45133746f..9eb94a251 100644 --- a/app/xterm/fontutils.c +++ b/app/xterm/fontutils.c @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.c,v 1.300 2009/02/13 01:45:01 tom Exp $ */ +/* $XTermId: fontutils.c,v 1.307 2009/08/07 23:22:32 tom Exp $ */ /************************************************************ @@ -324,11 +324,11 @@ get_font_name_props(Display * dpy, XFontStruct * fs, char *result) #define ALLOCHUNK(n) ((n | 127) + 1) static void -alloca_fontname(char **result, unsigned next) +alloca_fontname(char **result, size_t next) { - unsigned last = (*result != 0) ? strlen(*result) : 0; - unsigned have = (*result != 0) ? ALLOCHUNK(last) : 0; - unsigned want = last + next + 2; + size_t last = (*result != 0) ? strlen(*result) : 0; + size_t have = (*result != 0) ? ALLOCHUNK(last) : 0; + size_t want = last + next + 2; if (want >= have) { want = ALLOCHUNK(want); @@ -1120,12 +1120,12 @@ xtermLoadFont(XtermWidget xw, continue; } #endif - if (xtermMissingChar(xw, n, fnts[fNorm].fs)) { + if (IsXtermMissingChar(screen, n, &fnts[fNorm])) { TRACE(("missing normal char #%d\n", n)); screen->fnt_boxes = False; break; } - if (xtermMissingChar(xw, n, fnts[fBold].fs)) { + if (IsXtermMissingChar(screen, n, &fnts[fBold])) { TRACE(("missing bold char #%d\n", n)); screen->fnt_boxes = False; break; @@ -1424,17 +1424,43 @@ xtermSetCursorBox(TScreen * screen) } #define CACHE_XFT(dst,src) if (src != 0) {\ - dst[fontnum] = src;\ - TRACE(("%s[%d] = %d (%d,%d) by %d\n",\ + checkXft(xw, &(dst[fontnum]), src);\ + TRACE(("Xft metrics %s[%d] = %d (%d,%d) advance %d, actual %d%s\n",\ #dst,\ fontnum,\ src->height,\ src->ascent,\ src->descent,\ - src->max_advance_width));\ + src->max_advance_width,\ + dst[fontnum].map.min_width,\ + dst[fontnum].map.mixed ? " mixed" : ""));\ } #if OPT_RENDERFONT + +static void +checkXft(XtermWidget xw, XTermXftFonts * data, XftFont * xft) +{ + FcChar32 c; + Dimension width = 0; + + data->font = xft; + data->map.min_width = 0; + data->map.max_width = (Dimension) xft->max_advance_width; + + for (c = 32; c < 256; ++c) { + if (FcCharSetHasChar(xft->charset, c)) { + XGlyphInfo extents; + + XftTextExtents32(XtDisplay(xw), xft, &c, 1, &extents); + if (width < extents.width) + width = extents.width; + } + } + data->map.min_width = width; + data->map.mixed = (data->map.max_width >= (data->map.min_width + 1)); +} + static XftFont * xtermOpenXft(XtermWidget xw, const char *name, XftPattern * pat, const char *tag) { @@ -1573,13 +1599,13 @@ xtermComputeFontInfo(XtermWidget xw, */ if (xw->misc.render_font && !IsIconWin(screen, win)) { int fontnum = screen->menu_font_number; - XftFont *norm = screen->renderFontNorm[fontnum]; - XftFont *bold = screen->renderFontBold[fontnum]; - XftFont *ital = screen->renderFontItal[fontnum]; + XftFont *norm = screen->renderFontNorm[fontnum].font; + XftFont *bold = screen->renderFontBold[fontnum].font; + XftFont *ital = screen->renderFontItal[fontnum].font; #if OPT_RENDERWIDE - XftFont *wnorm = screen->renderWideNorm[fontnum]; - XftFont *wbold = screen->renderWideBold[fontnum]; - XftFont *wital = screen->renderWideItal[fontnum]; + XftFont *wnorm = screen->renderWideNorm[fontnum].font; + XftFont *wbold = screen->renderWideBold[fontnum].font; + XftFont *wital = screen->renderWideItal[fontnum].font; #endif if (norm == 0 && xw->misc.face_name) { @@ -1715,6 +1741,12 @@ xtermComputeFontInfo(XtermWidget xw, ? xw->misc.face_wide_name : xw->misc.face_name); int char_width = norm->max_advance_width * 2; +#ifdef FC_ASPECT + double aspect = ((xw->misc.face_wide_name + || screen->renderFontNorm[fontnum].map.mixed) + ? 1.0 + : 2.0); +#endif TRACE(("xtermComputeFontInfo wide(face %s, char_width %d)\n", face_name, @@ -1730,6 +1762,9 @@ xtermComputeFontInfo(XtermWidget xw, XftPatternBuild(pat, WideXftPattern, XFT_CHAR_WIDTH, XftTypeInteger, char_width, +#ifdef FC_ASPECT + FC_ASPECT, XftTypeDouble, aspect, +#endif (void *) 0); wnorm = OPEN_XFT("wide"); @@ -1856,45 +1891,39 @@ xtermUpdateFontInfo(XtermWidget xw, Bool doresize) * Returns true if the given character is missing from the specified font. */ Bool -xtermMissingChar(XtermWidget xw, unsigned ch, XFontStruct * font) +xtermMissingChar(unsigned ch, XTermFonts * font) { - TScreen *screen = TScreenOf(xw); - - if (font != 0 - && font->per_char != 0 - && !font->all_chars_exist) { - static XCharStruct dft, *tmp = &dft, *pc = 0; + Bool result = False; + XFontStruct *fs = font->fs; + static XCharStruct dft, *tmp = &dft, *pc = 0; - if (font->max_byte1 == 0) { + if (fs->max_byte1 == 0) { #if OPT_WIDE_CHARS - if (ch > 255) { - TRACE(("xtermMissingChar %#04x (row)\n", ch)); - return True; - } -#endif - CI_GET_CHAR_INFO_1D(font, E2A(ch), tmp, pc); + if (ch > 255) { + TRACE(("xtermMissingChar %#04x (row)\n", ch)); + return True; } +#endif + CI_GET_CHAR_INFO_1D(fs, E2A(ch), tmp, pc); + } #if OPT_WIDE_CHARS - else { - CI_GET_CHAR_INFO_2D(font, HI_BYTE(ch), LO_BYTE(ch), tmp, pc); - } + else { + CI_GET_CHAR_INFO_2D(fs, HI_BYTE(ch), LO_BYTE(ch), tmp, pc); + } #else - if (!pc) - return False; /* Urgh! */ + if (!pc) + return False; /* Urgh! */ #endif - if (CI_NONEXISTCHAR(pc)) { - TRACE(("xtermMissingChar %#04x (!exists)\n", ch)); - return True; - } + if (CI_NONEXISTCHAR(pc)) { + TRACE(("xtermMissingChar %#04x (!exists)\n", ch)); + result = True; } - if (xtermIsDecGraphic(ch) - && screen->force_box_chars) { - TRACE(("xtermMissingChar %#04x (forced off)\n", ch)); - return True; + if (ch < 256) { + font->known_missing[ch] = (Char) (result ? 2 : 1); } - return False; + return result; } /* @@ -2130,10 +2159,10 @@ xtermDrawBoxChar(XtermWidget xw, unsigned n; for (n = 1; n < 32; n++) { if (dec2ucs(n) == ch - && !xtermMissingChar(xw, n, - ((flags & BOLD) - ? screen->fnts[fBold].fs - : screen->fnts[fNorm].fs))) { + && !IsXtermMissingChar(screen, n, + ((flags & BOLD) + ? &screen->fnts[fBold] + : &screen->fnts[fNorm]))) { TRACE(("...use xterm-style linedrawing\n")); ch = n; break; diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h index d30c62754..33c385f96 100644 --- a/app/xterm/fontutils.h +++ b/app/xterm/fontutils.h @@ -1,4 +1,4 @@ -/* $XTermId: fontutils.h,v 1.71 2009/02/13 01:36:41 tom Exp $ */ +/* $XTermId: fontutils.h,v 1.75 2009/08/07 22:46:12 tom Exp $ */ /************************************************************ @@ -59,8 +59,34 @@ extern char *xtermSpecialFont (TScreen */* screen */, unsigned /* atts */, unsig #endif #if OPT_BOX_CHARS -extern Bool xtermMissingChar (XtermWidget /* xw */, unsigned /* ch */, XFontStruct */* font */); + +#define FontIsIncomplete(font) \ + ((font)->fs != 0 \ + && (font)->fs->per_char != 0 \ + && !(font)->fs->all_chars_exist) + +#define ForceBoxChars(screen,ch) \ + (xtermIsDecGraphic(ch) \ + && (screen)->force_box_chars) + +#if OPT_WIDE_CHARS +#define CharKnownMissing(font, ch) \ + ((ch) < 256 && (font)->known_missing[(Char)(ch)]) +#else +#define CharKnownMissing(font, ch) \ + ((font)->known_missing[(Char)(ch)]) +#endif + +#define IsXtermMissingChar(screen, ch, font) \ + (CharKnownMissing(font, ch) \ + ? ((font)->known_missing[(Char)(ch)] > 1) \ + : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \ + || ForceBoxChars(screen, ch))) + +extern Bool xtermMissingChar (unsigned /* ch */, XTermFonts */* font */); extern void xtermDrawBoxChar (XtermWidget /* xw */, unsigned /* ch */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* cols */); +#else +#define IsXtermMissingChar(screen, ch, font) False #endif #if OPT_LOAD_VTFONTS diff --git a/app/xterm/input.c b/app/xterm/input.c index 7de33bf6d..fd6e3e0c5 100644 --- a/app/xterm/input.c +++ b/app/xterm/input.c @@ -1,4 +1,4 @@ -/* $XTermId: input.c,v 1.307 2009/03/15 18:53:57 tom Exp $ */ +/* $XTermId: input.c,v 1.309 2009/06/18 00:08:40 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -874,7 +874,7 @@ Input(XtermWidget xw, ", %d:'%s'%s" FMT_MODIFIER_NAMES "%s%s%s%s%s%s\n", kd.keysym, kd.nbytes, - visibleChars(PAIRED_CHARS((Char *) kd.strbuf, 0), + visibleChars((Char *) kd.strbuf, ((kd.nbytes > 0) ? (unsigned) kd.nbytes : 0)), @@ -1107,7 +1107,6 @@ Input(XtermWidget xw, while (kd.nbytes-- > 0) unparseputc(xw, CharOf(*string++)); } -#if OPT_VT52_MODE /* * Interpret F1-F4 as PF1-PF4 for VT52, VT100 */ @@ -1121,9 +1120,7 @@ Input(XtermWidget xw, &modify_parm); MODIFIER_PARM; unparseseq(xw, &reply); - } -#endif - else { + } else { reply.a_type = ANSI_CSI; reply.a_final = 0; @@ -1342,7 +1339,7 @@ void StringInput(XtermWidget xw, Char * string, size_t nbytes) { TRACE(("InputString (%s,%d)\n", - visibleChars(PAIRED_CHARS(string, 0), nbytes), + visibleChars(string, nbytes), nbytes)); #if OPT_TEK4014 if (nbytes && TEK4014_GIN(tekWidget)) { diff --git a/app/xterm/linedata.c b/app/xterm/linedata.c new file mode 100644 index 000000000..9896a44e4 --- /dev/null +++ b/app/xterm/linedata.c @@ -0,0 +1,251 @@ +/* $XTermId: linedata.c,v 1.71 2009/08/09 00:34:16 tom Exp $ */ + +/************************************************************ + +Copyright 2009 by Thomas E. Dickey + + All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + +********************************************************/ + +#include <xterm.h> +#include <data.h> /* FIXME - needed for 'term' */ + +#include <assert.h> + +/* + * Given a row-number, find the corresponding data for the line in the VT100 + * widget. Row numbers can be positive or negative. + * + * If the data comes from the scrollback, defer that to getScrollback(). + */ +LineData * +getLineData(TScreen * screen, int row) +{ + LineData *result = 0; + ScrnBuf buffer; + + if (row >= 0) { + buffer = screen->visbuf; + } else { +#if OPT_FIFO_LINES + buffer = 0; + result = getScrollback(screen, row); +#else + buffer = screen->saveBuf_index; + row += screen->savelines; +#endif + } + if (row >= 0) { + result = (LineData *) scrnHeadAddr(screen, buffer, (unsigned) row); + if (result != 0) { +#if 1 /* FIXME - these should be done in setupLineData, etc. */ + result->lineSize = (Dimension) MaxCols(screen); +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + result->combSize = (Char) screen->max_combining; + } else { + result->combSize = 0; + } +#endif +#endif /* FIXME */ + } + } + + return result; +} + +/* + * Copy line's data, e.g., from one screen buffer to another, given the preset + * pointers for the destination. + * + * TODO: optionally prune unused combining character data from the result. + */ +void +copyLineData(LineData * dst, LineData * src) +{ + dst->bufHead = src->bufHead; + +#if OPT_WIDE_CHARS + dst->combSize = src->combSize; +#endif + + /* + * Usually we're copying the same-sized line; a memcpy is faster than + * several loops. + */ + if (dst->lineSize == src->lineSize) { + size_t size = (sizeof(dst->attribs[0]) +#if OPT_ISO_COLORS + + sizeof(dst->color[0]) +#endif + + sizeof(dst->charData[0]) +#if OPT_WIDE_CHARS + + sizeof(dst->combData[0][0]) * dst->combSize +#endif + ); + + memcpy(dst->attribs, src->attribs, size * dst->lineSize); + } else { + Dimension col; + Dimension limit = ((dst->lineSize < src->lineSize) + ? dst->lineSize + : src->lineSize); +#if OPT_WIDE_CHARS + Char comb; +#endif + + for (col = 0; col < limit; ++col) { + dst->attribs[col] = src->attribs[col]; +#if OPT_ISO_COLORS + dst->color[col] = src->color[col]; +#endif + dst->charData[col] = src->charData[col]; +#if OPT_WIDE_CHARS + for (comb = 0; comb < dst->combSize; ++comb) { + dst->combData[comb][col] = src->combData[comb][col]; + } +#endif + } + for (col = limit; col < dst->lineSize; ++col) { + dst->attribs[col] = 0; +#if OPT_ISO_COLORS + dst->color[col] = 0; +#endif + dst->charData[col] = 0; +#if OPT_WIDE_CHARS + for (comb = 0; comb < dst->combSize; ++comb) { + dst->combData[comb][col] = 0; + } +#endif + } + } +} + +#if OPT_WIDE_CHARS +#define initLineExtra(screen) \ + screen->lineExtra = ((size_t) (screen->max_combining) * sizeof(IChar *)) +#else +#define initLineExtra(screen) \ + screen->lineExtra = 0 +#endif + +void +initLineData(XtermWidget xw) +{ + TScreen *screen = &(xw->screen); + + initLineExtra(screen); + + TRACE(("initLineData %d\n", screen->lineExtra)); + TRACE(("...sizeof(LineData) %d\n", sizeof(LineData))); +#if OPT_ISO_COLORS + TRACE(("...sizeof(CellColor) %d\n", sizeof(CellColor))); +#endif + TRACE(("...sizeof(RowData) %d\n", sizeof(RowData))); + TRACE(("...offset(lineSize) %d\n", offsetof(LineData, lineSize))); + TRACE(("...offset(bufHead) %d\n", offsetof(LineData, bufHead))); +#if OPT_WIDE_CHARS + TRACE(("...offset(combSize) %d\n", offsetof(LineData, combSize))); +#endif + TRACE(("...offset(attribs) %d\n", offsetof(LineData, attribs))); +#if OPT_ISO_COLORS + TRACE(("...offset(color) %d\n", offsetof(LineData, color))); +#endif + TRACE(("...offset(charData) %d\n", offsetof(LineData, charData))); + TRACE(("...offset(combData) %d\n", offsetof(LineData, combData))); +} + +/* + * CellData size depends on the "combiningChars" resource. + * FIXME - revise this to reduce arithmetic... + */ +#define CellDataSize(screen) (SizeOfCellData + screen->lineExtra) + +#define CellDataAddr(screen, data, cell) \ + (CellData *)((char *)data + (cell * CellDataSize(screen))) + +CellData * +newCellData(XtermWidget xw, Cardinal count) +{ + CellData *result; + TScreen *screen = &(xw->screen); + + initLineExtra(screen); + result = (CellData *) calloc((size_t) count, (size_t) CellDataSize(screen)); + return result; +} + +void +saveCellData(TScreen * screen, + CellData * data, + Cardinal cell, + LineData * ld, + int column) +{ + CellData *item = CellDataAddr(screen, data, cell); + + if (column < MaxCols(screen)) { + item->attribs = ld->attribs[column]; +#if OPT_ISO_COLORS + item->color = ld->color[column]; +#endif + item->charData = ld->charData[column]; + if_OPT_WIDE_CHARS(screen, { + size_t off; + item->combSize = ld->combSize; + for_each_combData(off, ld) { + item->combData[off] = ld->combData[off][column]; + } + }) + } +} + +void +restoreCellData(TScreen * screen, + CellData * data, + Cardinal cell, + LineData * ld, + int column) +{ + CellData *item = CellDataAddr(screen, data, cell); + + if (column < MaxCols(screen)) { + ld->attribs[column] = item->attribs; +#if OPT_ISO_COLORS + ld->color[column] = item->color; +#endif + ld->charData[column] = item->charData; + if_OPT_WIDE_CHARS(screen, { + size_t off; + ld->combSize = item->combSize; + for_each_combData(off, ld) { + ld->combData[off][column] = item->combData[off]; + } + }) + } +} diff --git a/app/xterm/main.c b/app/xterm/main.c index 9552cb816..98dd9228a 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -1,4 +1,4 @@ -/* $XTermId: main.c,v 1.589 2009/01/24 16:08:01 tom Exp $ */ +/* $XTermId: main.c,v 1.593 2009/08/07 23:14:47 tom Exp $ */ /* * W A R N I N G @@ -1351,9 +1351,9 @@ Syntax(char *badOption) ProgramName, badOption); fprintf(stderr, "usage: %s", ProgramName); - col = 8 + strlen(ProgramName); + col = 8 + (int) strlen(ProgramName); for (opt = list; opt->opt; opt++) { - int len = 3 + strlen(opt->opt); /* space [ string ] */ + int len = 3 + (int) strlen(opt->opt); /* space [ string ] */ if (col + len > 79) { fprintf(stderr, "\r\n "); /* 3 spaces */ col = 3; @@ -1531,7 +1531,7 @@ my_pty_id(char *device) char *leaf = x_basename(name); if (name == leaf) { /* no '/' in the name */ - int len = strlen(leaf); + int len = (int) strlen(leaf); if (PTYCHARLEN < len) leaf = leaf + (len - PTYCHARLEN); } @@ -1572,7 +1572,7 @@ ParseSccn(char *option) if (leaf - option > 0 && isdigit(CharOf(*leaf)) && sscanf(leaf, "%d", &am_slave) == 1) { - size_t len = leaf - option - 1; + size_t len = (size_t) (leaf - option - 1); /* * If we have a slash, we only care about the part after the slash, * which is a file-descriptor. The part before the slash can be @@ -1813,7 +1813,7 @@ main(int argc, char *argv[]ENVP_ARG) TRACE_ARGV("Before XtOpenApplication", argv); if (argc > 1) { int n; - unsigned unique = 2; + size_t unique = 2; Bool quit = True; for (n = 1; n < argc; n++) { @@ -2242,10 +2242,10 @@ main(int argc, char *argv[]ENVP_ARG) int n; char **c; for (n = 0, c = command_to_exec; *c; n++, c++) ; - c = TypeMallocN(char *, n + 3 + u); + c = TypeMallocN(char *, (unsigned) (n + 3 + u)); if (c == NULL) SysError(ERROR_LUMALLOC); - memcpy(c + 2 + u, command_to_exec, (n + 1) * sizeof(char *)); + memcpy(c + 2 + u, command_to_exec, (unsigned) (n + 1) * sizeof(char *)); c[0] = term->misc.localefilter; if (u) { c[1] = "-encoding"; @@ -2416,7 +2416,7 @@ main(int argc, char *argv[]ENVP_ARG) TekRun(); else #endif - VTRun(); + VTRun(term); } } @@ -3246,7 +3246,7 @@ spawnXTerm(XtermWidget xw) False); if (!TEK4014_ACTIVE(xw)) - VTInit(); /* realize now so know window size for tty driver */ + VTInit(xw); /* realize now so know window size for tty driver */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) if (Console) { /* @@ -4096,7 +4096,7 @@ spawnXTerm(XtermWidget xw) { if (tslot > 0 && pw && !resource.utmpInhibit && (i = open(etc_utmp, O_WRONLY)) >= 0) { - bzero((char *) &utmp, sizeof(utmp)); + memset(&utmp, 0, sizeof(utmp)); (void) strncpy(utmp.ut_line, my_pty_name(ttydev), sizeof(utmp.ut_line)); @@ -4146,7 +4146,7 @@ spawnXTerm(XtermWidget xw) #ifdef USE_LASTLOGX if (xw->misc.login_shell) { - bzero((char *) &lastlogx, sizeof(lastlogx)); + memset(&lastlogx, 0, sizeof(lastlogx)); (void) strncpy(lastlogx.ll_line, my_pty_name(ttydev), sizeof(lastlogx.ll_line)); @@ -4162,7 +4162,7 @@ spawnXTerm(XtermWidget xw) size_t size = sizeof(struct lastlog); off_t offset = (screen->uid * size); - bzero((char *) &lastlog, size); + memset(&lastlog, 0, size); (void) strncpy(lastlog.ll_line, my_pty_name(ttydev), sizeof(lastlog.ll_line)); @@ -4644,7 +4644,7 @@ Exit(int n) TRACE_IDS; #endif if ((wfd = open(etc_utmp, O_WRONLY)) >= 0) { - bzero((char *) &utmp, sizeof(utmp)); + memset(&utmp, 0, sizeof(utmp)); lseek(wfd, (long) (tslot * sizeof(utmp)), 0); write(wfd, (char *) &utmp, sizeof(utmp)); close(wfd); @@ -4756,14 +4756,14 @@ resize_termcap(XtermWidget xw, char *newtc) } ptr1 += 3; ptr2 += 3; - strncpy(newtc, oldtc, i = ptr1 - oldtc); + strncpy(newtc, oldtc, i = (size_t) (ptr1 - oldtc)); temp = newtc + i; sprintf(temp, "%d", (li_first ? MaxRows(screen) : MaxCols(screen))); temp += strlen(temp); ptr1 = strchr(ptr1, ':'); - strncpy(temp, ptr1, i = ptr2 - ptr1); + strncpy(temp, ptr1, i = (size_t) (ptr2 - ptr1)); temp += i; sprintf(temp, "%d", (li_first ? MaxCols(screen) diff --git a/app/xterm/menu.c b/app/xterm/menu.c index a7f8ba2a1..19a1bb949 100644 --- a/app/xterm/menu.c +++ b/app/xterm/menu.c @@ -1,4 +1,4 @@ -/* $XTermId: menu.c,v 1.248 2009/03/28 17:27:57 tom Exp $ */ +/* $XTermId: menu.c,v 1.252 2009/07/03 15:01:14 tom Exp $ */ /* @@ -136,6 +136,7 @@ static void do_kill PROTO_XT_CALLBACK_ARGS; static void do_old_fkeys PROTO_XT_CALLBACK_ARGS; static void do_poponbell PROTO_XT_CALLBACK_ARGS; static void do_print PROTO_XT_CALLBACK_ARGS; +static void do_print_everything PROTO_XT_CALLBACK_ARGS; static void do_print_redir PROTO_XT_CALLBACK_ARGS; static void do_quit PROTO_XT_CALLBACK_ARGS; static void do_redraw PROTO_XT_CALLBACK_ARGS; @@ -625,7 +626,7 @@ domenu(Widget w, False); } #endif - if (!xtermHasPrinter()) { + if (!xtermHasPrinter(term)) { SetItemSensitivity(mainMenuEntries[mainMenu_print].widget, False); SetItemSensitivity(mainMenuEntries[mainMenu_print_redir].widget, @@ -935,7 +936,15 @@ do_print(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - xtermPrintScreen(True); + xtermPrintScreen(term, True); +} + +static void +do_print_everything(Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + xtermPrintEverything(term); } static void @@ -943,7 +952,7 @@ do_print_redir(Widget gw GCC_UNUSED, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - setPrinterControlMode(term->screen.printer_controlmode ? 0 : 2); + setPrinterControlMode(term, term->screen.printer_controlmode ? 0 : 2); } static void @@ -1570,7 +1579,7 @@ do_tektextlarge(Widget gw, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - TekSetFontSize(getTekWidget(gw), tekMenu_tektextlarge); + TekSetFontSize(getTekWidget(gw), True, tekMenu_tektextlarge); } static void @@ -1578,7 +1587,7 @@ do_tektext2(Widget gw, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - TekSetFontSize(getTekWidget(gw), tekMenu_tektext2); + TekSetFontSize(getTekWidget(gw), True, tekMenu_tektext2); } static void @@ -1586,7 +1595,7 @@ do_tektext3(Widget gw, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - TekSetFontSize(getTekWidget(gw), tekMenu_tektext3); + TekSetFontSize(getTekWidget(gw), True, tekMenu_tektext3); } static void @@ -1594,7 +1603,7 @@ do_tektextsmall(Widget gw, XtPointer closure GCC_UNUSED, XtPointer data GCC_UNUSED) { - TekSetFontSize(getTekWidget(gw), tekMenu_tektextsmall); + TekSetFontSize(getTekWidget(gw), True, tekMenu_tektextsmall); } static void @@ -1787,6 +1796,16 @@ HandlePrintScreen(Widget w, /* ARGSUSED */ void +HandlePrintEverything(Widget w, + XEvent * event GCC_UNUSED, + String * params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + do_print_everything(w, (XtPointer) 0, (XtPointer) 0); +} + +/* ARGSUSED */ +void HandlePrintControlMode(Widget w, XEvent * event GCC_UNUSED, String * params GCC_UNUSED, @@ -2164,7 +2183,7 @@ HandleAltScreen(Widget w, Cardinal *param_count) { /* eventually want to see if sensitive or not */ - handle_vt_toggle(do_altscreen, term->screen.alternate, + handle_vt_toggle(do_altscreen, term->screen.whichBuf, params, *param_count, w); } @@ -3114,7 +3133,7 @@ update_altscreen(void) UpdateCheckbox("update_altscreen", vtMenuEntries, vtMenu_altscreen, - term->screen.alternate); + term->screen.whichBuf); } void diff --git a/app/xterm/menu.h b/app/xterm/menu.h index f5781820f..ff056ee2f 100644 --- a/app/xterm/menu.h +++ b/app/xterm/menu.h @@ -1,4 +1,4 @@ -/* $XTermId: menu.h,v 1.113 2009/02/13 19:55:26 tom Exp $ */ +/* $XTermId: menu.h,v 1.114 2009/05/02 14:35:39 Ovidiu.Gheorghioiu Exp $ */ /* @@ -102,6 +102,7 @@ extern void HandleOldFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandlePopupMenu PROTO_XT_ACTIONS_ARGS; extern void HandlePrintControlMode PROTO_XT_ACTIONS_ARGS; extern void HandlePrintScreen PROTO_XT_ACTIONS_ARGS; +extern void HandlePrintEverything PROTO_XT_ACTIONS_ARGS; extern void HandleQuit PROTO_XT_ACTIONS_ARGS; extern void HandleRedraw PROTO_XT_ACTIONS_ARGS; extern void HandleRenderFont PROTO_XT_ACTIONS_ARGS; diff --git a/app/xterm/misc.c b/app/xterm/misc.c index e783cce50..b84e78e9d 100644 --- a/app/xterm/misc.c +++ b/app/xterm/misc.c @@ -1,4 +1,4 @@ -/* $XTermId: misc.c,v 1.410 2009/03/28 17:33:52 tom Exp $ */ +/* $XTermId: misc.c,v 1.425 2009/08/07 23:18:31 tom Exp $ */ /* * @@ -572,7 +572,7 @@ HandleStringEvent(Widget w GCC_UNUSED, Char hexval[2]; hexval[0] = (Char) value; hexval[1] = 0; - StringInput(term, hexval, 1); + StringInput(term, hexval, (size_t) 1); } } else { StringInput(term, (Char *) * params, strlen(*params)); @@ -979,48 +979,62 @@ WMFrameWindow(XtermWidget termw) #define MAXWLEN 1024 /* maximum word length as in tcsh */ static int -dabbrev_prev_char(int *xp, int *yp, TScreen * screen) +dabbrev_prev_char(TScreen * screen, CELL * cell, LineData ** ld) { - Char *linep; + int result = -1; + int firstLine = -(screen->savedlines); - while (*yp >= 0) { - linep = BUF_CHARS(screen->allbuf, *yp); - if (--*xp >= 0) - return linep[*xp]; - if (--*yp < 0) /* go to previous line */ + *ld = getLineData(screen, cell->row); + while (cell->row >= firstLine) { + if (--(cell->col) >= 0) { + result = (int) (*ld)->charData[cell->col]; break; - *xp = MaxCols(screen); - if (!((long) BUF_FLAGS(screen->allbuf, *yp) & LINEWRAPPED)) - return ' '; /* treat lines as separate */ + } + if (--(cell->row) < firstLine) + break; /* ...there is no previous line */ + *ld = getLineData(screen, cell->row); + cell->col = MaxCols(screen); + if (!LineTstWrapped(*ld)) { + result = ' '; /* treat lines as separate */ + break; + } } - return -1; + return result; } static char * -dabbrev_prev_word(int *xp, int *yp, TScreen * screen) +dabbrev_prev_word(TScreen * screen, CELL * cell, LineData ** ld) { static char ab[MAXWLEN]; + char *abword; int c; + char *ab_end = (ab + MAXWLEN - 1); + char *result = 0; - abword = ab + MAXWLEN - 1; + abword = ab_end; *abword = '\0'; /* end of string marker */ - while ((c = dabbrev_prev_char(xp, yp, screen)) >= 0 && - IS_WORD_CONSTITUENT(c)) + while ((c = dabbrev_prev_char(screen, cell, ld)) >= 0 && + IS_WORD_CONSTITUENT(c)) { if (abword > ab) /* store only |MAXWLEN| last chars */ *(--abword) = (char) c; - if (c < 0) { - if (abword < ab + MAXWLEN - 1) - return abword; - else - return 0; } - while ((c = dabbrev_prev_char(xp, yp, screen)) >= 0 && - !IS_WORD_CONSTITUENT(c)) ; /* skip preceding spaces */ - (*xp)++; /* can be | > screen->max_col| */ - return abword; + if (c >= 0) { + result = abword; + } else if (abword != ab_end) { + result = abword; + } + + if (result != 0) { + while ((c = dabbrev_prev_char(screen, cell, ld)) >= 0 && + !IS_WORD_CONSTITUENT(c)) { + ; /* skip preceding spaces */ + } + (cell->col)++; /* can be | > screen->max_col| */ + } + return result; } static int @@ -1028,7 +1042,7 @@ dabbrev_expand(TScreen * screen) { int pty = screen->respond; /* file descriptor of pty */ - static int x, y; + static CELL cell; static char *dabbrev_hint = 0, *lastexpansion = 0; static unsigned int expansions; @@ -1037,33 +1051,48 @@ dabbrev_expand(TScreen * screen) size_t hint_len; unsigned del_cnt; unsigned buf_cnt; + int result = 0; + LineData *ld; if (!screen->dabbrev_working) { /* initialize */ expansions = 0; - x = screen->cur_col; - y = screen->cur_row + screen->savelines; - - free(dabbrev_hint); /* free(NULL) is OK */ - dabbrev_hint = dabbrev_prev_word(&x, &y, screen); - if (!dabbrev_hint) - return 0; /* no preceding word? */ - free(lastexpansion); - if (!(lastexpansion = strdup(dabbrev_hint))) /* make own copy */ - return 0; - if (!(dabbrev_hint = strdup(dabbrev_hint))) { - free(lastexpansion); - return 0; + cell.col = screen->cur_col; + cell.row = screen->cur_row; + + if (dabbrev_hint != 0) + free(dabbrev_hint); + + if ((dabbrev_hint = dabbrev_prev_word(screen, &cell, &ld)) != 0) { + + if (lastexpansion != 0) + free(lastexpansion); + + if ((lastexpansion = strdup(dabbrev_hint)) != 0) { + + /* make own copy */ + if ((dabbrev_hint = strdup(dabbrev_hint)) != 0) { + screen->dabbrev_working = True; + /* we are in the middle of dabbrev process */ + } + } + } + if (!screen->dabbrev_working) { + if (lastexpansion != 0) { + free(lastexpansion); + lastexpansion = 0; + } + return result; } - screen->dabbrev_working = 1; /* we are in the middle of dabbrev process */ + } else { } hint_len = strlen(dabbrev_hint); for (;;) { - if (!(expansion = dabbrev_prev_word(&x, &y, screen))) { + if ((expansion = dabbrev_prev_word(screen, &cell, &ld)) == 0) { if (expansions >= 2) { expansions = 0; - x = screen->cur_col; - y = screen->cur_row + screen->savelines; + cell.col = screen->cur_col; + cell.row = screen->cur_row; continue; } break; @@ -1073,27 +1102,32 @@ dabbrev_expand(TScreen * screen) strcmp(expansion, lastexpansion)) /* different from previous */ break; } - if (!expansion) /* no expansion found */ - return 0; - del_cnt = strlen(lastexpansion) - hint_len; - buf_cnt = del_cnt + strlen(expansion) - hint_len; - if (!(copybuffer = TypeMallocN(Char, buf_cnt))) - return 0; - memset(copybuffer, screen->dabbrev_erase_char, del_cnt); /* delete previous expansion */ - memmove(copybuffer + del_cnt, - expansion + hint_len, - strlen(expansion) - hint_len); - v_write(pty, copybuffer, buf_cnt); - screen->dabbrev_working = 1; /* v_write() just set it to 1 */ - free(copybuffer); - - free(lastexpansion); - lastexpansion = strdup(expansion); - if (!lastexpansion) - return 0; - expansions++; - return 1; + if (expansion != 0) { + del_cnt = strlen(lastexpansion) - hint_len; + buf_cnt = del_cnt + strlen(expansion) - hint_len; + + if ((copybuffer = TypeMallocN(Char, buf_cnt)) != 0) { + /* delete previous expansion */ + memset(copybuffer, screen->dabbrev_erase_char, del_cnt); + memmove(copybuffer + del_cnt, + expansion + hint_len, + strlen(expansion) - hint_len); + v_write(pty, copybuffer, buf_cnt); + /* v_write() just reset our flag */ + screen->dabbrev_working = True; + free(copybuffer); + + free(lastexpansion); + + if ((lastexpansion = strdup(expansion)) != 0) { + result = 1; + expansions++; + } + } + } + + return result; } /*ARGSUSED*/ @@ -1780,10 +1814,10 @@ find_closest_color(Display * dpy, Colormap cmap, XColor * def) cmap_size = getColormapSize(dpy); if (cmap_size != 0) { - colortable = TypeMallocN(XColor, cmap_size); + colortable = TypeMallocN(XColor, (size_t) cmap_size); if (colortable != 0) { - tried = TypeCallocN(char, cmap_size); + tried = TypeCallocN(char, (size_t) cmap_size); if (tried != 0) { for (i = 0; i < cmap_size; i++) { @@ -2693,9 +2727,9 @@ parse_decdld(ANSI * params, char *string) ch = CharOf(*string++); if (ch >= ANSI_SPA && ch <= 0x2f) { if (len < 2) - DscsName[len++] = ch; + DscsName[len++] = (char) ch; } else if (ch >= 0x30 && ch <= 0x7e) { - DscsName[len++] = ch; + DscsName[len++] = (char) ch; break; } } @@ -2724,9 +2758,9 @@ parse_decdld(ANSI * params, char *string) if (ch >= 0x3f && ch <= 0x7e) { int n; - ch -= 0x3f; + ch = CharOf(ch - 0x3f); for (n = 0; n < 6; ++n) { - bits[row + n][col] = (ch & (1 << n)) ? '*' : '.'; + bits[row + n][col] = CharOf((ch & (1 << n)) ? '*' : '.'); } col += 1; prior = True; @@ -2759,8 +2793,9 @@ parse_ansi_params(ANSI * params, char **string) if (isdigit(ch)) { if (nparam < NPARAM) { - params->a_param[nparam] *= 10; - params->a_param[nparam] += (ch - '0'); + params->a_param[nparam] = + (ParmType) ((params->a_param[nparam] * 10) + + (ch - '0')); } } else if (ch == ';') { if (++nparam < NPARAM) @@ -2827,7 +2862,8 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) strcat(reply, ";7"); if (xw->flags & INVISIBLE) strcat(reply, ";8"); - if_OPT_EXT_COLORS(screen, { +#if OPT_256_COLORS || OPT_88_COLORS + if_OPT_ISO_COLORS(screen, { if (xw->flags & FG_COLOR) { if (xw->cur_foreground >= 16) sprintf(reply + strlen(reply), @@ -2853,7 +2889,8 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) xw->cur_background); } }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { +#elif OPT_ISO_COLORS + if_OPT_ISO_COLORS(screen, { if (xw->flags & FG_COLOR) sprintf(reply + strlen(reply), ";%d%d", @@ -2869,6 +2906,7 @@ do_dcs(XtermWidget xw, Char * dcsbuf, size_t dcslen) xw->cur_background - 8 : xw->cur_background); }); +#endif strcat(reply, "m"); } else okay = False; @@ -3007,7 +3045,7 @@ ChangeGroup(XtermWidget xw, String attribute, char *value) for (cp = c1; *cp != 0; ++cp) { Char *c2 = cp; if (!xtermIsPrintable(screen, &cp, c1 + limit)) { - memset(c2, '?', (unsigned) (cp + 1 - c2)); + memset(c2, '?', (size_t) (cp + 1 - c2)); } } @@ -3275,11 +3313,7 @@ SysReasonMsg(int code) { ERROR_XIOERROR, "xioerror: X I/O error" }, { ERROR_SCALLOC, "Alloc: calloc() failed on base" }, { ERROR_SCALLOC2, "Alloc: calloc() failed on rows" }, - { ERROR_SREALLOC, "ScreenResize: realloc() failed on alt base" }, - { ERROR_RESIZE, "ScreenResize: malloc() or realloc() failed" }, { ERROR_SAVE_PTR, "ScrnPointers: malloc/realloc() failed" }, - { ERROR_SBRALLOC, "ScrollBarOn: realloc() failed on base" }, - { ERROR_SBRALLOC2, "ScrollBarOn: realloc() failed on rows" }, { ERROR_MMALLOC, "my_memmove: malloc/realloc failed" }, }; /* *INDENT-ON* */ @@ -3554,7 +3588,7 @@ set_vt_visibility(Bool on) TRACE(("set_vt_visibility(%d)\n", on)); if (on) { if (!screen->Vshow && term) { - VTInit(); + VTInit(term); XtMapWidget(XtParent(term)); #if OPT_TOOLBAR /* we need both of these during initialization */ diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c index bd4c89a75..8d31e426d 100644 --- a/app/xterm/os2main.c +++ b/app/xterm/os2main.c @@ -1,4 +1,4 @@ -/* $XTermId: os2main.c,v 1.257 2009/01/24 16:24:36 tom Exp $ */ +/* $XTermId: os2main.c,v 1.258 2009/05/31 17:53:05 tom Exp $ */ /* removed all foreign stuff to get the code more clear (hv) * and did some rewrite for the obscure OS/2 environment @@ -1389,7 +1389,7 @@ main(int argc, char **argv ENVP_ARG) TekRun(); else #endif - VTRun(); + VTRun(term); } return 0; } @@ -1659,7 +1659,7 @@ spawnXTerm(XtermWidget xw) False); if (!TEK4014_ACTIVE(xw)) - VTInit(); /* realize now so know window size for tty driver */ + VTInit(xw); /* realize now so know window size for tty driver */ if (Console) { /* diff --git a/app/xterm/print.c b/app/xterm/print.c index 555b41a40..7ea1c8e1a 100644 --- a/app/xterm/print.c +++ b/app/xterm/print.c @@ -1,8 +1,4 @@ -/* $XTermId: print.c,v 1.81 2009/01/09 01:43:01 tom Exp $ */ - -/* - * $XFree86: xc/programs/xterm/print.c,v 1.24 2006/06/19 00:36:51 dickey Exp $ - */ +/* $XTermId: print.c,v 1.105 2009/08/07 00:25:10 tom Exp $ */ /************************************************************ @@ -61,22 +57,30 @@ authorization. #define VMS_TEMP_PRINT_FILE "sys$scratch:xterm_print.txt" #endif -static void charToPrinter(unsigned chr); -static void printLine(int row, unsigned chr); -static void send_CharSet(int row); -static void send_SGR(unsigned attr, unsigned fg, unsigned bg); -static void stringToPrinter(char *str); +static void charToPrinter(XtermWidget /* xw */ , + unsigned /* chr */ ); +static void printLine(XtermWidget /* xw */ , + int /* row */ , + unsigned /* chr */ ); +static void send_CharSet(XtermWidget /* xw */ , + LineData * /* ld */ ); +static void send_SGR(XtermWidget /* xw */ , + unsigned /* attr */ , + unsigned /* fg */ , + unsigned /* bg */ ); +static void stringToPrinter(XtermWidget /* xw */ , + char * /*str */ ); static FILE *Printer; static pid_t Printer_pid; static int initialized; static void -closePrinter(void) +closePrinter(XtermWidget xw GCC_UNUSED) { - if (xtermHasPrinter() != 0) { + if (xtermHasPrinter(xw) != 0) { #ifdef VMS - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); char pcommand[256]; (void) sprintf(pcommand, "%s %s;", @@ -103,12 +107,12 @@ closePrinter(void) } static void -printCursorLine(void) +printCursorLine(XtermWidget xw) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); TRACE(("printCursorLine\n")); - printLine(screen->cur_row, '\n'); + printLine(xw, screen->cur_row, '\n'); } #define NO_COLOR ((unsigned)-1) @@ -119,85 +123,71 @@ printCursorLine(void) * characters that xterm would allow as a selection (which may include blanks). */ static void -printLine(int row, unsigned chr) +printLine(XtermWidget xw, int row, unsigned chr) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); int inx = ROW2INX(screen, row); - Char *c = SCRN_BUF_CHARS(screen, inx); - Char *a = SCRN_BUF_ATTRS(screen, inx); + LineData *ld; Char attr = 0; unsigned ch; int last = MaxCols(screen); int col; #if OPT_ISO_COLORS && OPT_PRINT_COLORS -#if OPT_EXT_COLORS - Char *fbf = 0; - Char *fbb = 0; -#define ColorOf(col) (unsigned)((fbf[col] << 8) | fbb[col]) -#else - Char *fb = 0; -#define ColorOf(col) (fb[col]) -#endif + CellColor *fb = 0; +#define ColorOf(ld,col) (ld->color[col]) #endif unsigned fg = NO_COLOR, last_fg = NO_COLOR; unsigned bg = NO_COLOR, last_bg = NO_COLOR; int cs = CSET_IN; int last_cs = CSET_IN; + ld = getLineData(screen, inx); TRACE(("printLine(row=%d/%d, top=%d:%d, chr=%d):%s\n", row, ROW2INX(screen, row), screen->topline, screen->max_row, chr, - visibleChars(PAIRED_CHARS(c, - (screen->utf8_mode - ? SCRN_BUF_WIDEC(screen, inx) - : 0)), - (unsigned) last))); - - if_OPT_EXT_COLORS(screen, { - fbf = SCRN_BUF_FGRND(screen, inx); - fbb = SCRN_BUF_BGRND(screen, inx); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - fb = SCRN_BUF_COLOR(screen, inx); + visibleIChars(ld->charData, (unsigned) last))); + + if_OPT_ISO_COLORS(screen, { + fb = ld->color; }); while (last > 0) { - if ((a[last - 1] & CHARDRAWN) == 0) + if ((ld->attribs[last - 1] & CHARDRAWN) == 0) last--; else break; } if (last) { if (screen->print_attributes) { - send_CharSet(row); - send_SGR(0, NO_COLOR, NO_COLOR); + send_CharSet(xw, ld); + send_SGR(xw, 0, NO_COLOR, NO_COLOR); } for (col = 0; col < last; col++) { - ch = c[col]; + ch = ld->charData[col]; if_OPT_WIDE_CHARS(screen, { ch = XTERM_CELL(row, col); }); #if OPT_PRINT_COLORS if (screen->colorMode) { if (screen->print_attributes > 1) { - fg = (a[col] & FG_COLOR) - ? extract_fg(term, ColorOf(col), a[col]) + fg = (ld->attribs[col] & FG_COLOR) + ? extract_fg(xw, ColorOf(ld, col), ld->attribs[col]) : NO_COLOR; - bg = (a[col] & BG_COLOR) - ? extract_bg(term, ColorOf(col), a[col]) + bg = (ld->attribs[col] & BG_COLOR) + ? extract_bg(xw, ColorOf(ld, col), ld->attribs[col]) : NO_COLOR; } } #endif - if ((((a[col] & SGR_MASK) != attr) + if ((((ld->attribs[col] & SGR_MASK) != attr) #if OPT_PRINT_COLORS || (last_fg != fg) || (last_bg != bg) #endif ) && ch) { - attr = CharOf(a[col] & SGR_MASK); + attr = CharOf(ld->attribs[col] & SGR_MASK); last_fg = fg; last_bg = bg; if (screen->print_attributes) - send_SGR(attr, fg, bg); + send_SGR(xw, attr, fg, bg); } if (ch == 0) @@ -211,7 +201,8 @@ printLine(int row, unsigned chr) cs = (ch >= ' ' && ch != ANSI_DEL) ? CSET_IN : CSET_OUT; if (last_cs != cs) { if (screen->print_attributes) { - charToPrinter((unsigned) ((cs == CSET_OUT) + charToPrinter(xw, + (unsigned) ((cs == CSET_OUT) ? SHIFT_OUT : SHIFT_IN)); } @@ -223,34 +214,38 @@ printLine(int row, unsigned chr) * corresponding charset information is not encoded * into the CSETS array. */ - charToPrinter(((cs == CSET_OUT) + charToPrinter(xw, + ((cs == CSET_OUT) ? (ch == ANSI_DEL ? 0x5f : (ch + 0x5f)) : ch)); if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - if ((ch = XTERM_CELLC(row, col, off)) == 0) + size_t off; + for_each_combData(off, ld) { + ch = XTERM_CELLC(row, col, off); + if (ch == 0) break; - charToPrinter(ch); + charToPrinter(xw, ch); } }); } if (screen->print_attributes) { - send_SGR(0, NO_COLOR, NO_COLOR); + send_SGR(xw, 0, NO_COLOR, NO_COLOR); if (cs != CSET_IN) - charToPrinter(SHIFT_IN); + charToPrinter(xw, SHIFT_IN); } } if (screen->print_attributes) - charToPrinter('\r'); - charToPrinter(chr); + charToPrinter(xw, '\r'); + charToPrinter(xw, chr); + + return; } void -xtermPrintScreen(Bool use_DECPEX) +xtermPrintScreen(XtermWidget xw, Bool use_DECPEX) { - if (XtIsRealized((Widget) term)) { - TScreen *screen = TScreenOf(term); + if (XtIsRealized((Widget) xw)) { + TScreen *screen = TScreenOf(xw); Bool extent = (use_DECPEX && screen->printer_extent); int top = extent ? 0 : screen->top_marg; int bot = extent ? screen->max_row : screen->bot_marg; @@ -259,12 +254,12 @@ xtermPrintScreen(Bool use_DECPEX) TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot)); while (top <= bot) - printLine(top++, '\n'); + printLine(xw, top++, '\n'); if (screen->printer_formfeed) - charToPrinter('\f'); + charToPrinter(xw, '\f'); if (!was_open || screen->printer_autoclose) { - closePrinter(); + closePrinter(xw); } } else { Bell(XkbBI_MinorError, 0); @@ -276,36 +271,35 @@ xtermPrintScreen(Bool use_DECPEX) * the normal screen plus all scrolled-back lines. The distinction is made * because the normal screen's buffer is part of the overall scrollback buffer. */ -static void -xtermPrintEverything(void) +void +xtermPrintEverything(XtermWidget xw) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); int top = 0; int bot = screen->max_row; int was_open = initialized; - if (!screen->altbuf) + if (!screen->whichBuf) top = -screen->savedlines; TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot)); while (top <= bot) - printLine(top++, '\n'); + printLine(xw, top++, '\n'); if (screen->printer_formfeed) - charToPrinter('\f'); + charToPrinter(xw, '\f'); if (!was_open || screen->printer_autoclose) { - closePrinter(); + closePrinter(xw); } } static void -send_CharSet(int row) +send_CharSet(XtermWidget xw, LineData * ld) { #if OPT_DEC_CHRSET - TScreen *screen = TScreenOf(term); char *msg = 0; - switch (SCRN_BUF_CSETS(screen, row)[0]) { + switch (GetLineDblCS(ld)) { case CSET_SWL: msg = "\033#5"; break; @@ -320,14 +314,15 @@ send_CharSet(int row) break; } if (msg != 0) - stringToPrinter(msg); + stringToPrinter(xw, msg); #else - (void) row; + (void) xw; + (void) ld; #endif /* OPT_DEC_CHRSET */ } static void -send_SGR(unsigned attr, unsigned fg, unsigned bg) +send_SGR(XtermWidget xw, unsigned attr, unsigned fg, unsigned bg) { char msg[80]; strcpy(msg, "\033[0"); @@ -345,7 +340,7 @@ send_SGR(unsigned attr, unsigned fg, unsigned bg) } if (fg != NO_COLOR) { #if OPT_PC_COLORS - if (term->screen.boldColors + if (xw->screen.boldColors && fg > 8 && (attr & BOLD) != 0) fg -= 8; @@ -357,18 +352,18 @@ send_SGR(unsigned attr, unsigned fg, unsigned bg) (void) fg; #endif strcat(msg, "m"); - stringToPrinter(msg); + stringToPrinter(xw, msg); } /* * This implementation only knows how to write to a pipe. */ static void -charToPrinter(unsigned chr) +charToPrinter(XtermWidget xw, unsigned chr) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); - if (!initialized && xtermHasPrinter()) { + if (!initialized && xtermHasPrinter(xw)) { #if defined(VMS) /* * This implementation only knows how to write to a file. When the @@ -440,10 +435,10 @@ charToPrinter(unsigned chr) } static void -stringToPrinter(char *str) +stringToPrinter(XtermWidget xw, char *str) { while (*str) - charToPrinter(CharOf(*str++)); + charToPrinter(xw, CharOf(*str++)); } /* @@ -453,39 +448,39 @@ stringToPrinter(char *str) * Corp., March 1987). */ void -xtermMediaControl(int param, int private_seq) +xtermMediaControl(XtermWidget xw, int param, int private_seq) { TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq)); if (private_seq) { switch (param) { case 1: - printCursorLine(); + printCursorLine(xw); break; case 4: - setPrinterControlMode(0); + setPrinterControlMode(xw, 0); break; case 5: - setPrinterControlMode(1); + setPrinterControlMode(xw, 1); break; case 10: /* VT320 */ - xtermPrintScreen(False); + xtermPrintScreen(xw, False); break; case 11: /* VT320 */ - xtermPrintEverything(); + xtermPrintEverything(xw); break; } } else { switch (param) { case -1: case 0: - xtermPrintScreen(True); + xtermPrintScreen(xw, True); break; case 4: - setPrinterControlMode(0); + setPrinterControlMode(xw, 0); break; case 5: - setPrinterControlMode(2); + setPrinterControlMode(xw, 2); break; } } @@ -498,13 +493,13 @@ xtermMediaControl(int param, int private_seq) * or VT) that moved the cursor off the previous line. */ void -xtermAutoPrint(unsigned chr) +xtermAutoPrint(XtermWidget xw, unsigned chr) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); if (screen->printer_controlmode == 1) { TRACE(("AutoPrint %d\n", chr)); - printLine(screen->cursorp.row, chr); + printLine(xw, screen->cursorp.row, chr); if (Printer != 0) fflush(Printer); } @@ -523,9 +518,9 @@ xtermAutoPrint(unsigned chr) #define LB '[' int -xtermPrinterControl(int chr) +xtermPrinterControl(XtermWidget xw, int chr) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); /* *INDENT-OFF* */ static struct { Char seq[5]; @@ -562,10 +557,10 @@ xtermPrinterControl(int chr) if (length == len && Strcmp(bfr, tbl[n].seq) == 0) { - setPrinterControlMode(tbl[n].active); + setPrinterControlMode(xw, tbl[n].active); if (screen->printer_autoclose && screen->printer_controlmode == 0) - closePrinter(); + closePrinter(xw); length = 0; return 0; } else if (len > length @@ -579,7 +574,7 @@ xtermPrinterControl(int chr) default: for (n = 0; n < length; n++) - charToPrinter(bfr[n]); + charToPrinter(xw, bfr[n]); bfr[0] = CharOf(chr); length = 1; return 0; @@ -590,9 +585,9 @@ xtermPrinterControl(int chr) * If there is no printer command, we will ignore printer controls. */ Bool -xtermHasPrinter(void) +xtermHasPrinter(XtermWidget xw) { - TScreen *screen = TScreenOf(term); + TScreen *screen = TScreenOf(xw); return (strlen(screen->printer_command) != 0); } @@ -605,18 +600,18 @@ xtermHasPrinter(void) : "printer controller")) void -setPrinterControlMode(int mode) +setPrinterControlMode(XtermWidget xw, int mode) { - if (xtermHasPrinter() - && term->screen.printer_controlmode != mode) { + if (xtermHasPrinter(xw) + && xw->screen.printer_controlmode != mode) { TRACE(("%s %s mode\n", (mode ? "set" : "reset"), (mode ? showPrinterControlMode(mode) - : showPrinterControlMode(term->screen.printer_controlmode)))); - term->screen.printer_controlmode = mode; + : showPrinterControlMode(xw->screen.printer_controlmode)))); + xw->screen.printer_controlmode = mode; update_print_redir(); } } diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c index cc6eb6a6e..194419ca2 100644 --- a/app/xterm/ptydata.c +++ b/app/xterm/ptydata.c @@ -1,8 +1,4 @@ -/* $XTermId: ptydata.c,v 1.81 2009/01/26 00:22:33 tom Exp $ */ - -/* - * $XFree86: xc/programs/xterm/ptydata.c,v 1.25 2006/02/13 01:14:59 dickey Exp $ - */ +/* $XTermId: ptydata.c,v 1.90 2009/08/09 17:22:05 tom Exp $ */ /************************************************************ @@ -68,7 +64,7 @@ decodeUtf8(PtyData * data) int i; int length = data->last - data->next; int utf_count = 0; - IChar utf_char = 0; + unsigned utf_char = 0; data->utf_size = 0; for (i = 0; i < length; i++) { @@ -81,7 +77,7 @@ decodeUtf8(PtyData * data) data->utf_data = UCS_REPL; /* prev. sequence incomplete */ data->utf_size = (i + 1); } else { - data->utf_data = c; + data->utf_data = (IChar) c; data->utf_size = 1; } break; @@ -120,12 +116,14 @@ decodeUtf8(PtyData * data) } utf_count--; if (utf_count == 0) { +#if !OPT_WIDER_ICHAR /* characters outside UCS-2 become UCS_REPL */ if (utf_char > 0xffff) { TRACE(("using replacement for %#x\n", utf_char)); utf_char = UCS_REPL; } - data->utf_data = utf_char; +#endif + data->utf_data = (IChar) utf_char; data->utf_size = (i + 1); break; } @@ -191,32 +189,40 @@ readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data) } #else /* !VMS */ if (FD_ISSET(screen->respond, select_mask)) { + int save_err; trimPtyData(screen, data); size = read(screen->respond, (char *) data->last, (unsigned) FRG_SIZE); - if (size <= 0) { - /* - * Yes, I know this is a majorly f*ugly hack, however it seems to - * be necessary for Solaris x86. DWH 11/15/94 - * Dunno why though.. - * (and now CYGWIN, alanh@xfree86.org 08/15/01 - */ + save_err = errno; #if (defined(i386) && defined(SVR4) && defined(sun)) || defined(__CYGWIN__) - if (errno == EIO || errno == 0) -#else - if (errno == EIO) -#endif + /* + * Yes, I know this is a majorly f*ugly hack, however it seems to + * be necessary for Solaris x86. DWH 11/15/94 + * Dunno why though.. + * (and now CYGWIN, alanh@xfree86.org 08/15/01 + */ + if (size <= 0) { + if (save_err == EIO || save_err == 0) + Cleanup(0); + else if (!E_TEST(save_err)) + Panic("input: read returned unexpected error (%d)\n", save_err); + size = 0; + } +#else /* !f*ugly */ + if (size < 0) { + if (save_err == EIO) Cleanup(0); - else if (!E_TEST(errno)) - Panic("input: read returned unexpected error (%d)\n", errno); + else if (!E_TEST(save_err)) + Panic("input: read returned unexpected error (%d)\n", save_err); size = 0; } else if (size == 0) { -#if defined(__UNIXOS2__) +#if defined(__UNIXOS2__) || defined(__FreeBSD__) Cleanup(0); #else Panic("input: read returned zero\n", 0); #endif } +#endif /* f*ugly */ } #endif /* VMS */ @@ -242,25 +248,6 @@ readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data) } /* - * Check if there is more data in the input buffer which can be returned by - * nextPtyData(). If there is insufficient data to return a completed UTF-8 - * value, return false anyway. - */ -#if OPT_WIDE_CHARS -Bool -morePtyData(TScreen * screen, PtyData * data) -{ - Bool result = (data->last > data->next); - if (result && screen->utf8_inparse) { - if (!data->utf_size) - result = decodeUtf8(data); - } - TRACE2(("morePtyData returns %d\n", result)); - return result; -} -#endif - -/* * Return the next value from the input buffer. Note that morePtyData() is * always called before this function, so we can do the UTF-8 input conversion * in that function and simply return the result here. @@ -274,8 +261,9 @@ nextPtyData(TScreen * screen, PtyData * data) result = skipPtyData(data); } else { result = *((data)->next++); - if (!screen->output_eight_bits) - result &= 0x7f; + if (!screen->output_eight_bits) { + result = (IChar) (result & 0x7f); + } } TRACE2(("nextPtyData returns %#x\n", result)); return result; @@ -447,7 +435,7 @@ writePtyData(int f, IChar * d, unsigned len) VTbuffer->write_buf[n] = (Char) d[n]; TRACE(("writePtyData %d:%s\n", n, - visibleChars(PAIRED_CHARS(VTbuffer->write_buf, 0), n))); + visibleChars(VTbuffer->write_buf, n))); v_write(f, VTbuffer->write_buf, n); } #endif /* OPT_WIDE_CHARS */ diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h index 22461b3fc..9ac8265f5 100644 --- a/app/xterm/ptyx.h +++ b/app/xterm/ptyx.h @@ -1,4 +1,4 @@ -/* $XTermId: ptyx.h,v 1.546 2009/03/24 22:20:06 tom Exp $ */ +/* $XTermId: ptyx.h,v 1.625 2009/08/14 23:14:26 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -84,7 +84,7 @@ /* adapted from vile (vi-like-emacs) */ #define TypeCallocN(type,n) (type *)calloc((n), sizeof(type)) -#define TypeCalloc(type) TypeCalloc(type,1) +#define TypeCalloc(type) TypeCallocN(type,1) #define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (n)) #define TypeMalloc(type) TypeMallocN(type,1) @@ -95,6 +95,29 @@ #define CastMallocN(type,n) (type *)malloc(sizeof(type) + (n)) #define CastMalloc(type) CastMallocN(type,0) +#define BumpBuffer(type, buffer, size, want) \ + if (want >= size) { \ + size = 1 + (want * 2); \ + buffer = TypeRealloc(type, size, buffer); \ + } + +#define BfBuf(type) screen->bf_buf_##type +#define BfLen(type) screen->bf_len_##type + +#define TypedBuffer(type) \ + type *bf_buf_##type; \ + Cardinal bf_len_##type + +#define BumpTypedBuffer(type, want) \ + BumpBuffer(type, BfBuf(type), BfLen(type), want) + +#define FreeTypedBuffer(type) \ + if (BfBuf(type) != 0) { \ + free(BfBuf(type)); \ + BfBuf(type) = 0; \ + } \ + BfLen(type) = 0 + /* ** System V definitions */ @@ -481,6 +504,10 @@ typedef struct { #define OPT_EXTRA_PASTE 1 #endif +#ifndef OPT_FIFO_LINES +#define OPT_FIFO_LINES 0 /* optimize save-lines feature using FIFO */ +#endif + #ifndef OPT_FOCUS_EVENT #define OPT_FOCUS_EVENT 1 /* focus in/out events */ #endif @@ -589,6 +616,10 @@ typedef struct { #define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ #endif +#ifndef OPT_SAVE_LINES +#define OPT_SAVE_LINES OPT_FIFO_LINES /* optimize save-lines feature */ +#endif + #ifndef OPT_SCO_FUNC_KEYS #define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ #endif @@ -649,6 +680,10 @@ typedef struct { #define OPT_WIDE_CHARS 0 /* true if xterm supports 16-bit characters */ #endif +#ifndef OPT_WIDER_ICHAR +#define OPT_WIDER_ICHAR 1 /* true if xterm uses 32-bits for wide-chars */ +#endif + #ifndef OPT_XMC_GLITCH #define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ #endif @@ -809,7 +844,6 @@ typedef enum { /***====================================================================***/ #if OPT_ISO_COLORS -#define if_OPT_ISO_COLORS(screen, code) if(screen->colorMode) code #define TERM_COLOR_FLAGS(xw) ((xw)->flags & (FG_COLOR|BG_COLOR)) #define COLOR_0 0 #define COLOR_1 1 @@ -866,7 +900,6 @@ typedef enum { #else /* !OPT_ISO_COLORS */ -#define if_OPT_ISO_COLORS(screen, code) /* nothing */ #define TERM_COLOR_FLAGS(xw) 0 #define ReverseOrHilite(screen,flags,hilite) \ @@ -881,15 +914,10 @@ typedef enum { #define if_OPT_AIX_COLORS(screen, code) /* nothing */ #endif -#if OPT_256_COLORS || OPT_88_COLORS -# define if_OPT_EXT_COLORS(screen, code) if(screen->colorMode) code -# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) /* nothing */ -#elif OPT_ISO_COLORS -# define if_OPT_EXT_COLORS(screen, code) /* nothing */ -# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) if(screen->colorMode) code +#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS +# define if_OPT_ISO_COLORS(screen, code) if (screen->colorMode) code #else -# define if_OPT_EXT_COLORS(screen, code) /* nothing */ -# define if_OPT_ISO_TRADITIONAL_COLORS(screen, code) /*nothing*/ +# define if_OPT_ISO_COLORS(screen, code) /* nothing */ #endif #define COLOR_RES_NAME(root) "color" root @@ -922,46 +950,51 @@ typedef enum { #define CSET_DHL_BOT 2 #define CSET_DWL 3 #define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ + /* Use remaining bits for encoding the other character-sets */ #define CSET_NORMAL(code) ((code) == CSET_SWL) #define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) #define CSET_EXTEND(code) ((code) > CSET_DWL) - /* for doublesize characters, the first cell in a row holds the info */ -#define SCRN_ROW_CSET(screen,row) (SCRN_BUF_CSETS((screen), row)[0]) -#define CurMaxCol(screen, row) \ - (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ - ? (screen->max_col / 2) \ - : (screen->max_col)) -#define CurCursorX(screen, row, col) \ - (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ - ? CursorX(screen, 2*(col)) \ - : CursorX(screen, (col))) -#define CurFontWidth(screen, row) \ - (CSET_DOUBLE(SCRN_ROW_CSET(screen, row)) \ - ? 2*FontWidth(screen) \ - : FontWidth(screen)) + +#define DBLCS_BITS 4 +#define DBLCS_MASK BITS2MASK(DBLCS_BITS) + +#define GetLineDblCS(ld) (((ld)->bufHead >> LINEFLAG_BITS) & DBLCS_MASK) +#define SetLineDblCS(ld,cs) (ld)->bufHead = (RowData) ((ld->bufHead & LINEFLAG_MASK) | (cs << LINEFLAG_BITS)) + +#define LineCharSet(screen, ld) \ + ((CSET_DOUBLE(GetLineDblCS(ld))) \ + ? GetLineDblCS(ld) \ + : (screen)->cur_chrset) +#define LineMaxCol(screen, ld) \ + (CSET_DOUBLE(GetLineDblCS(ld)) \ + ? (screen->max_col / 2) \ + : (screen->max_col)) +#define LineCursorX(screen, ld, col) \ + (CSET_DOUBLE(GetLineDblCS(ld)) \ + ? CursorX(screen, 2*(col)) \ + : CursorX(screen, (col))) +#define LineFontWidth(screen, ld) \ + (CSET_DOUBLE(GetLineDblCS(ld)) \ + ? 2*FontWidth(screen) \ + : FontWidth(screen)) #else + #define if_OPT_DEC_CHRSET(code) /*nothing*/ -#define CurMaxCol(screen, row) screen->max_col -#define CurCursorX(screen, row, col) CursorX(screen, col) -#define CurFontWidth(screen, row) FontWidth(screen) + +#define GetLineDblCS(ld) 0 + +#define LineCharSet(screen, ld) 0 +#define LineMaxCol(screen, ld) screen->max_col +#define LineCursorX(screen, ld, col) CursorX(screen, col) +#define LineFontWidth(screen, ld) FontWidth(screen) + #endif #if OPT_LUIT_PROG && !OPT_WIDE_CHARS #error Luit requires the wide-chars configuration #endif - /* the number of pointers per row in 'ScrnBuf' */ -#if OPT_WIDE_CHARS -#define MAX_PTRS term->num_ptrs -#else -#define MAX_PTRS (OFF_FINAL) -#endif - -#define BUF_HEAD 1 - /* the number that point to Char data */ -#define BUF_PTRS (MAX_PTRS - BUF_HEAD) - /***====================================================================***/ #if OPT_EBCDIC @@ -1019,21 +1052,17 @@ extern int A2E(int); #define LO_BYTE(ch) CharOf((ch) & 0xff) #define HI_BYTE(ch) CharOf((ch) >> 8) -#define PACK_FGBG(screen, row, col) \ - (unsigned) ((SCRN_BUF_FGRND(screen, row)[col] << 8) \ - | (SCRN_BUF_BGRND(screen, row)[col])) - #if OPT_WIDE_CHARS #define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code #define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow -#define PAIRED_CHARS(lo,hi) lo,hi -#define PACK_PAIR(lo,hi,n) (lo[n] | (hi ? (hi[n] << 8) : 0)) -typedef unsigned IChar; /* for 8 or 16-bit characters, plus flag */ +#if OPT_WIDER_ICHAR +typedef unsigned IChar; /* for 8-21 bit characters */ +#else +typedef unsigned short IChar; /* for 8-16 bit characters */ +#endif #else #define if_OPT_WIDE_CHARS(screen, code) /* nothing */ #define if_WIDE_OR_NARROW(screen, wide, narrow) narrow -#define PAIRED_CHARS(lo,hi) lo -#define PACK_PAIR(lo,hi,n) lo[n] typedef unsigned char IChar; /* for 8-bit characters */ #endif @@ -1097,28 +1126,80 @@ typedef struct { /***====================================================================***/ -/* The order of ifdef's matches the logic for num_ptrs in VTInitialize */ -typedef enum { - OFF_FLAGS = 0 /* BUF_HEAD */ - , OFF_ATTRS /* video attributes */ #if OPT_ISO_COLORS #if OPT_256_COLORS || OPT_88_COLORS - , OFF_FGRND /* foreground color number */ - , OFF_BGRND /* background color number */ +#define COLOR_BITS 8 +typedef unsigned short CellColor; #else - , OFF_COLOR /* foreground+background color numbers */ +#define COLOR_BITS 4 +typedef Char CellColor; #endif +#else +typedef int CellColor; #endif + +#define BITS2MASK(b) ((1 << b) - 1) + +#define COLOR_MASK BITS2MASK(COLOR_BITS) + +#define GetCellColorFG(src) ((src) & COLOR_MASK) +#define GetCellColorBG(src) (((src) >> COLOR_BITS) & COLOR_MASK) + +typedef Char RowData; /* wrap/blink, and DEC single-double chars */ + +#define LINEFLAG_BITS 4 +#define LINEFLAG_MASK BITS2MASK(LINEFLAG_BITS) + +#define GetLineFlags(ld) ((ld)->bufHead & LINEFLAG_MASK) + #if OPT_DEC_CHRSET - , OFF_CSETS /* DEC character-set */ +#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) ((ld->bufHead & (DBLCS_MASK << LINEFLAG_BITS)) | (xx & LINEFLAG_MASK)) +#else +#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) (xx & LINEFLAG_MASK) +#endif + +typedef IChar CharData; + +/* + * This is the xterm line-data/scrollback structure. + */ +typedef struct { + Dimension lineSize; /* number of columns in this row */ + RowData bufHead; /* flag for wrapped lines */ +#if OPT_WIDE_CHARS + Char combSize; /* number of items in combData[] */ #endif - /* wide (16-bit) characters begin here */ - , OFF_CHARS /* first (or only) byte of cell's character */ + Char *attribs; /* video attributes */ +#if OPT_ISO_COLORS + CellColor *color; /* foreground+background color numbers */ +#endif + CharData *charData; /* cell's base character */ + CharData *combData[1]; /* first enum past fixed-offsets */ +} LineData; + +/* + * We use CellData in a few places, when copying a cell's data to a temporary + * variable. + */ +typedef struct { + Char attribs; #if OPT_WIDE_CHARS - , OFF_WIDEC /* second byte of first wide-character */ + Char combSize; /* number of items in combData[] */ +#endif +#if OPT_ISO_COLORS + CellColor color; /* color-array */ #endif - , OFF_FINAL /* first enum past fixed-offsets */ -} BufOffsets; + CharData charData; /* cell's base character */ + CharData combData[1]; /* array of combining chars */ +} CellData; + +#define for_each_combData(off, ld) for (off = 0; off < ld->combSize; ++off) + +/* + * Accommodate older compilers by not using variable-length arrays. + */ +#define SizeOfLineData offsetof(LineData, combData) +#define SizeOfCellData offsetof(CellData, combData) /* * A "row" is the index within the visible part of the screen, and an @@ -1134,37 +1215,32 @@ typedef enum { ((row) <= (screen)->max_row \ && (row) >= -((screen)->savedlines)) - /* ScrnBuf-level macros */ -#define BUFFER_PTR(buf, row, off) (buf[MAX_PTRS * (row) + off]) - -#define BUF_FLAGS(buf, row) BUFFER_PTR(buf, row, OFF_FLAGS) -#define BUF_CHARS(buf, row) BUFFER_PTR(buf, row, OFF_CHARS) -#define BUF_ATTRS(buf, row) BUFFER_PTR(buf, row, OFF_ATTRS) -#define BUF_COLOR(buf, row) BUFFER_PTR(buf, row, OFF_COLOR) -#define BUF_FGRND(buf, row) BUFFER_PTR(buf, row, OFF_FGRND) -#define BUF_BGRND(buf, row) BUFFER_PTR(buf, row, OFF_BGRND) -#define BUF_CSETS(buf, row) BUFFER_PTR(buf, row, OFF_CSETS) -#define BUF_WIDEC(buf, row) BUFFER_PTR(buf, row, OFF_WIDEC) - - /* TScreen-level macros */ -#define SCREEN_PTR(screen, row, off) BUFFER_PTR(screen->visbuf, row, off) - -#define SCRN_BUF_FLAGS(screen, row) SCREEN_PTR(screen, row, OFF_FLAGS) -#define SCRN_BUF_CHARS(screen, row) SCREEN_PTR(screen, row, OFF_CHARS) -#define SCRN_BUF_ATTRS(screen, row) SCREEN_PTR(screen, row, OFF_ATTRS) -#define SCRN_BUF_COLOR(screen, row) SCREEN_PTR(screen, row, OFF_COLOR) -#define SCRN_BUF_FGRND(screen, row) SCREEN_PTR(screen, row, OFF_FGRND) -#define SCRN_BUF_BGRND(screen, row) SCREEN_PTR(screen, row, OFF_BGRND) -#define SCRN_BUF_CSETS(screen, row) SCREEN_PTR(screen, row, OFF_CSETS) -#define SCRN_BUF_WIDEC(screen, row) SCREEN_PTR(screen, row, OFF_WIDEC) + /* + * Cache data for "proportional" and other fonts containing a mixture + * of widths. + */ +typedef struct { + Bool mixed; + Dimension min_width; /* nominal cell width for 0..255 */ + Dimension max_width; /* maximum cell width */ +} FontMap; typedef struct { unsigned chrset; unsigned flags; XFontStruct * fs; char * fn; + FontMap map; + Char known_missing[256]; } XTermFonts; +#if OPT_RENDERFONT +typedef struct { + XftFont * font; + FontMap map; +} XTermXftFonts; +#endif + typedef struct { int top; int left; @@ -1220,7 +1296,9 @@ typedef enum { mainMenu, vtMenu, fontMenu, +#if OPT_TEK4014 tekMenu +#endif } MenuIndex; #define NUM_POPUP_MENUS 4 @@ -1363,8 +1441,8 @@ typedef struct { IChar utf_char; /* in-progress character */ int last_written_col; int last_written_row; - XChar2b *draw_buf; /* drawXtermText() data */ - Cardinal draw_len; /* " " " */ + TypedBuffer(XChar2b); + TypedBuffer(char); #endif #if OPT_BROKEN_OSC Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ @@ -1514,28 +1592,32 @@ typedef struct { * the saved lines, taking scrolling into account. */ int topline; /* line number of top, <= 0 */ + long saved_fifo; /* number of lines that've been saved */ int savedlines; /* number of lines that've been saved */ int savelines; /* number of lines off top to save */ int scroll_amt; /* amount to scroll */ int refresh_amt; /* amount to refresh */ /* - * Pointer to the current visible buffer, e.g., allbuf or altbuf. + * Working variables for getLineData(). + */ + size_t lineExtra; /* extra space for combining chars */ + /* + * Pointer to the current visible buffer. */ ScrnBuf visbuf; /* ptr to visible screen buf (main) */ /* * Data for the normal buffer, which may have saved lines to which * the user can scroll. */ - ScrnBuf allbuf; /* screen buffer (may include - lines scrolled off top) */ - Char *sbuf_address; /* main screen memory address */ - Boolean is_running; /* true when buffers are legal */ + ScrnBuf saveBuf_index; + Char *saveBuf_data; /* - * Data for the alternate buffer. + * Data for visible and alternate buffer. */ - ScrnBuf altbuf; /* alternate screen buffer */ - Char *abuf_address; /* alternate screen memory address */ - Boolean alternate; /* true if using alternate buf */ + ScrnBuf editBuf_index[2]; + Char *editBuf_data[2]; + int whichBuf; /* 0/1 for normal/alternate buf */ + Boolean is_running; /* true when buffers are legal */ /* * Workspace used for screen operations. */ @@ -1588,6 +1670,7 @@ typedef struct { Boolean bold_mode; /* use bold font or overstrike */ Boolean delete_is_del; /* true for compatible Delete key */ Boolean jumpscroll; /* whether we should jumpscroll */ + Boolean fastscroll; /* whether we should fastscroll */ Boolean old_fkeys; /* true for compatible fkeys */ Boolean underline; /* whether to underline text */ @@ -1708,12 +1791,17 @@ typedef struct { void * icon_cgs_cache; #endif #if OPT_RENDERFONT - XftFont * renderFontNorm[NMENUFONTS]; - XftFont * renderFontBold[NMENUFONTS]; - XftFont * renderFontItal[NMENUFONTS]; - XftFont * renderWideNorm[NMENUFONTS]; - XftFont * renderWideBold[NMENUFONTS]; - XftFont * renderWideItal[NMENUFONTS]; + XTermXftFonts renderFontNorm[NMENUFONTS]; + XTermXftFonts renderFontBold[NMENUFONTS]; + XTermXftFonts renderFontItal[NMENUFONTS]; +#if OPT_RENDERWIDE + XTermXftFonts renderWideNorm[NMENUFONTS]; + XTermXftFonts renderWideBold[NMENUFONTS]; + XTermXftFonts renderWideItal[NMENUFONTS]; + TypedBuffer(XftCharSpec); +#else + TypedBuffer(XftChar8); +#endif XftDraw * renderDraw; #endif #if OPT_INPUT_METHOD @@ -1723,7 +1811,7 @@ typedef struct { #endif XIC xic; /* this is used even without XIM */ #if OPT_DABBREV - int dabbrev_working; /* nonzero during dabbrev process */ + Boolean dabbrev_working; /* nonzero during dabbrev process */ unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ #endif char tcapbuf[TERMCAP_SIZE]; @@ -1885,6 +1973,9 @@ typedef struct { #endif } VTFontNames; +#define GravityIsNorthWest(w) ((w)->misc.resizeGravity == NorthWestGravity) +#define GravityIsSouthWest(w) ((w)->misc.resizeGravity == SouthWestGravity) + typedef struct _Misc { VTFontNames default_font; char *geo_metry; @@ -1901,9 +1992,6 @@ typedef struct _Misc { char *locale_str; /* "locale" resource */ char *localefilter; /* path for luit */ #endif -#if OPT_INPUT_METHOD - char *f_x; /* font for XIM */ -#endif fontWarningTypes fontWarnings; int limit_resize; #ifdef ALLOWLOGGING @@ -1932,10 +2020,12 @@ typedef struct _Misc { Boolean appcursorDefault; Boolean appkeypadDefault; #if OPT_INPUT_METHOD + char* f_x; /* font for XIM */ char* input_method; char* preedit_type; - Boolean open_im; + Boolean open_im; /* true if input-method is opened */ Boolean cannot_im; /* true if we cannot use input-method */ + int retry_im; #endif Boolean dynamicColors; Boolean shared_ic; @@ -2025,9 +2115,6 @@ typedef struct _XtermWidgetRec { int sgr_background; /* current SGR background color */ Boolean sgr_extended; /* SGR set with extended codes? */ #endif -#if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS - int num_ptrs; /* number of pointers per row in 'ScrnBuf' */ -#endif unsigned initflags; /* initial mode flags */ Tabs tabs; /* tabstops of the terminal */ Misc misc; /* miscellaneous parameters */ @@ -2117,12 +2204,14 @@ typedef struct _TekWidgetRec { /* * Per-line flags */ -#define LINEWRAPPED 0x01 /* used once per line to indicate that it wraps - * onto the next line so we can tell the - * difference between lines that have wrapped - * around and lines that have ended naturally - * with a CR at column max_col. - */ +#define LINEWRAPPED AttrBIT(0) +/* used once per line to indicate that it wraps onto the next line so we can + * tell the difference between lines that have wrapped around and lines that + * have ended naturally with a CR at column max_col. + */ +#define LINEBLINKED AttrBIT(1) +/* set when the line contains blinking text. + */ #if OPT_ZICONBEEP || OPT_TOOLBAR #define HANDLE_STRUCT_NOTIFY 1 diff --git a/app/xterm/resize.c b/app/xterm/resize.c index 7fb91804e..393195f71 100644 --- a/app/xterm/resize.c +++ b/app/xterm/resize.c @@ -1,7 +1,7 @@ -/* $XTermId: resize.c,v 1.107 2008/12/30 17:07:56 tom Exp $ */ +/* $XTermId: resize.c,v 1.108 2009/05/31 14:00:16 tom Exp $ */ /* - * Copyright 2003-2007,2008 by Thomas E. Dickey + * Copyright 2003-2008,2009 by Thomas E. Dickey * * All Rights Reserved * @@ -92,10 +92,6 @@ extern struct passwd *getpwuid(); /* does ANYBODY need this? */ #endif /* SYSV && i386 */ #endif /* X_NOT_POSIX */ -#ifndef bzero -#define bzero(s, n) memset(s, 0, n) -#endif - #ifdef __MVS__ #define ESCAPE(string) "\047" string #else @@ -523,7 +519,7 @@ readstring(FILE *fp, char *buf, char *str) #if defined(USG) || defined(__UNIXOS2__) alarm(TIMEOUT); #else - bzero((char *) &it, sizeof(struct itimerval)); + memset((char *) &it, 0, sizeof(struct itimerval)); it.it_value.tv_sec = TIMEOUT; setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); #endif @@ -545,7 +541,7 @@ readstring(FILE *fp, char *buf, char *str) #if defined(USG) || defined(__UNIXOS2__) alarm(0); #else - bzero((char *) &it, sizeof(struct itimerval)); + memset((char *) &it, 0, sizeof(struct itimerval)); setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); #endif *buf = 0; diff --git a/app/xterm/resize.man b/app/xterm/resize.man index 7929ccc16..56d95d12d 100644 --- a/app/xterm/resize.man +++ b/app/xterm/resize.man @@ -1,8 +1,15 @@ -.\" $XTermId: resize.man,v 1.15 2006/02/13 01:14:59 tom Exp $ +.\" $XTermId: resize.man,v 1.17 2009/04/11 17:43:39 tom Exp $ .\" -.\" updated by Thomas E. Dickey for XFree86, 1998-2002. +.\" updated by Thomas E. Dickey for XFree86, 1998-2006. .\" .\" $XFree86: xc/programs/xterm/resize.man,v 1.12 2006/02/13 01:14:59 dickey Exp $ +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds AQ \(aq +.el .ds AQ ' +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' .TH RESIZE 1 __vendorversion__ .SH NAME resize \- set TERMCAP and terminal settings to current xterm window size @@ -20,7 +27,7 @@ known as \fI/bin/csh\fP), the following alias could be defined in the user's \fI.cshrc\fP: .sp .nf - % alias rs 'set noglob; eval \fC`\fPresize\fC`\fP' + % alias rs \*(AQset noglob; eval \fC\`\fPresize\fC\`\fP\*(AQ .fi .sp After resizing the window, the user would type: @@ -31,8 +38,8 @@ After resizing the window, the user would type: .sp Users of versions of the Bourne shell (usually known as \fI/bin/sh\fP) that don't have command -functions will need to send the output to a temporary file and the read it back -in with the ``.'' command: +functions will need to send the output to a temporary file and then read it back +in with the \*(``.\*('' command: .sp .nf $ resize > /tmp/out @@ -73,7 +80,7 @@ for the base termcap entry to modify. ~/.cshrc user's alias for the command. .SH "SEE ALSO" -csh(1), tset(1), xterm(1) +csh(1), tset(1), xterm(__mansuffix__) .SH AUTHORS Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) .br diff --git a/app/xterm/screen.c b/app/xterm/screen.c index c806b654b..26ad604d5 100644 --- a/app/xterm/screen.c +++ b/app/xterm/screen.c @@ -1,4 +1,4 @@ -/* $XTermId: screen.c,v 1.246 2009/02/09 21:37:57 tom Exp $ */ +/* $XTermId: screen.c,v 1.394 2009/08/16 18:16:45 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -69,11 +69,261 @@ #include <assert.h> #include <signal.h> +#define inSaveBuf(screen, buf, inx) \ + ((buf) == (screen)->saveBuf_index && \ + ((inx) < (screen)->savelines || (screen)->savelines == 0)) + #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 MoveLineData(base, dst, src, len) \ + memmove(scrnHeadAddr(screen, base, dst), \ + scrnHeadAddr(screen, base, src), \ + scrnHeadSize(screen, len)) + +#define SaveLineData(base, src, len) \ + (void) ScrnPointers(screen, len); \ + memcpy (screen->save_ptr, \ + scrnHeadAddr(screen, base, src), \ + scrnHeadSize(screen, len)) + +#define RestoreLineData(base, dst, len) \ + memcpy (scrnHeadAddr(screen, base, dst), \ + screen->save_ptr, \ + scrnHeadSize(screen, len)) + +#if OPT_SAVE_LINES +#define VisBuf(screen) screen->editBuf_index[screen->whichBuf] +#else +#define VisBuf(screen) scrnHeadAddr(screen, screen->saveBuf_index, (unsigned) savelines) +#endif + +/* + * ScrnPtr's can point to different types of data. + */ +#define SizeofScrnPtr(name) \ + sizeof(*((LineData *)0)->name) + +/* + * The pointers in LineData point into a block of text allocated as a single + * chunk for the given number of rows. Ensure that these pointers are aligned + * at least to int-boundaries. + */ +#define AlignMask() (sizeof(int) - 1) +#define IsAligned(value) (((unsigned long) (value) & AlignMask()) == 0) + +#define AlignValue(value) \ + if (!IsAligned(value)) \ + value = (value | AlignMask()) + 1 + +#define SetupScrnPtr(dst,src,type) \ + dst = (type *) src; \ + assert(IsAligned(dst)); \ + src += skipNcol##type + +#define ScrnBufAddr(ptrs, offset) (ScrnBuf) ((char *) (ptrs) + (offset)) +#define LineDataAddr(ptrs, offset) (LineData *) ((char *) (ptrs) + (offset)) + +#if OPT_TRACE > 1 +static void +traceScrnBuf(const char *tag, TScreen * screen, ScrnBuf sb, unsigned len) +{ + unsigned j; + + TRACE(("traceScrnBuf %s\n", tag)); + for (j = 0; j < len; ++j) { + LineData *src = (LineData *) scrnHeadAddr(screen, sb, j); + TRACE(("%p %s%3d:%s\n", + src, ((int) j >= screen->savelines) ? "*" : " ", + j, visibleIChars(src->charData, src->lineSize))); + } + TRACE(("...traceScrnBuf %s\n", tag)); +} + +#define TRACE_SCRNBUF(tag, screen, sb, len) traceScrnBuf(tag, screen, sb, len) +#else +#define TRACE_SCRNBUF(tag, screen, sb, len) /*nothing */ +#endif + +static unsigned +scrnHeadSize(TScreen * screen, unsigned count) +{ + unsigned result = SizeOfLineData; + + (void) screen; + +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + result += screen->lineExtra; + } +#endif + result *= count; + + return result; +} + +ScrnBuf +scrnHeadAddr(TScreen * screen, ScrnBuf base, unsigned offset) +{ + unsigned size = scrnHeadSize(screen, offset); + ScrnBuf result = ScrnBufAddr(base, size); + + assert((int) offset >= 0); + + return result; +} + +/* + * Given a block of data, build index to it in the 'base' parameter. + */ +void +setupLineData(TScreen * screen, ScrnBuf base, Char * data, unsigned nrow, unsigned ncol) +{ + unsigned i; + unsigned offset = 0; + unsigned jump = scrnHeadSize(screen, 1); + LineData *ptr; +#if OPT_WIDE_CHARS + unsigned j; +#endif + /* these names are based on types */ + unsigned skipNcolChar = (ncol * SizeofScrnPtr(attribs)); + unsigned skipNcolCharData = (ncol * SizeofScrnPtr(charData)); +#if OPT_ISO_COLORS + unsigned skipNcolCellColor = (ncol * SizeofScrnPtr(color)); +#endif + + AlignValue(skipNcolChar); +#if OPT_ISO_COLORS + AlignValue(skipNcolCellColor); +#endif + AlignValue(skipNcolCharData); + + for (i = 0; i < nrow; i++, offset += jump) { + ptr = LineDataAddr(base, offset); + + ptr->lineSize = (Dimension) ncol; + ptr->bufHead = 0; +#if OPT_DEC_CHRSET + SetLineDblCS(ptr, 0); +#endif + SetupScrnPtr(ptr->attribs, data, Char); +#if OPT_ISO_COLORS + SetupScrnPtr(ptr->color, data, CellColor); +#endif + SetupScrnPtr(ptr->charData, data, CharData); +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + unsigned extra = (unsigned) screen->max_combining; + + ptr->combSize = (Char) extra; + for (j = 0; j < extra; ++j) { + SetupScrnPtr(ptr->combData[j], data, CharData); + } + } +#endif + } +} + +#define ExtractScrnData(name) \ + memcpy(dstPtrs->name, \ + ((LineData *) srcPtrs)->name,\ + dstCols * sizeof(dstPtrs->name[0])); \ + nextPtr += (srcCols * sizeof(dstPtrs->name[0])) + +/* + * As part of reallocating the screen buffer when resizing, extract from + * the old copy of the screen buffer the data which will be used in the + * new copy of the screen buffer. + */ +static void +extractScrnData(TScreen * screen, + ScrnBuf dstPtrs, + ScrnBuf srcPtrs, + unsigned nrows, + unsigned move_down) +{ + unsigned j; + + TRACE(("extractScrnData(nrows %d)\n", nrows)); + + TRACE_SCRNBUF("extract from", screen, srcPtrs, nrows); + for (j = 0; j < nrows; j++) { + LineData *dst = (LineData *) scrnHeadAddr(screen, + dstPtrs, j + move_down); + LineData *src = (LineData *) scrnHeadAddr(screen, + srcPtrs, j); + copyLineData(dst, src); + } +} + +static ScrnPtr * +allocScrnHead(TScreen * screen, unsigned nrow) +{ + ScrnPtr *result; + unsigned size = scrnHeadSize(screen, 1); + + result = (ScrnPtr *) calloc(nrow, size); + if (result == 0) + SysError(ERROR_SCALLOC); + + TRACE(("allocScrnHead %d -> %d -> %p..%p\n", nrow, nrow * size, + result, + (char *) result + (nrow * size) - 1)); + return result; +} + +/* + * Return the size of a line's data. + */ +static unsigned +sizeofScrnRow(TScreen * screen, unsigned ncol) +{ + unsigned result = 1; + unsigned sizeAttribs; +#if OPT_ISO_COLORS + unsigned sizeColors; +#endif + + (void) screen; + +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + result += (unsigned) screen->max_combining; + } +#endif + result = (ncol * result * sizeof(CharData)); + AlignValue(result); + + sizeAttribs = (ncol * SizeofScrnPtr(attribs)); + AlignValue(sizeAttribs); + result += sizeAttribs; + +#if OPT_ISO_COLORS + sizeColors = (ncol * SizeofScrnPtr(color)); + AlignValue(sizeColors); + result += sizeColors; +#endif + + return result; +} + +Char * +allocScrnData(TScreen * screen, unsigned nrow, unsigned ncol) +{ + Char *result; + size_t length = (nrow * sizeofScrnRow(screen, ncol)); + + if ((result = (Char *) calloc(length, sizeof(Char))) == 0) + SysError(ERROR_SCALLOC2); + + TRACE(("allocScrnData %dx%d -> %d -> %p..%p\n", + nrow, ncol, length, result, result + length - 1)); + return result; +} + /* * Allocates memory for a 2-dimensional array of chars and returns a pointer * thereto. Each line is formed from a set of char arrays, with an index @@ -85,38 +335,80 @@ * the third is the foreground and background colors, and the fourth denotes * the character set. * - * We store it all as pointers, because of alignment considerations, together - * with the intention of being able to change the total number of pointers per - * row according to whether the user wants color or not. + * We store it all as pointers, because of alignment considerations. */ ScrnBuf -Allocate(int nrow, int ncol, Char ** addr) +allocScrnBuf(XtermWidget xw, unsigned nrow, unsigned ncol, Char ** addr) { - ScrnBuf base; - Char *tmp; - int i, j, k; - size_t entries = (size_t) (MAX_PTRS * nrow); - size_t length = (size_t) (BUF_PTRS * nrow * ncol); - - if ((base = TypeCallocN(ScrnPtr, entries)) == 0) - SysError(ERROR_SCALLOC); + TScreen *screen = TScreenOf(xw); + ScrnBuf base = 0; - if ((tmp = TypeCallocN(Char, length)) == 0) - SysError(ERROR_SCALLOC2); + if (nrow != 0) { + base = allocScrnHead(screen, nrow); + *addr = allocScrnData(screen, nrow, ncol); - *addr = tmp; - for (i = k = 0; i < nrow; i++) { - base[k] = 0; /* per-line flags */ - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - base[k++] = tmp; - tmp += ncol; - } + setupLineData(screen, base, *addr, nrow, ncol); } + TRACE(("allocScrnBuf %dx%d ->%p\n", nrow, ncol, base)); return (base); } +#if OPT_SAVE_LINES +/* + * Copy line-data from the visible (edit) buffer to the save-lines buffer. + */ +static void +saveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) +{ + unsigned j; + + TRACE(("...copying %d lines from editBuf to saveBuf\n", n)); +#if OPT_FIFO_LINES + (void) sb; +#endif + for (j = 0; j < n; ++j) { +#if OPT_FIFO_LINES + LineData *dst = addScrollback(screen); +#else + unsigned k = (screen->savelines + j - n); + LineData *dst = (LineData *) scrnHeadAddr(screen, sb, k); +#endif + LineData *src = getLineData(screen, (int) j); + copyLineData(dst, src); + } +} + +/* + * Copy line-data from the save-lines buffer to the visible (edit) buffer. + */ +static void +unsaveEditBufLines(TScreen * screen, ScrnBuf sb, unsigned n) +{ + unsigned j; + + TRACE(("...copying %d lines from saveBuf to editBuf\n", n)); + for (j = 0; j < n; ++j) { + int extra = (int) (n - j); + LineData *dst = (LineData *) scrnHeadAddr(screen, sb, j); +#if OPT_FIFO_LINES + LineData *src; + + if ((screen->saved_fifo - extra) <= 0) { + TRACE(("...FIXME: must clear text!\n")); + continue; + } + src = getScrollback(screen, -extra); +#else + unsigned k = (screen->savelines - extra); + LineData *src = (LineData *) scrnHeadAddr(screen, + screen->saveBuf_index, k); +#endif + copyLineData(dst, src); + } +} +#endif + /* * This is called when the screen is resized. * Returns the number of lines the text was moved down (neg for up). @@ -126,131 +418,95 @@ static int Reallocate(XtermWidget xw, ScrnBuf * sbuf, Char ** sbufaddr, - int nrow, - int ncol, - int oldrow, - int oldcol) + unsigned nrow, + unsigned ncol, + unsigned oldrow, + unsigned oldcol) { - ScrnBuf base; - Char *tmp; - int i, j, k, minrows; - size_t mincols; - Char *oldbuf; + TScreen *screen = TScreenOf(xw); + ScrnBuf oldBufHead; + ScrnBuf newBufHead; + Char *newBufData; + unsigned minrows; + unsigned mincols; + Char *oldBufData; int move_down = 0, move_up = 0; - size_t entries = (size_t) (MAX_PTRS * nrow); - size_t length = (size_t) (BUF_PTRS * nrow * ncol); if (sbuf == NULL || *sbuf == NULL) { return 0; } - oldbuf = *sbufaddr; + oldBufData = *sbufaddr; - /* - * Special case if oldcol == ncol - straight forward realloc and - * update of the additional lines in sbuf - * - * FIXME: this is a good idea, but doesn't seem to be implemented. - * -gildea - */ + TRACE(("Reallocate %dx%d -> %dx%d\n", oldrow, oldcol, nrow, ncol)); /* * realloc sbuf, the pointers to all the lines. * If the screen shrinks, remove lines off the top of the buffer * if resizeGravity resource says to do so. */ - if (nrow < oldrow - && xw->misc.resizeGravity == SouthWestGravity) { - /* Remove lines off the top of the buffer if necessary. */ - move_up = (oldrow - nrow) - - (xw->screen.max_row - xw->screen.cur_row); - if (move_up < 0) - move_up = 0; - /* Overlapping memmove here! */ - memmove(*sbuf, *sbuf + (move_up * MAX_PTRS), - (unsigned) (MAX_PTRS * (oldrow - move_up)) * sizeof((*sbuf)[0])); + TRACE(("Check move_up, nrow %d vs oldrow %d (resizeGravity %s)\n", + nrow, oldrow, + BtoS(GravityIsSouthWest(xw)))); + if (GravityIsSouthWest(xw)) { + if (nrow < oldrow) { + /* Remove lines off the top of the buffer if necessary. */ + move_up = (int) (oldrow - nrow) + - (xw->screen.max_row - xw->screen.cur_row); + if (move_up < 0) + move_up = 0; + /* Overlapping move here! */ + TRACE(("move_up %d\n", move_up)); + if (move_up) { + ScrnBuf dst = *sbuf; + unsigned len = (unsigned) ((int) oldrow - move_up); + + TRACE_SCRNBUF("before move_up", screen, dst, oldrow); + SaveLineData(dst, 0, (size_t) move_up); + MoveLineData(dst, 0, (size_t) move_up, len); + RestoreLineData(dst, len, (size_t) move_up); + TRACE_SCRNBUF("after move_up", screen, dst, oldrow); + } + } } - *sbuf = TypeRealloc(ScrnPtr, entries, *sbuf); - if (*sbuf == 0) - SysError(ERROR_RESIZE); - base = *sbuf; + oldBufHead = *sbuf; + *sbuf = allocScrnHead(screen, (unsigned) nrow); + newBufHead = *sbuf; /* - * create the new buffer space and copy old buffer contents there - * line by line. + * Create the new buffer space and copy old buffer contents there, line by + * line. */ - if ((tmp = TypeCallocN(Char, length)) == 0) - SysError(ERROR_SREALLOC); - *sbufaddr = tmp; - minrows = (oldrow < nrow) ? oldrow : nrow; - mincols = (size_t) ((oldcol < ncol) ? oldcol : ncol); - if (nrow > oldrow - && xw->misc.resizeGravity == SouthWestGravity) { - /* move data down to bottom of expanded screen */ - move_down = Min(nrow - oldrow, xw->screen.savedlines); - tmp += (ncol * move_down * BUF_PTRS); - } + newBufData = allocScrnData(screen, nrow, ncol); + *sbufaddr = newBufData; - for (i = k = 0; i < minrows; i++) { - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - memcpy(tmp, base[k++], mincols); - tmp += ncol; + minrows = (oldrow < nrow) ? oldrow : nrow; + mincols = (oldcol < ncol) ? oldcol : ncol; + if (GravityIsSouthWest(xw)) { + if (nrow > oldrow) { + /* move data down to bottom of expanded screen */ + move_down = Min((int) (nrow - oldrow), xw->screen.savedlines); } } - /* - * update the pointers in sbuf - */ - for (i = k = 0, tmp = *sbufaddr; i < nrow; i++) { - for (j = 0; j < BUF_HEAD; j++) - base[k++] = 0; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - base[k++] = tmp; - tmp += ncol; - } - } + setupLineData(screen, newBufHead, *sbufaddr, nrow, ncol); + extractScrnData(screen, newBufHead, oldBufHead, minrows, +#if OPT_SAVE_LINES + 0 +#else + (unsigned) move_down +#endif + ); + free(oldBufHead); - /* Now free the old buffer */ - free(oldbuf); + /* Now free the old data */ + free(oldBufData); + TRACE(("...Reallocate %dx%d ->%p\n", nrow, ncol, newBufHead)); return move_down ? move_down : -move_up; /* convert to rows */ } #if OPT_WIDE_CHARS -#if 0 -static void -dump_screen(const char *tag, - XtermWidget xw, - ScrnBuf sbuf, - Char * sbufaddr, - unsigned nrow, - unsigned ncol) -{ - unsigned y, x; - - TRACE(("DUMP %s, ptrs %d\n", tag, xw->num_ptrs)); - TRACE((" sbuf %p\n", sbuf)); - TRACE((" sbufaddr %p\n", sbufaddr)); - TRACE((" nrow %d\n", nrow)); - TRACE((" ncol %d\n", ncol)); - - for (y = 0; y < nrow; ++y) { - ScrnPtr ptr = BUF_CHARS(sbuf, y); - TRACE(("%3d:%p:", y, ptr)); - for (x = 0; x < ncol; ++x) { - Char c = ptr[x]; - if (c == 0) - c = '~'; - TRACE(("%c", c)); - } - TRACE(("\n")); - } -} -#else -#define dump_screen(tag, xw, sbuf, sbufaddr, nrow, ncol) /* nothing */ -#endif - /* * This function reallocates memory if changing the number of Buf offsets. * The code is based on Reallocate(). @@ -260,68 +516,70 @@ ReallocateBufOffsets(XtermWidget xw, ScrnBuf * sbuf, Char ** sbufaddr, unsigned nrow, - unsigned ncol, - size_t new_max_offsets) + unsigned ncol) { + TScreen *screen = TScreenOf(xw); unsigned i; - int j, k; - ScrnBuf base; - Char *oldbuf, *tmp; - size_t entries, length; - /* - * As there are 2 buffers (allbuf, altbuf), we cannot change num_ptrs in - * this function. However MAX_PTRS and BUF_PTRS depend on num_ptrs so - * change it now and restore the value when done. - */ - int old_max_ptrs = MAX_PTRS; + ScrnBuf newBufHead; + Char *oldBufData; + ScrnBuf oldBufHead; + + unsigned old_jump = scrnHeadSize(screen, 1); + unsigned new_jump; + unsigned new_ptrs = 1 + (unsigned) (screen->max_combining); + unsigned dstCols = ncol; + unsigned srcCols = ncol; + LineData *dstPtrs; + LineData *srcPtrs; + Char *nextPtr; assert(nrow != 0); assert(ncol != 0); - assert(new_max_offsets != 0); - dump_screen("before", xw, *sbuf, *sbufaddr, nrow, ncol); + oldBufData = *sbufaddr; + oldBufHead = *sbuf; - xw->num_ptrs = (int) new_max_offsets; + /* + * Allocate a new LineData array, retain the old one until we've copied + * the data that it points to, as well as non-pointer data, e.g., bufHead. + * + * Turn on wide-chars temporarily when constructing pointers, since that is + * used to decide whether to address the combData[] array, which affects + * the length of the LineData structure. + */ + screen->wide_chars = True; - entries = ((unsigned) MAX_PTRS * nrow); - length = ((unsigned) BUF_PTRS * nrow * ncol); - oldbuf = *sbufaddr; + new_jump = scrnHeadSize(screen, 1); + newBufHead = allocScrnHead(screen, nrow); + *sbufaddr = allocScrnData(screen, nrow, ncol); + setupLineData(screen, newBufHead, *sbufaddr, nrow, ncol); - *sbuf = TypeRealloc(ScrnPtr, entries, *sbuf); - if (*sbuf == 0) - SysError(ERROR_RESIZE); - base = *sbuf; + screen->wide_chars = False; - if ((tmp = TypeCallocN(Char, length)) == 0) - SysError(ERROR_SREALLOC); - *sbufaddr = tmp; + nextPtr = *sbufaddr; - for (i = 0, k = 0; i < nrow; i++) { - k += BUF_HEAD; - for (j = BUF_HEAD; j < old_max_ptrs; j++) { - memcpy(tmp, base[k++], ncol); - tmp += ncol; - } - tmp += ncol * (new_max_offsets - (unsigned) old_max_ptrs); - } + srcPtrs = (LineData *) oldBufHead; + dstPtrs = (LineData *) newBufHead; + for (i = 0; i < nrow; i++) { + dstPtrs->bufHead = srcPtrs->bufHead; + ExtractScrnData(attribs); +#if OPT_ISO_COLORS + ExtractScrnData(color); +#endif + ExtractScrnData(charData); - /* - * update the pointers in sbuf - */ - for (i = 0, k = 0, tmp = *sbufaddr; i < nrow; i++) { - for (j = 0; j < BUF_HEAD; j++) - base[k++] = 0; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - base[k++] = tmp; - tmp += ncol; - } + nextPtr += ncol * new_ptrs; + srcPtrs = LineDataAddr(srcPtrs, old_jump); + dstPtrs = LineDataAddr(dstPtrs, new_jump); } - /* Now free the old buffer and restore num_ptrs */ - free(oldbuf); - dump_screen("after", xw, *sbuf, *sbufaddr, nrow, ncol); + /* Now free the old data */ + free(oldBufData); + free(oldBufHead); - xw->num_ptrs = old_max_ptrs; + *sbuf = newBufHead; + + TRACE(("ReallocateBufOffsets %dx%d ->%p\n", nrow, ncol, *sbufaddr)); } /* @@ -331,8 +589,6 @@ void ChangeToWide(XtermWidget xw) { TScreen *screen = &(xw->screen); - unsigned new_bufoffset = (unsigned) (OFF_FINAL - + (screen->max_combining * 2)); int savelines = screen->scrollWidget ? screen->savelines : 0; if (screen->wide_chars) @@ -346,32 +602,48 @@ ChangeToWide(XtermWidget xw) /* * If we're displaying the alternate screen, switch the pointers back * temporarily so ReallocateBufOffsets() will operate on the proper - * data in altbuf. + * data in the alternate buffer. */ - if (screen->alternate) + if (screen->whichBuf) SwitchBufPtrs(screen); +#if OPT_SAVE_LINES +#if !OPT_FIFO_LINES + ReallocateBufOffsets(xw, + &screen->saveBuf_index, + &screen->saveBuf_data, + (unsigned) savelines, + (unsigned) MaxCols(screen)); +#endif + if (screen->editBuf_index[0]) { + ReallocateBufOffsets(xw, + &screen->editBuf_index[0], + &screen->editBuf_data[0], + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); + } +#else ReallocateBufOffsets(xw, - &screen->allbuf, &screen->sbuf_address, + &screen->saveBuf_index, + &screen->saveBuf_data, (unsigned) (MaxRows(screen) + savelines), - (unsigned) MaxCols(screen), - new_bufoffset); - if (screen->altbuf) { + (unsigned) MaxCols(screen)); +#endif + if (screen->editBuf_index[1]) { ReallocateBufOffsets(xw, - &screen->altbuf, &screen->abuf_address, + &screen->editBuf_index[1], + &screen->editBuf_data[1], (unsigned) MaxRows(screen), - (unsigned) MaxCols(screen), - new_bufoffset); + (unsigned) MaxCols(screen)); } screen->wide_chars = True; - xw->num_ptrs = (int) new_bufoffset; - screen->visbuf = &screen->allbuf[MAX_PTRS * savelines]; + screen->visbuf = VisBuf(screen); /* * Switch the pointers back before we start painting on the screen. */ - if (screen->alternate) + if (screen->whichBuf) SwitchBufPtrs(screen); update_font_utf8_mode(); @@ -389,29 +661,28 @@ ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col) { if (len != 0) { TScreen *screen = &(xw->screen); + LineData *ld; + unsigned n; + + ld = getLineData(screen, row); + flags |= TERM_COLOR_FLAGS(xw); - memset(SCRN_BUF_CHARS(screen, row) + col, ' ', len); - memset(SCRN_BUF_ATTRS(screen, row) + col, flags, len); + for (n = 0; n < len; ++n) + ld->charData[(unsigned) col + n] = (CharData) ' '; - if_OPT_EXT_COLORS(screen, { - memset(SCRN_BUF_FGRND(screen, row) + col, - xw->sgr_foreground, len); - memset(SCRN_BUF_BGRND(screen, row) + col, - xw->cur_background, len); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - memset(SCRN_BUF_COLOR(screen, row) + col, - (int) xtermColorPair(xw), len); - }); - if_OPT_DEC_CHRSET({ - memset(SCRN_BUF_CSETS(screen, row) + col, - curXtermChrSet(xw, row), len); + memset(ld->attribs + col, flags, len); + + if_OPT_ISO_COLORS(screen, { + CellColor p = xtermColorPair(xw); + for (n = 0; n < len; ++n) { + ld->color[(unsigned) col + n] = p; + } }); if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_WIDEC; off < MAX_PTRS; ++off) { - memset(SCREEN_PTR(screen, row, off) + col, 0, len); + size_t off; + for_each_combData(off, ld) { + memset(ld->combData[off] + col, 0, len * sizeof(IChar)); } }); } @@ -464,26 +735,19 @@ void ScrnWriteText(XtermWidget xw, IChar * str, unsigned flags, - unsigned cur_fg_bg, + CellColor cur_fg_bg, unsigned length) { TScreen *screen = &(xw->screen); + LineData *ld; #if OPT_ISO_COLORS -#if OPT_EXT_COLORS - Char *fbf = 0; - Char *fbb = 0; -#else - Char *fb = 0; -#endif -#endif -#if OPT_DEC_CHRSET - Char *cb = 0; + CellColor *fb = 0; #endif Char *attrs; int avail = MaxCols(screen) - screen->cur_col; - Char *chars; + IChar *chars; #if OPT_WIDE_CHARS - Char starcol1, starcol2; + IChar starcol1; #endif unsigned n; unsigned real_width = visual_width(str, length); @@ -497,23 +761,17 @@ ScrnWriteText(XtermWidget xw, if (length == 0 || real_width == 0) return; - chars = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col; - attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col; + ld = getLineData(screen, screen->cur_row); - if_OPT_EXT_COLORS(screen, { - fbf = SCRN_BUF_FGRND(screen, screen->cur_row) + screen->cur_col; - fbb = SCRN_BUF_BGRND(screen, screen->cur_row) + screen->cur_col; - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - fb = SCRN_BUF_COLOR(screen, screen->cur_row) + screen->cur_col; - }); - if_OPT_DEC_CHRSET({ - cb = SCRN_BUF_CSETS(screen, screen->cur_row) + screen->cur_col; + chars = ld->charData + screen->cur_col; + attrs = ld->attribs + screen->cur_col; + + if_OPT_ISO_COLORS(screen, { + fb = ld->color + screen->cur_col; }); #if OPT_WIDE_CHARS starcol1 = *chars; - starcol2 = chars[length - 1]; #endif /* write blanks if we're writing invisible text */ @@ -521,80 +779,54 @@ ScrnWriteText(XtermWidget xw, if ((flags & INVISIBLE)) chars[n] = ' '; else - chars[n] = LO_BYTE(str[n]); + chars[n] = str[n]; } #if OPT_BLINK_TEXT if ((flags & BLINK) && !(screen->blink_as_bold)) { - ScrnSetBlinked(screen, screen->cur_row); + LineSetBlinked(ld); } #endif -#define ERROR_1 0x20 -#define ERROR_2 0x00 if_OPT_WIDE_CHARS(screen, { - Char *char2; - if (real_width != length) { - Char *char1 = chars; - char2 = SCRN_BUF_WIDEC(screen, screen->cur_row); - char2 += screen->cur_col; - if (screen->cur_col && starcol1 == HIDDEN_LO && *char2 == HIDDEN_HI - && isWide(PACK_PAIR(char1, char2, -1))) { - char1[-1] = ERROR_1; - char2[-1] = ERROR_2; + IChar *char1 = chars; + if (screen->cur_col + && starcol1 == HIDDEN_CHAR + && isWide((int) char1[-1])) { + char1[-1] = (CharData) ' '; } /* if we are overwriting the right hand half of a wide character, make the other half vanish */ while (length) { int ch = (int) str[0]; - *char1++ = LO_BYTE(*str); - *char2++ = HI_BYTE(*str); - str++; + *char1++ = *str++; length--; if (isWide(ch)) { - *char1 = HIDDEN_LO; - *char2 = HIDDEN_HI; - char1++; - char2++; + *char1++ = (CharData) HIDDEN_CHAR; } } - if (*char1 == HIDDEN_LO - && *char2 == HIDDEN_HI - && char1[-1] == HIDDEN_LO - && char2[-1] == HIDDEN_HI) { - *char1 = ERROR_1; - *char2 = ERROR_2; + if (*char1 == HIDDEN_CHAR + && char1[-1] == HIDDEN_CHAR) { + *char1 = (CharData) ' '; } /* if we are overwriting the left hand half of a wide character, make the other half vanish */ } else { - if ((char2 = SCRN_BUF_WIDEC(screen, screen->cur_row)) != 0) { - char2 += screen->cur_col; - if (screen->cur_col && starcol1 == HIDDEN_LO && *char2 == HIDDEN_HI - && isWide(PACK_PAIR(chars, char2, -1))) { - chars[-1] = ERROR_1; - char2[-1] = ERROR_2; - } - /* if we are overwriting the right hand half of a - wide character, make the other half vanish */ - if (chars[length] == HIDDEN_LO && char2[length] == HIDDEN_HI && - isWide(PACK_PAIR(chars, char2, length - 1))) { - chars[length] = ERROR_1; - char2[length] = ERROR_2; - } - /* if we are overwriting the left hand half of a - wide character, make the other half vanish */ - for (n = 0; n < length; ++n) { - if ((flags & INVISIBLE)) - char2[n] = 0; - else - char2[n] = HI_BYTE(str[n]); - } + if (screen->cur_col + && starcol1 == HIDDEN_CHAR + && isWide((int) chars[-1])) { + chars[-1] = (CharData) ' '; + } + /* if we are overwriting the right hand half of a + wide character, make the other half vanish */ + if (chars[length] == HIDDEN_CHAR + && isWide((int) chars[length - 1])) { + chars[length] = (CharData) ' '; } } }); @@ -604,23 +836,17 @@ ScrnWriteText(XtermWidget xw, memset(attrs, (Char) flags, real_width); if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_FINAL; off < MAX_PTRS; ++off) { - memset(SCREEN_PTR(screen, - screen->cur_row, - off) + screen->cur_col, - 0, real_width); + size_t off; + for_each_combData(off, ld) { + memset(ld->combData[off] + screen->cur_col, + 0, + real_width * sizeof(IChar)); } }); - if_OPT_EXT_COLORS(screen, { - memset(fbf, (int) ExtractForeground(cur_fg_bg), real_width); - memset(fbb, (int) ExtractBackground(cur_fg_bg), real_width); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - memset(fb, (int) cur_fg_bg, real_width); - }); - if_OPT_DEC_CHRSET({ - memset(cb, curXtermChrSet(xw, screen->cur_row), real_width); + if_OPT_ISO_COLORS(screen, { + unsigned j; + for (j = 0; j < real_width; ++j) + fb[j] = cur_fg_bg; }); if_OPT_WIDE_CHARS(screen, { @@ -631,6 +857,8 @@ ScrnWriteText(XtermWidget xw, if_OPT_XMC_GLITCH(screen, { Resolve_XMC(xw); }); + + return; } /* @@ -640,82 +868,147 @@ static void ScrnClearLines(XtermWidget xw, ScrnBuf sb, int where, unsigned n, unsigned size) { TScreen *screen = &(xw->screen); - int i, j; - size_t len = ScrnPointers(screen, n); - int last = ((int) n * MAX_PTRS); + ScrnPtr *base; + unsigned jump = scrnHeadSize(screen, 1); + unsigned i; + LineData *work; + unsigned flags = TERM_COLOR_FLAGS(xw); +#if OPT_ISO_COLORS + unsigned j; +#endif - TRACE(("ScrnClearLines(where %d, n %d, size %d)\n", where, n, size)); + TRACE(("ScrnClearLines(%s:where %d, n %d, size %d)\n", + (sb == screen->saveBuf_index) ? "save" : "edit", + where, n, size)); assert(n != 0); assert(size != 0); /* save n lines at where */ - memcpy((char *) screen->save_ptr, - (char *) &sb[MAX_PTRS * where], - len); + SaveLineData(sb, (unsigned) where, (size_t) n); /* clear contents of old rows */ - if (TERM_COLOR_FLAGS(xw)) { - unsigned flags = TERM_COLOR_FLAGS(xw); - for (i = 0; i < last; i += MAX_PTRS) { - for (j = 0; j < MAX_PTRS; j++) { - if (j < BUF_HEAD) - screen->save_ptr[i + j] = 0; - else if (j == OFF_ATTRS) - memset(screen->save_ptr[i + j], (int) flags, size); + base = screen->save_ptr; + for (i = 0; i < n; ++i) { + work = (LineData *) base; + work->bufHead = 0; +#if OPT_DEC_CHRSET + SetLineDblCS(work, 0); +#endif + + memset(work->charData, 0, size * sizeof(IChar)); + if (TERM_COLOR_FLAGS(xw)) { + memset(work->attribs, (int) flags, size); #if OPT_ISO_COLORS -#if OPT_EXT_COLORS - else if (j == OFF_FGRND) - memset(screen->save_ptr[i + j], xw->sgr_foreground, size); - else if (j == OFF_BGRND) - memset(screen->save_ptr[i + j], xw->cur_background, size); -#else - else if (j == OFF_COLOR) - memset(screen->save_ptr[i + j], (int) - xtermColorPair(xw), size); + { + CellColor p = xtermColorPair(xw); + for (j = 0; j < size; ++j) { + work->color[j] = p; + } + } #endif + } else { + memset(work->attribs, 0, size); +#if OPT_ISO_COLORS + memset(work->color, 0, size * sizeof(work->color[0])); #endif - else - bzero(screen->save_ptr[i + j], size); + } +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + size_t off; + + for (off = 0; off < work->combSize; ++off) { + memset(work->combData[off], 0, size * sizeof(IChar)); } } - } else { - for (i = 0; i < last; i += MAX_PTRS) { - for (j = 0; j < BUF_HEAD; j++) - screen->save_ptr[i + j] = 0; - for (j = BUF_HEAD; j < MAX_PTRS; j++) - bzero(screen->save_ptr[i + j], size); +#endif + base = ScrnBufAddr(base, jump); + } +} + +/* + * We're always ensured of having a visible buffer, but may not have saved + * lines. Check the pointer that's sure to work. + */ +#if OPT_SAVE_LINES +#define OkAllocBuf(screen) (screen->editBuf_index[0] != 0) +#else +#define OkAllocBuf(screen) (screen->saveBuf_index != 0) +#endif + +void +ScrnAllocBuf(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (!OkAllocBuf(screen)) { + int nrows = MaxRows(screen); +#if !OPT_SAVE_LINES + int savelines = screen->scrollWidget ? screen->savelines : 0; +#endif + + TRACE(("ScrnAllocBuf %dx%d (%d)\n", + nrows, MaxCols(screen), screen->savelines)); + +#if OPT_SAVE_LINES + if (screen->savelines != 0) { +#if OPT_FIFO_LINES + /* for FIFO, we only need space for the index - addScrollback inits */ + screen->saveBuf_index = allocScrnHead(screen, + (unsigned) (screen->savelines)); +#else + screen->saveBuf_index = allocScrnBuf(xw, + (unsigned) screen->savelines, + (unsigned) MaxCols(screen), + &screen->saveBuf_data); +#endif + } else { + screen->saveBuf_index = 0; } + screen->editBuf_index[0] = allocScrnBuf(xw, + (unsigned) nrows, + (unsigned) MaxCols(screen), + &screen->editBuf_data[0]); +#else /* !OPT_SAVE_LINES */ + screen->saveBuf_index = allocScrnBuf(xw, + (unsigned) (nrows + screen->savelines), + (unsigned) (MaxCols(screen)), + &screen->saveBuf_data); +#endif /* OPT_SAVE_LINES */ + screen->visbuf = VisBuf(screen); } + return; } size_t ScrnPointers(TScreen * screen, size_t len) { - len *= (unsigned) MAX_PTRS; + size_t result = scrnHeadSize(screen, len); - if (len > screen->save_len) { + if (result > screen->save_len) { if (screen->save_len) - screen->save_ptr = TypeRealloc(ScrnPtr, len, screen->save_ptr); + screen->save_ptr = (ScrnPtr *) realloc(screen->save_ptr, result); else - screen->save_ptr = TypeMallocN(ScrnPtr, len); + screen->save_ptr = (ScrnPtr *) malloc(result); screen->save_len = len; if (screen->save_ptr == 0) SysError(ERROR_SAVE_PTR); } - return len * sizeof(ScrnPtr); + TRACE2(("ScrnPointers %ld ->%p\n", (long) len, screen->save_ptr)); + return result; } /* * Inserts n blank lines at sb + where, treating last as a bottom margin. - * size is the size of each entry in sb. */ void -ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, - unsigned n, unsigned size) +ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) { TScreen *screen = &(xw->screen); - size_t len = ScrnPointers(screen, n); + unsigned size = (unsigned) MaxCols(screen); + + TRACE(("ScrnInsertLine(last %d, where %d, n %d, size %d)\n", + last, where, n, size)); assert(where >= 0); assert(last >= (int) n); @@ -723,7 +1016,6 @@ ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, assert(n != 0); assert(size != 0); - assert(MAX_PTRS > 0); /* save n lines at bottom */ ScrnClearLines(xw, sb, (last -= (int) n - 1), n, size); @@ -738,45 +1030,98 @@ ScrnInsertLine(XtermWidget xw, ScrnBuf sb, int last, int where, * +--------|---------|----+ */ assert(last >= where); - memmove((char *) &sb[MAX_PTRS * (where + (int) n)], - (char *) &sb[MAX_PTRS * where], - sizeof(char *) * (unsigned) (MAX_PTRS * (last - where))); + /* + * This will never shift from the saveBuf to editBuf, so there is no need + * to handle that case. + */ + MoveLineData(sb, + (unsigned) (where + (int) n), + (unsigned) where, + (unsigned) (last - where)); /* reuse storage for new lines at where */ - memcpy((char *) &sb[MAX_PTRS * where], - (char *) screen->save_ptr, - len); + RestoreLineData(sb, (unsigned) where, n); } /* * Deletes n lines at sb + where, treating last as a bottom margin. - * size is the size of each entry in sb. */ void -ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, - unsigned n, unsigned size) +ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, unsigned n) { TScreen *screen = &(xw->screen); + unsigned size = (unsigned) MaxCols(screen); + + TRACE(("ScrnDeleteLine(%s:last %d, where %d, n %d, size %d)\n", + (sb == screen->saveBuf_index) ? "save" : "edit", + last, where, n, size)); assert(where >= 0); assert(last >= where + (int) n - 1); assert(n != 0); assert(size != 0); - assert(MAX_PTRS > 0); + /* move up lines */ + last -= ((int) n - 1); +#if OPT_SAVE_LINES + if (inSaveBuf(screen, sb, where)) { +#if !OPT_FIFO_LINES + int from = where + n; +#endif + + /* we shouldn't be editing the saveBuf, only scroll into it */ + assert(last >= screen->savelines); + + if (sb != 0) { +#if OPT_FIFO_LINES + /* copy lines from editBuf to saveBuf (allocating as we go...) */ + saveEditBufLines(screen, sb, n); +#else + ScrnClearLines(xw, sb, where, n, size); + + /* move the pointers within saveBuf */ + TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n", + ((screen->savelines > from) + ? "" + : "SKIP "), + screen->savelines, + from)); + if (screen->savelines > from) { + MoveLineData(sb, + (unsigned) where, + (unsigned) from, + (unsigned) (screen->savelines - from)); + } + + /* reuse storage in saveBuf */ + TRACE(("...reuse %d lines storage in saveBuf\n", n)); + RestoreLineData(sb, (unsigned) screen->savelines - n, n); + + /* copy lines from editBuf to saveBuf (into the reused storage) */ + saveEditBufLines(screen, sb, n); +#endif + } + + /* adjust variables to fall-thru into changes only to editBuf */ + TRACE(("...adjusting variables, to work on editBuf alone\n")); + last -= screen->savelines; + where = 0; + sb = screen->visbuf; + } +#endif + /* + * Scroll the visible buffer (editBuf). + */ ScrnClearLines(xw, sb, where, n, size); - /* move up lines */ - memmove((char *) &sb[MAX_PTRS * where], - (char *) &sb[MAX_PTRS * (where + (int) n)], - sizeof(char *) * (unsigned) (MAX_PTRS - * ((last -= ((int) n - 1)) - where))); + MoveLineData(sb, + (unsigned) where, + (unsigned) (where + (int) n), + (size_t) (last - where)); /* reuse storage for new bottom lines */ - memcpy((char *) &sb[MAX_PTRS * last], - (char *) screen->save_ptr, - (unsigned) MAX_PTRS * sizeof(char *) * n); + RestoreLineData(sb, (unsigned) last, n); } /* @@ -786,23 +1131,23 @@ ScrnDeleteLine(XtermWidget xw, ScrnBuf sb, int last, int where, void ScrnInsertChar(XtermWidget xw, unsigned n) { -#define Target (data + col + n) -#define Source (data + col) +#define MemMove(data) \ + for (j = last - 1; j >= (col + (int) n); --j) \ + data[j] = data[j - (int) n] TScreen *screen = &(xw->screen); - ScrnBuf sb = screen->visbuf; int last = MaxCols(screen); int row = screen->cur_row; int col = screen->cur_col; - Char *data; - size_t nbytes; + int j, nbytes; + LineData *ld; if (last <= (col + (int) n)) { if (last <= col) return; n = (unsigned) (last - col); } - nbytes = (size_t) (last - (col + (int) n)); + nbytes = (last - (col + (int) n)); assert(screen->cur_col >= 0); assert(screen->cur_row >= 0); @@ -822,37 +1167,23 @@ ScrnInsertChar(XtermWidget xw, unsigned n) } }); - data = BUF_CHARS(sb, row); - memmove(Target, Source, nbytes); - - data = BUF_ATTRS(sb, row); - memmove(Target, Source, nbytes); + if ((ld = getLineData(screen, row)) != 0) { + MemMove(ld->charData); + MemMove(ld->attribs); - if_OPT_EXT_COLORS(screen, { - data = BUF_FGRND(sb, row); - memmove(Target, Source, nbytes); - data = BUF_BGRND(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - data = BUF_COLOR(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_DEC_CHRSET({ - data = BUF_CSETS(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_WIDEC; off < MAX_PTRS; ++off) { - data = BUFFER_PTR(sb, row, off); - memmove(Target, Source, nbytes); - } - }); + if_OPT_ISO_COLORS(screen, { + MemMove(ld->color); + }); + if_OPT_WIDE_CHARS(screen, { + size_t off; + for_each_combData(off, ld) { + MemMove(ld->combData[off]); + } + }); + } ClearCells(xw, CHARDRAWN, n, row, col); -#undef Source -#undef Target +#undef MemMove } /* @@ -861,23 +1192,23 @@ ScrnInsertChar(XtermWidget xw, unsigned n) void ScrnDeleteChar(XtermWidget xw, unsigned n) { -#define Target (data + col) -#define Source (data + col + n) +#define MemMove(data) \ + for (j = col; j < last - (int) n; ++j) \ + data[j] = data[j + (int) n] TScreen *screen = &(xw->screen); - ScrnBuf sb = screen->visbuf; int last = MaxCols(screen); int row = screen->cur_row; int col = screen->cur_col; - Char *data; - size_t nbytes; + int j, nbytes; + LineData *ld; if (last <= (col + (int) n)) { if (last <= col) return; n = (unsigned) (last - col); } - nbytes = (size_t) (last - (col + (int) n)); + nbytes = (last - (col + (int) n)); assert(screen->cur_col >= 0); assert(screen->cur_row >= 0); @@ -893,38 +1224,24 @@ ScrnDeleteChar(XtermWidget xw, unsigned n) ClearCells(xw, 0, (unsigned) (kr - kl + 1), row, kl); }); - data = BUF_CHARS(sb, row); - memmove(Target, Source, nbytes); - - data = BUF_ATTRS(sb, row); - memmove(Target, Source, nbytes); + if ((ld = getLineData(screen, row)) != 0) { + MemMove(ld->charData); + MemMove(ld->attribs); - if_OPT_EXT_COLORS(screen, { - data = BUF_FGRND(sb, row); - memmove(Target, Source, nbytes); - data = BUF_BGRND(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - data = BUF_COLOR(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_DEC_CHRSET({ - data = BUF_CSETS(sb, row); - memmove(Target, Source, nbytes); - }); - if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_WIDEC; off < MAX_PTRS; ++off) { - data = BUFFER_PTR(sb, row, off); - memmove(Target, Source, nbytes); - } - }); + if_OPT_ISO_COLORS(screen, { + MemMove(ld->color); + }); + if_OPT_WIDE_CHARS(screen, { + size_t off; + for_each_combData(off, ld) { + MemMove(ld->combData[off]); + } + }); + LineClrWrapped(ld); + } ClearCells(xw, 0, n, row, (last - (int) n)); - ScrnClrWrapped(screen, row); -#undef Source -#undef Target +#undef MemMove } /* @@ -943,6 +1260,7 @@ ScrnRefresh(XtermWidget xw, Bool force) /* ... leading/trailing spaces */ { TScreen *screen = &(xw->screen); + LineData *ld; int y = toprow * FontHeight(screen) + screen->border; int row; int maxrow = toprow + nrows - 1; @@ -954,7 +1272,7 @@ ScrnRefresh(XtermWidget xw, #endif static int recurse = 0; - TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s\n", + TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s {{\n", toprow, leftcol, nrows, ncols, force ? " force" : "")); @@ -967,28 +1285,14 @@ ScrnRefresh(XtermWidget xw, for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { #if OPT_ISO_COLORS -#if OPT_EXT_COLORS - Char *fbf = 0; - Char *fbb = 0; -#define ColorOf(col) (unsigned) ((fbf[col] << 8) | fbb[col]) -#else - Char *fb = 0; -#define ColorOf(col) (unsigned) (fb[col]) -#endif -#endif -#if OPT_DEC_CHRSET - Char *cb = 0; + CellColor *fb = 0; +#define ColorOf(col) fb[col] #endif #if OPT_WIDE_CHARS int wideness = 0; - Char *widec = 0; -#define WIDEC_PTR(cell) widec ? &widec[cell] : 0 -#define BLANK_CEL(cell) ((chars[cell] == ' ') && (widec == 0 || widec[cell] == 0)) -#else -#define BLANK_CEL(cell) (chars[cell] == ' ') #endif - Char cs = 0; - Char *chars; +#define BLANK_CEL(cell) (chars[cell] == ' ') + IChar *chars; Char *attrs; int col = leftcol; int maxcol = leftcol + ncols - 1; @@ -996,33 +1300,36 @@ ScrnRefresh(XtermWidget xw, int lastind; unsigned flags; unsigned test; - unsigned fg_bg = 0, fg = 0, bg = 0; + CellColor fg_bg = 0; + unsigned fg = 0, bg = 0; int x; GC gc; Bool hilite; (void) fg; (void) bg; +#if !OPT_ISO_COLORS + fg_bg = 0; +#endif if (row < screen->top_marg || row > screen->bot_marg) lastind = row; else lastind = row - scrollamt; - TRACE(("ScrnRefresh row=%d lastind=%d/%d\n", row, lastind, max)); + TRACE2(("ScrnRefresh row=%d lastind=%d/%d\n", row, lastind, max)); if (lastind < 0 || lastind > max) continue; - chars = SCRN_BUF_CHARS(screen, ROW2INX(screen, lastind)); - attrs = SCRN_BUF_ATTRS(screen, ROW2INX(screen, lastind)); - - if_OPT_DEC_CHRSET({ - cb = SCRN_BUF_CSETS(screen, ROW2INX(screen, lastind)); - }); + if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0) + break; + if (maxcol >= ld->lineSize) { + maxcol = ld->lineSize - 1; + hi_col = maxcol; + } - if_OPT_WIDE_CHARS(screen, { - widec = SCRN_BUF_WIDEC(screen, ROW2INX(screen, lastind)); - }); + chars = ld->charData; + attrs = ld->attribs; if_OPT_WIDE_CHARS(screen, { /* This fixes an infinite recursion bug, that leads @@ -1032,8 +1339,8 @@ ScrnRefresh(XtermWidget xw, /* adjust to redraw all of a widechar if we just wanted to draw the right hand half */ if (leftcol > 0 && - (PACK_PAIR(chars, widec, leftcol)) == HIDDEN_CHAR && - isWide(PACK_PAIR(chars, widec, leftcol - 1))) { + chars[leftcol] == HIDDEN_CHAR && + isWide((int) chars[leftcol - 1])) { leftcol--; ncols++; col = leftcol; @@ -1051,7 +1358,7 @@ ScrnRefresh(XtermWidget xw, * Temporarily change dimensions to double-sized characters so * we can reuse the recursion on this function. */ - if (CSET_DOUBLE(*cb)) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { col /= 2; maxcol /= 2; } @@ -1069,7 +1376,7 @@ ScrnRefresh(XtermWidget xw, maxcol--; } #if OPT_DEC_CHRSET - if (CSET_DOUBLE(*cb)) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { col *= 2; maxcol *= 2; } @@ -1125,31 +1432,20 @@ ScrnRefresh(XtermWidget xw, * right units. */ if_OPT_DEC_CHRSET({ - if (CSET_DOUBLE(*cb)) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { col /= 2; maxcol /= 2; } - cs = cb[col]; }); flags = attrs[col]; -#if OPT_WIDE_CHARS - if (widec) - wideness = isWide(PACK_PAIR(chars, widec, col)); - else - wideness = 0; -#endif - if_OPT_EXT_COLORS(screen, { - fbf = SCRN_BUF_FGRND(screen, ROW2INX(screen, lastind)); - fbb = SCRN_BUF_BGRND(screen, ROW2INX(screen, lastind)); - fg_bg = ColorOf(col); - /* this combines them, then splits them again. but - extract_fg does more, so seems reasonable */ - fg = extract_fg(xw, fg_bg, flags); - bg = extract_bg(xw, fg_bg, flags); + + if_OPT_WIDE_CHARS(screen, { + wideness = isWide((int) chars[col]); }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - fb = SCRN_BUF_COLOR(screen, ROW2INX(screen, lastind)); + + if_OPT_ISO_COLORS(screen, { + fb = ld->color; fg_bg = ColorOf(col); fg = extract_fg(xw, fg_bg, flags); bg = extract_bg(xw, fg_bg, flags); @@ -1158,7 +1454,7 @@ ScrnRefresh(XtermWidget xw, gc = updatedXtermGC(xw, flags, fg_bg, hilite); gc_changes |= (flags & (FG_COLOR | BG_COLOR)); - x = CurCursorX(screen, ROW2INX(screen, row), col); + x = LineCursorX(screen, ld, col); lastind = col; for (; col <= maxcol; col++) { @@ -1171,59 +1467,46 @@ ScrnRefresh(XtermWidget xw, && (extract_bg(xw, ColorOf(col), attrs[col]) != bg)) #endif #if OPT_WIDE_CHARS - || (widec - && ((isWide(PACK_PAIR(chars, widec, col))) != wideness) - && !((PACK_PAIR(chars, widec, col)) == HIDDEN_CHAR)) -#endif -#if OPT_DEC_CHRSET - || (cb[col] != cs) + || (isWide((int) chars[col]) != wideness + && chars[col] != HIDDEN_CHAR) #endif ) { assert(col >= lastind); TRACE(("ScrnRefresh looping drawXtermText %d..%d:%s\n", lastind, col, - visibleChars(PAIRED_CHARS(&chars[lastind], - WIDEC_PTR(lastind)), - (unsigned) (col - lastind)))); + visibleIChars((&chars[lastind]), + (unsigned) (col - lastind)))); test = flags; checkVeryBoldColors(test, fg); x = drawXtermText(xw, test & DRAWX_MASK, gc, x, y, - cs, - PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), + GetLineDblCS(ld), + &chars[lastind], (unsigned) (col - lastind), 0); if_OPT_WIDE_CHARS(screen, { int i; - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - Char *com_lo = BUFFER_PTR(screen->visbuf, - ROW2INX(screen, row), - off + 0); - Char *com_hi = BUFFER_PTR(screen->visbuf, - ROW2INX(screen, row), - off + 1); + size_t off; + + for_each_combData(off, ld) { + IChar *com_off = ld->combData[off]; + for (i = lastind; i < col; i++) { - int my_x = CurCursorX(screen, - ROW2INX(screen, row), - i); - int base = PACK_PAIR(chars, widec, i); - int combo = PACK_PAIR(com_lo, com_hi, i); - - if (isWide(base)) - my_x = CurCursorX(screen, - ROW2INX(screen, row), - i - 1); - - if (combo != 0) + int my_x = LineCursorX(screen, ld, i); + IChar base = chars[i]; + + if (isWide((int) base)) + my_x = LineCursorX(screen, ld, i - 1); + + if (com_off[i] != 0) drawXtermText(xw, (test & DRAWX_MASK) | NOBACKGROUND, - gc, my_x, y, cs, - PAIRED_CHARS(com_lo + i, - com_hi + i), - 1, isWide(base)); + gc, my_x, y, + GetLineDblCS(ld), + com_off + i, + 1, isWide((int) base)); } } }); @@ -1236,79 +1519,58 @@ ScrnRefresh(XtermWidget xw, hilite = False; flags = attrs[col]; - if_OPT_EXT_COLORS(screen, { - fg_bg = ColorOf(col); - fg = extract_fg(xw, fg_bg, flags); - bg = extract_bg(xw, fg_bg, flags); - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { + if_OPT_ISO_COLORS(screen, { fg_bg = ColorOf(col); fg = extract_fg(xw, fg_bg, flags); bg = extract_bg(xw, fg_bg, flags); }); - if_OPT_DEC_CHRSET({ - cs = cb[col]; + if_OPT_WIDE_CHARS(screen, { + wideness = isWide((int) chars[col]); }); -#if OPT_WIDE_CHARS - if (widec) - wideness = isWide(PACK_PAIR(chars, widec, col)); -#endif gc = updatedXtermGC(xw, flags, fg_bg, hilite); gc_changes |= (flags & (FG_COLOR | BG_COLOR)); } if (chars[col] == 0) { -#if OPT_WIDE_CHARS - if (widec == 0 || widec[col] == 0) -#endif - chars[col] = ' '; + chars[col] = ' '; } } assert(col >= lastind); TRACE(("ScrnRefresh calling drawXtermText %d..%d:%s\n", lastind, col, - visibleChars(PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), - (unsigned) (col - lastind)))); + visibleIChars(&chars[lastind], (unsigned) (col - lastind)))); test = flags; checkVeryBoldColors(test, fg); drawXtermText(xw, test & DRAWX_MASK, gc, x, y, - cs, - PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), + GetLineDblCS(ld), + &chars[lastind], (unsigned) (col - lastind), 0); if_OPT_WIDE_CHARS(screen, { int i; - int off; - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - Char *com_lo = BUFFER_PTR(screen->visbuf, - ROW2INX(screen, row), - off + 0); - Char *com_hi = BUFFER_PTR(screen->visbuf, - ROW2INX(screen, row), - off + 1); + size_t off; + + for_each_combData(off, ld) { + IChar *com_off = ld->combData[off]; + for (i = lastind; i < col; i++) { - int my_x = CurCursorX(screen, - ROW2INX(screen, row), - i); - int base = PACK_PAIR(chars, widec, i); - int combo = PACK_PAIR(com_lo, com_hi, i); + int my_x = LineCursorX(screen, ld, i); + int base = (int) chars[i]; if (isWide(base)) - my_x = CurCursorX(screen, - ROW2INX(screen, row), - i - 1); + my_x = LineCursorX(screen, ld, i - 1); - if (combo != 0) + if (com_off[i] != 0) drawXtermText(xw, (test & DRAWX_MASK) | NOBACKGROUND, - gc, my_x, y, cs, - PAIRED_CHARS(com_lo + i, - com_hi + i), + gc, my_x, y, + GetLineDblCS(ld), + com_off + i, 1, isWide(base)); } } @@ -1342,6 +1604,9 @@ ScrnRefresh(XtermWidget xw, } #endif recurse--; + + TRACE(("...}} ScrnRefresh\n")); + return; } /* @@ -1381,11 +1646,12 @@ ClearBufRows(XtermWidget xw, TRACE(("ClearBufRows %d..%d\n", first, last)); for (row = first; row <= last; row++) { + LineData *ld = getLineData(screen, ROW2INX(screen, row)); if_OPT_DEC_CHRSET({ /* clearing the whole row resets the doublesize characters */ - SCRN_ROW_CSET(screen, row) = CSET_SWL; + SetLineDblCS(ld, CSET_SWL); }); - ScrnClrWrapped(screen, row); + LineClrWrapped(ld); ClearCells(xw, 0, len, row, 0); } } @@ -1458,35 +1724,252 @@ ScreenResize(XtermWidget xw, /* update buffers if the screen has changed size */ if (MaxRows(screen) != rows || MaxCols(screen) != cols) { - int savelines = (screen->scrollWidget - ? screen->savelines - : 0); int delta_rows = rows - MaxRows(screen); +#if OPT_TRACE + int delta_cols = cols - MaxCols(screen); +#endif - TRACE(("...ScreenResize chars %dx%d\n", rows, cols)); + TRACE(("...ScreenResize chars %dx%d delta %dx%d\n", + rows, cols, delta_rows, delta_cols)); if (screen->is_running) { +#if !OPT_FIFO_LINES + int savelines = (screen->scrollWidget + ? screen->savelines + : 0); +#endif if (screen->cursor_state) HideCursor(); - if (screen->alternate - && xw->misc.resizeGravity == SouthWestGravity) +#if OPT_SAVE_LINES + /* + * The non-visible buffer is simple, since we will not copy data + * to/from the saved-lines. Do that first. + */ + if (screen->editBuf_index[!screen->whichBuf]) { + (void) Reallocate(xw, + &screen->editBuf_index[!screen->whichBuf], + &screen->editBuf_data[!screen->whichBuf], + (unsigned) rows, + (unsigned) cols, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); + } + + /* + * The save-lines buffer may change width, but will not change its + * height. Deal with the cases where we copy data to/from the + * saved-lines buffer. + */ + if (GravityIsSouthWest(xw) + && delta_rows + && screen->saveBuf_index != 0) { + + move_down_by = delta_rows; + + if (delta_rows < 0) { + unsigned move_up = (unsigned) (-delta_rows); + ScrnBuf dst = screen->saveBuf_index; + +#if OPT_FIFO_LINES + int amount = ((MaxRows(screen) - (int) move_up - 1) + - screen->cur_row); + + if (amount < 0) { + /* move line-data from visible-buffer to save-buffer */ + saveEditBufLines(screen, dst, -amount); + move_up = -amount; + move_down_by = amount; + } else { + move_down_by = 0; + } +#else /* !OPT_FIFO_LINES */ + int amount = screen->savelines - (int) move_up; + + TRACE_SCRNBUF("before save", screen, dst, screen->savelines); + + /* shift lines in save-buffer to make room */ + TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n", + (amount > 0 + ? "" + : "SKIP "), + screen->savelines, + move_up)); + if (amount > 0) { + SaveLineData(dst, 0, move_up); + + MoveLineData(dst, + 0, + move_up, + (unsigned) amount); + + TRACE(("...reuse %d lines storage in saveBuf\n", move_up)); + RestoreLineData(dst, + (unsigned) amount, + move_up); + TRACE_SCRNBUF("restoresave", screen, dst, screen->savelines); + } + + /* copy line-data from visible-buffer to save-buffer */ + saveEditBufLines(screen, dst, move_up); + + /* after data is copied, reallocate saved-lines */ + (void) Reallocate(xw, + &screen->saveBuf_index, + &screen->saveBuf_data, + (unsigned) savelines, + (unsigned) cols, + (unsigned) savelines, + (unsigned) MaxCols(screen)); + TRACE_SCRNBUF("reallocSAVE", + screen, + screen->saveBuf_index, + savelines); +#endif /* OPT_FIFO_LINES */ + + /* decrease size of visible-buffer */ + (void) Reallocate(xw, + &screen->editBuf_index[screen->whichBuf], + &screen->editBuf_data[screen->whichBuf], + (unsigned) rows, + (unsigned) cols, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); + TRACE_SCRNBUF("reallocEDIT", + screen, + screen->editBuf_index[screen->whichBuf], + rows); + } else { + unsigned move_down = (unsigned) delta_rows; +#if OPT_FIFO_LINES + long unsave_fifo; +#else + ScrnBuf src = screen->saveBuf_index; +#endif + ScrnBuf dst; + int amount; + + if ((int) move_down > screen->savedlines) { + move_down = (unsigned) screen->savedlines; + } + move_down_by = (int) move_down; + amount = rows - (int) move_down; + + /* increase size of visible-buffer */ + (void) Reallocate(xw, + &screen->editBuf_index[screen->whichBuf], + &screen->editBuf_data[screen->whichBuf], + (unsigned) rows, + (unsigned) cols, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); + + dst = screen->editBuf_index[screen->whichBuf]; + TRACE_SCRNBUF("reallocEDIT", screen, dst, rows); + + TRACE(("...%smoving pointers in editBuf (compare %d %d)\n", + (amount > 0 + ? "" + : "SKIP "), + rows, + move_down)); + if (amount > 0) { + /* shift lines in visible-buffer to make room */ + SaveLineData(dst, (unsigned) amount, (size_t) move_down); + + MoveLineData(dst, + move_down, + 0, + (unsigned) amount); + + TRACE(("...reuse %d lines storage in editBuf\n", move_down)); + RestoreLineData(dst, + 0, + move_down); + + TRACE_SCRNBUF("shifted", screen, dst, rows); + } + + /* copy line-data from save-buffer to visible-buffer */ + unsaveEditBufLines(screen, dst, move_down); + TRACE_SCRNBUF("copied", screen, dst, rows); + +#if OPT_FIFO_LINES + unsave_fifo = (long) move_down; + if (screen->saved_fifo < (int) unsave_fifo) + unsave_fifo = screen->saved_fifo; + + /* free up storage in fifo from the copied lines */ + while (unsave_fifo-- > 0) { + deleteScrollback(screen, -1); + screen->saved_fifo--; + } +#else + amount = (screen->savelines - (int) move_down); + TRACE(("...%smoving pointers in saveBuf (compare %d %d)\n", + (amount > 0 + ? "" + : "SKIP "), + rows, + move_down)); + if (amount > 0) { + /* shift lines in save-buffer to account for copy */ + src = screen->saveBuf_index; + SaveLineData(src, amount, move_down); + + MoveLineData(src, + move_down, + 0, + (unsigned) amount); + + TRACE(("...reuse %d lines storage in saveBuf\n", move_down)); + RestoreLineData(src, + 0, + move_down); + } +#endif + + /* recover storage in save-buffer */ + } + } else { +#if !OPT_FIFO_LINES + (void) Reallocate(xw, + &screen->saveBuf_index, + &screen->saveBuf_data, + (unsigned) savelines, + (unsigned) cols, + (unsigned) savelines, + (unsigned) MaxCols(screen)); +#endif + (void) Reallocate(xw, + &screen->editBuf_index[screen->whichBuf], + &screen->editBuf_data[screen->whichBuf], + (unsigned) rows, + (unsigned) cols, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); + } +#else /* !OPT_SAVE_LINES */ + if (screen->whichBuf + && GravityIsSouthWest(xw)) /* swap buffer pointers back to make this work */ SwitchBufPtrs(screen); - if (screen->altbuf) + if (screen->editBuf_index[1]) (void) Reallocate(xw, - &screen->altbuf, - &screen->abuf_address, - rows, - cols, - MaxRows(screen), - MaxCols(screen)); + &screen->editBuf_index[1], + &screen->editBuf_data[1], + (unsigned) rows, + (unsigned) cols, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen)); move_down_by = Reallocate(xw, - &screen->allbuf, - &screen->sbuf_address, - rows + savelines, cols, - MaxRows(screen) + savelines, - MaxCols(screen)); - screen->visbuf = &screen->allbuf[MAX_PTRS * savelines]; + &screen->saveBuf_index, + &screen->saveBuf_data, + (unsigned) (rows + savelines), + (unsigned) cols, + (unsigned) (MaxRows(screen) + savelines), + (unsigned) MaxCols(screen)); +#endif /* OPT_SAVE_LINES */ + screen->visbuf = VisBuf(screen); } AdjustSavedCursor(xw, move_down_by); @@ -1494,7 +1977,7 @@ ScreenResize(XtermWidget xw, set_max_col(screen, cols - 1); if (screen->is_running) { - if (xw->misc.resizeGravity == SouthWestGravity) { + if (GravityIsSouthWest(xw)) { screen->savedlines -= move_down_by; if (screen->savedlines < 0) screen->savedlines = 0; @@ -1506,7 +1989,7 @@ ScreenResize(XtermWidget xw, screen->cursorp.row += move_down_by; ScrollSelection(screen, move_down_by, True); - if (screen->alternate) + if (screen->whichBuf) SwitchBufPtrs(screen); /* put the pointers back */ } } @@ -1593,25 +2076,19 @@ non_blank_line(TScreen * screen, int col, int len) { - ScrnBuf sb = screen->visbuf; int i; - Char *ptr = BUF_CHARS(sb, row); - - for (i = col; i < len; i++) { - if (ptr[i]) - return True; - } - - if_OPT_WIDE_CHARS(screen, { - if ((ptr = BUF_WIDEC(sb, row)) != 0) { - for (i = col; i < len; i++) { - if (ptr[i]) - return True; + Bool found = False; + LineData *ld = getLineData(screen, row); + + if (ld != 0) { + for (i = col; i < len; i++) { + if (ld->charData[i]) { + found = True; + break; } } - }); - - return False; + } + return found; } /* @@ -1705,14 +2182,19 @@ ScrnFillRectangle(XtermWidget xw, TRACE(("filling rectangle with '%c' flags %#x\n", value, flags)); if (validRect(xw, target)) { + LineData *ld; unsigned left = (unsigned) (target->left - 1); unsigned size = (unsigned) (target->right - (int) left); unsigned attrs = flags; int row, col; + (void) size; + attrs &= ATTRIBUTES; attrs |= CHARDRAWN; for (row = target->bottom - 1; row >= (target->top - 1); row--) { + ld = getLineData(screen, row); + TRACE(("filling %d [%d..%d]\n", row, left, left + size)); /* @@ -1720,31 +2202,30 @@ ScrnFillRectangle(XtermWidget xw, * colors if asked. */ for (col = (int) left; col < target->right; ++col) { - unsigned temp = SCRN_BUF_ATTRS(screen, row)[col]; + unsigned temp = ld->attribs[col]; + if (!keepColors) { temp &= ~(FG_COLOR | BG_COLOR); } temp = attrs | (temp & (FG_COLOR | BG_COLOR | PROTECTED)); temp |= CHARDRAWN; - SCRN_BUF_ATTRS(screen, row)[col] = (Char) temp; + ld->attribs[col] = (Char) temp; #if OPT_ISO_COLORS if (attrs & (FG_COLOR | BG_COLOR)) { - if_OPT_EXT_COLORS(screen, { - SCRN_BUF_FGRND(screen, row)[col] = (Char) xw->sgr_foreground; - SCRN_BUF_BGRND(screen, row)[col] = (Char) xw->cur_background; - }); - if_OPT_ISO_TRADITIONAL_COLORS(screen, { - SCRN_BUF_COLOR(screen, row)[col] = xtermColorPair(xw); + if_OPT_ISO_COLORS(screen, { + ld->color[col] = xtermColorPair(xw); }); } #endif } - memset(SCRN_BUF_CHARS(screen, row) + left, (Char) value, size); + for (col = (int) left; col < target->right; ++col) + ld->charData[col] = (CharData) value; + if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_WIDEC; off < MAX_PTRS; ++off) { - memset(SCREEN_PTR(screen, row, off) + left, 0, size); + size_t off; + for_each_combData(off, ld) { + memset(ld->combData[off] + left, 0, size * sizeof(IChar)); } }) } @@ -1782,50 +2263,60 @@ ScrnCopyRectangle(XtermWidget xw, XTermRect * source, int nparam, int *params) params, &target); if (validRect(xw, &target)) { - int high = (source->bottom - source->top) + 1; - int wide = (source->right - source->left) + 1; - unsigned size = (unsigned) (high * wide * MAX_PTRS); - int row, col, n, j; - - Char *cells = TypeMallocN(Char, size); - - if (cells == 0) - return; - - TRACE(("OK - make copy %dx%d\n", high, wide)); - target.bottom = target.top + (high - 1); - target.right = target.left + (wide - 1); - - for (row = source->top - 1; row < source->bottom; ++row) { - for (col = source->left - 1; col < source->right; ++col) { - n = (((1 + row - source->top) * wide) - + (1 + col - source->left)) * MAX_PTRS; - for (j = OFF_ATTRS; j < MAX_PTRS; ++j) - cells[n + j] = SCREEN_PTR(screen, row, j)[col]; + Cardinal high = (Cardinal) (source->bottom - source->top) + 1; + Cardinal wide = (Cardinal) (source->right - source->left) + 1; + Cardinal size = (high * wide); + int row, col; + Cardinal j, k; + LineData *ld; + + CellData *cells = newCellData(xw, size); + + if (cells != 0) { + + TRACE(("OK - make copy %dx%d\n", high, wide)); + target.bottom = target.top + (int) (high - 1); + target.right = target.left + (int) (wide - 1); + + for (row = source->top - 1; row < source->bottom; ++row) { + ld = getLineData(screen, row); + j = (Cardinal) (row - (source->top - 1)); + for (col = source->left - 1; col < source->right; ++col) { + k = (Cardinal) (col - (source->left - 1)); + saveCellData(screen, cells, + (j * wide) + k, + ld, col); + } } - } - for (row = target.top - 1; row < target.bottom; ++row) { - for (col = target.left - 1; col < target.right; ++col) { - if (row >= getMinRow(screen) - && row <= getMaxRow(screen) - && col >= getMinCol(screen) - && col <= getMaxCol(screen)) { - n = (((1 + row - target.top) * wide) - + (1 + col - target.left)) * MAX_PTRS; - for (j = OFF_ATTRS; j < MAX_PTRS; ++j) - SCREEN_PTR(screen, row, j)[col] = cells[n + j]; - SCRN_BUF_ATTRS(screen, row)[col] |= CHARDRAWN; + for (row = target.top - 1; row < target.bottom; ++row) { + ld = getLineData(screen, row); + j = (Cardinal) (row - (target.top - 1)); + for (col = target.left - 1; col < target.right; ++col) { + k = (Cardinal) (col - (target.left - 1)); + if (row >= getMinRow(screen) + && row <= getMaxRow(screen) + && col >= getMinCol(screen) + && col <= getMaxCol(screen)) { + if (j < high && k < wide) { + restoreCellData(screen, cells, + (j * wide) + k, + ld, col); + } else { + /* FIXME - clear the target cell? */ + } + ld->attribs[col] |= CHARDRAWN; + } } } + free(cells); + + ScrnUpdate(xw, + (target.top - 1), + (target.left - 1), + (target.bottom - target.top) + 1, + ((target.right - target.left) + 1), + False); } - free(cells); - - ScrnUpdate(xw, - (target.top - 1), - (target.left - 1), - (target.bottom - target.top) + 1, - ((target.right - target.left) + 1), - False); } } } @@ -1856,6 +2347,7 @@ ScrnMarkRectangle(XtermWidget xw, : "region"))); if (validRect(xw, target)) { + LineData *ld; int top = target->top - 1; int bottom = target->bottom - 1; int row, col; @@ -1869,9 +2361,11 @@ ScrnMarkRectangle(XtermWidget xw, ? (target->right - 1) : getMaxCol(screen)); + ld = getLineData(screen, row); + TRACE(("marking %d [%d..%d]\n", row, left, right)); for (col = left; col <= right; ++col) { - unsigned flags = SCRN_BUF_ATTRS(screen, row)[col]; + unsigned flags = ld->attribs[col]; for (n = 0; n < nparam; ++n) { #if OPT_TRACE @@ -1937,9 +2431,9 @@ ScrnMarkRectangle(XtermWidget xw, #if OPT_TRACE if (row == top && col == left) TRACE(("first mask-change is %#x\n", - SCRN_BUF_ATTRS(screen, row)[col] ^ flags)); + ld->attribs[col] ^ flags)); #endif - SCRN_BUF_ATTRS(screen, row)[col] = (Char) flags; + ld->attribs[col] = (Char) flags; } } ScrnRefresh(xw, @@ -1966,6 +2460,7 @@ ScrnWipeRectangle(XtermWidget xw, TRACE(("wiping rectangle\n")); if (validRect(xw, target)) { + LineData *ld; int top = target->top - 1; int bottom = target->bottom - 1; int row, col; @@ -1975,15 +2470,17 @@ ScrnWipeRectangle(XtermWidget xw, int right = (target->right - 1); TRACE(("wiping %d [%d..%d]\n", row, left, right)); + + ld = getLineData(screen, row); for (col = left; col <= right; ++col) { if (!((screen->protected_mode == DEC_PROTECT) - && (SCRN_BUF_ATTRS(screen, row)[col] & PROTECTED))) { - SCRN_BUF_ATTRS(screen, row)[col] |= CHARDRAWN; - SCRN_BUF_CHARS(screen, row)[col] = ' '; + && (ld->attribs[col] & PROTECTED))) { + ld->attribs[col] |= CHARDRAWN; + ld->charData[col] = ' '; if_OPT_WIDE_CHARS(screen, { - int off; - for (off = OFF_WIDEC; off < MAX_PTRS; ++off) { - memset(SCREEN_PTR(screen, row, off) + col, 0, 1); + size_t off; + for_each_combData(off, ld) { + ld->combData[off][col] = '\0'; } }) } diff --git a/app/xterm/scrollback.c b/app/xterm/scrollback.c new file mode 100644 index 000000000..a828c8cf4 --- /dev/null +++ b/app/xterm/scrollback.c @@ -0,0 +1,118 @@ +/* $XTermId: scrollback.c,v 1.11 2009/08/06 08:34:30 tom Exp $ */ + +/************************************************************ + +Copyright 2009 by Thomas E. Dickey + + All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + +********************************************************/ + +#include <xterm.h> + +#define ROW2FIFO(screen, row) \ + (unsigned) (((row) + 1 + (screen)->saved_fifo) % (screen)->savelines) + +/* + * Given a row-number, find the corresponding data for the line in the VT100 + * widget's saved-line FIFO. The row-number (from getLineData) is negative. + * So we just count backwards from the last saved line. + */ +LineData * +getScrollback(TScreen * screen, int row) +{ + unsigned which = ROW2FIFO(screen, row); + ScrnBuf where = scrnHeadAddr(screen, screen->saveBuf_index, which); + + TRACE(("getScrollback %d -> %d -> %p\n", row, which, where)); + return (LineData *) where; +} + +/* + * Allocate a new row in the scrollback FIFO, returning a pointer to it. + */ +LineData * +addScrollback(TScreen * screen) +{ + ScrnBuf where = 0; + unsigned which; + unsigned ncols = (unsigned) MaxCols(screen); + Char *block; + + if (screen->saveBuf_index != 0) { + screen->saved_fifo++; + TRACE(("addScrollback %lu\n", screen->saved_fifo)); + + /* first, see which index we'll use */ + which = (unsigned) (screen->saved_fifo % screen->savelines); + where = scrnHeadAddr(screen, screen->saveBuf_index, which); + + /* discard any obsolete index data */ + if (screen->saved_fifo > screen->savelines) { + LineData *prior = (LineData *) where; + /* + * setupLineData uses the attribs as the first address used from the + * data block. + */ + if (prior->attribs != 0) { + TRACE(("...freeing prior FIFO data in slot %d: %p->%p\n", + which, prior, prior->attribs)); + free(prior->attribs); + prior->attribs = 0; + } + } + + /* allocate the new data */ + block = allocScrnData(screen, 1, ncols); + + /* record the new data in the index */ + setupLineData(screen, where, (Char *) block, 1, ncols); + + TRACE(("...storing new FIFO data in slot %d: %p->%p\n", + which, where, block)); + + } + return (LineData *) where; +} + +void +deleteScrollback(TScreen * screen, int row) +{ + unsigned which = ROW2FIFO(screen, row); + ScrnBuf where = scrnHeadAddr(screen, screen->saveBuf_index, which); + LineData *prior = (LineData *) where; + /* + * setupLineData uses the attribs as the first address used from the + * data block. + */ + if (prior->attribs != 0) { + TRACE(("...freeing prior FIFO data in slot %d: %p->%p\n", + which, prior, prior->attribs)); + free(prior->attribs); + prior->attribs = 0; + } +} diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c index db65015d3..85ce15065 100644 --- a/app/xterm/scrollbar.c +++ b/app/xterm/scrollbar.c @@ -1,6 +1,4 @@ -/* $XTermId: scrollbar.c,v 1.139 2009/02/12 00:07:53 tom Exp $ */ - -/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.48 2006/02/13 01:14:59 dickey Exp $ */ +/* $XTermId: scrollbar.c,v 1.143 2009/08/09 17:23:47 tom Exp $ */ /* * Copyright 2000-2008,2009 by Thomas E. Dickey @@ -399,15 +397,14 @@ updateRightScrollbar(XtermWidget xw) #endif void -ScrollBarOn(XtermWidget xw, int init, int doalloc) +ScrollBarOn(XtermWidget xw, Bool init) { TScreen *screen = TScreenOf(xw); - int i, j, k; if (screen->fullVwin.sb_info.width || IsIcon(screen)) return; - TRACE(("ScrollBarOn\n")); + TRACE(("ScrollBarOn(init %s)\n", BtoS(init))); if (init) { /* then create it only */ if (screen->scrollWidget == 0) { /* make it a dummy size and resize later */ @@ -424,31 +421,6 @@ ScrollBarOn(XtermWidget xw, int init, int doalloc) Bell(XkbBI_MinorError, 0); } else { - if (doalloc && screen->allbuf) { - /* FIXME: this is not integrated well with Allocate */ - if ((screen->allbuf = - TypeRealloc(ScrnPtr, - (unsigned) (MAX_PTRS - * (screen->max_row + 2 - + screen->savelines)), - screen->visbuf)) == NULL) { - SysError(ERROR_SBRALLOC); - } - screen->visbuf = &screen->allbuf[MAX_PTRS * screen->savelines]; - memmove((char *) screen->visbuf, (char *) screen->allbuf, - (unsigned) (MAX_PTRS * (screen->max_row + 2)) - * sizeof(char *)); - for (i = k = 0; i < screen->savelines; i++) { - k += BUF_HEAD; - for (j = BUF_HEAD; j < MAX_PTRS; j++) { - if ((screen->allbuf[k++] = - TypeCallocN(Char, (unsigned) MaxCols(screen)) - ) == NULL) - SysError(ERROR_SBRALLOC2); - } - } - } - ResizeScrollBar(xw); xtermAddInput(screen->scrollWidget); XtRealizeWidget(screen->scrollWidget); @@ -518,7 +490,7 @@ ToggleScrollBar(XtermWidget xw) if (screen->fullVwin.sb_info.width) { ScrollBarOff(xw); } else { - ScrollBarOn(xw, False, False); + ScrollBarOn(xw, False); } update_scrollbar(); TRACE(("...ToggleScrollBar}}\n")); diff --git a/app/xterm/tabs.c b/app/xterm/tabs.c index d4186e127..98732faa4 100644 --- a/app/xterm/tabs.c +++ b/app/xterm/tabs.c @@ -1,11 +1,7 @@ -/* $XTermId: tabs.c,v 1.33 2008/12/30 10:18:14 tom Exp $ */ +/* $XTermId: tabs.c,v 1.36 2009/06/21 14:34:17 tom Exp $ */ /* - * $XFree86: xc/programs/xterm/tabs.c,v 3.14 2006/02/13 01:14:59 dickey Exp $ - */ - -/* - * Copyright 2000-2006,2008 by Thomas E. Dickey + * Copyright 2000-2008,2009 by Thomas E. Dickey * * All Rights Reserved * @@ -150,7 +146,7 @@ TabToNextStop(XtermWidget xw) TScreen *screen = &(xw->screen); int saved_column = screen->cur_col; int next = TabNext(xw, xw->tabs, screen->cur_col); - int max = CurMaxCol(screen, screen->cur_row); + int max = LineMaxCol(screen, getLineData(screen, screen->cur_row)); if (next > max) next = max; diff --git a/app/xterm/termcap b/app/xterm/termcap index 982a638d3..228704896 100644 --- a/app/xterm/termcap +++ b/app/xterm/termcap @@ -1,13 +1,11 @@ -# $XTermId: termcap,v 1.72 2006/07/05 22:04:17 tom Exp $ -# -# $XFree86: xc/programs/xterm/termcap,v 3.38 2006/02/13 01:14:59 dickey Exp $ +# $XTermId: termcap,v 1.76 2009/07/19 15:54:13 tom Exp $ # # These are termcap entries that correspond to xterm's terminfo file. # The file is formatted using ncurses' "tic -CNx", but is not mechanically # derived from the terminfo. # #------------------------------------------------------------------------------ -# Copyright 1996-2005,2006 by Thomas E. Dickey +# Copyright 1996-2007,2009 by Thomas E. Dickey # # All Rights Reserved # @@ -40,8 +38,8 @@ # termcap format is limited to 1023 characters. This set of descriptions # is a subset of the terminfo, since not all features can be fit into # that limit. The 'xterm' description supports color. The monochrome -# 'xtermm' drops color in favor of additional function keys. If you need -# both, use terminfo. +# 'xterm-mono' drops color in favor of additional function keys. If you +# need both, use terminfo. # # The 1023-character limit applies to each entry after resolving the # "tc=" strings. Some implementations may discount all or part of the @@ -52,10 +50,10 @@ # the resolved length of each entry in a comment at the end - T.Dickey # xf|xterm-new|modern xterm:\ - :*6=\EOF:@7=\EOF:F1=\E[23~:F2=\E[24~:Km=\E[M:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:k;=\E[21~:kH=\EOF:kI=\E[2~:kN=\E[6~:\ - :kP=\E[5~:kd=\EOB:kh=\EOH:kl=\EOD:kr=\EOC:ku=\EOA:\ + :*6=\EOF:@7=\EOF:F1=\E[23~:F2=\E[24~:K2=\EOE:Km=\E[M:\ + :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\ + :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kH=\EOF:kI=\E[2~:\ + :kN=\E[6~:kP=\E[5~:kd=\EOB:kh=\EOH:kl=\EOD:kr=\EOC:ku=\EOA:\ :tc=xterm-basic: # # This chunk is used for building the VT220/Sun/PC keyboard variants. @@ -83,7 +81,7 @@ xb|xterm-basic|modern xterm common:\ # + uses DEC-style control sequences for the application keypad. # vt|xterm-vt220|xterm emulating vt220:\ - :*6=\E[4~:@7=\E[4~:Km=\E[M:kH=\E[4~:kh=\E[1~:\ + :*6=\E[4~:@7=\E[4~:K2=\EOu:Km=\E[M:kH=\E[4~:kh=\E[1~:\ :tc=xterm-basic: v1|xterm-24|xterms|vs100|24x80 xterm:\ @@ -140,8 +138,8 @@ x8|xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ :am:km:mi:ms:xn:\ :co#80:it#8:li#24:\ :AL=\233%dL:DC=\233%dP:DL=\233%dM:DO=\233%dB:IC=\233%d@:\ - :Km=\233M:LE=\233%dD:RI=\233%dC:UP=\233%dA:ae=\E(B:\ - :al=\233L:as=\E(0:bl=^G:bt=\233Z:cd=\233J:ce=\233K:\ + :K2=\217y:Km=\233M:LE=\233%dD:RI=\233%dC:UP=\233%dA:\ + :ae=\E(B:al=\233L:as=\E(0:bl=^G:bt=\233Z:cd=\233J:ce=\233K:\ :cl=\233H\2332J:cm=\233%i%d;%dH:cr=^M:cs=\233%i%d;%dr:\ :ct=\2333g:dc=\233P:dl=\233M:do=^J:ei=\2334l:ho=\233H:\ :im=\2334h:\ @@ -150,11 +148,11 @@ x8|xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ :k6=\23317~:k7=\23318~:k8=\23319~:k9=\23320~:kD=\2333~:\ :kI=\2332~:kN=\2336~:kP=\2335~:kb=^H:kd=\217B:\ :ke=\233?1l\E>:kh=\2331~:kl=\217D:kr=\217C:ks=\233?1h\E=:\ - :ku=\217A:le=^H:mb=\2335m:md=\2331m:me=\233m:\ - :mr=\2337m:nd=\233C:rc=\E8:sc=\E7:se=\23327m:sf=^J:\ - :so=\2337m:sr=\215:st=\210:ta=^I:te=\233?1049l:\ - :ti=\233?1049h:ue=\23324m:up=\233A:us=\2334m:\ - :vb=\233?5h\233?5l:ve=\233?25h:vi=\233?25l: + :ku=\217A:le=^H:mb=\2335m:md=\2331m:me=\233m:mr=\2337m:\ + :nd=\233C:rc=\E8:sc=\E7:se=\23327m:sf=^J:so=\2337m:sr=\215:\ + :st=\210:ta=^I:te=\233?1049l:ti=\233?1049h:ue=\23324m:\ + :up=\233A:us=\2334m:vb=\233?5h\233?5l:ve=\233?25h:\ + :vi=\233?25l: # hp|xterm-hp|xterm with hpterm function keys:\ :@7=\EF:k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:\ @@ -165,8 +163,8 @@ xS|xterm-sco|xterm with SCO function keys:\ :@7=\E[F:F1=\E[W:F2=\E[X:F3=\E[Y:F5=\E[a:F6=\E[b:F7=\E[c:\ :F8=\E[d:F9=\E[e:FA=\E[f:FB=\E[g:FC=\E[h:FD=\E[i:FE=\E[j:\ :FF=\E[k:ac=:k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:k5=\E[Q:\ - :k6=\E[R:k7=\E[S:k8=\E[T:k9=\E[U:k;=\E[V:kI=\E[L:kN=\E[G:\ - :kP=\E[I:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ + :k6=\E[R:k7=\E[S:k8=\E[T:k9=\E[U:k;=\E[V:kD=\177:kI=\E[L:\ + :kN=\E[G:kP=\E[I:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ :tc=xterm-basic: # v5|xterm-vt52|xterm emulating vt52:\ @@ -178,10 +176,11 @@ v5|xterm-vt52|xterm emulating vt52:\ # xs|xterm-sun|xterm with Sun functionkeys:\ :%1=\E[196z:&8=\E[195z:@0=\E[200z:@5=\E[197z:@7=\E[220z:\ - :F1=\E[192z:F2=\E[193z:Km=\E[M:k1=\E[224z:k2=\E[225z:\ - :k3=\E[226z:k4=\E[227z:k5=\E[228z:k6=\E[229z:k7=\E[230z:\ - :k8=\E[231z:k9=\E[232z:k;=\E[233z:kD=\177:kI=\E[2z:\ - :kN=\E[222z:kP=\E[216z:kh=\E[214z:tc=xterm-basic: + :F1=\E[192z:F2=\E[193z:K2=\E[218z:Km=\E[M:k1=\E[224z:\ + :k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:k6=\E[229z:\ + :k7=\E[230z:k8=\E[231z:k9=\E[232z:k;=\E[233z:kD=\E[3z:\ + :kI=\E[2z:kN=\E[222z:kP=\E[216z:kh=\E[214z:\ + :tc=xterm-basic: # # vi may work better with this entry, because vi doesn't use insert mode much. # |xterm-ic|xterm-vi|xterm with insert character instead of insert mode:\ @@ -203,7 +202,7 @@ r6|xterm-r6|xterm-old|X11R6 xterm:\ :is=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8:\ :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\ - :kD=\177:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:\ + :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:\ :ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ :ku=\EOA:md=\E[1m:me=\E[m:ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:\ :rc=\E8:rs=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8:\ diff --git a/app/xterm/testxmc.c b/app/xterm/testxmc.c index 1a116bc95..c275bb82f 100644 --- a/app/xterm/testxmc.c +++ b/app/xterm/testxmc.c @@ -1,8 +1,4 @@ -/* $XTermId: testxmc.c,v 1.35 2009/01/09 01:40:17 tom Exp $ */ - -/* - * $XFree86: xc/programs/xterm/testxmc.c,v 3.14 2006/02/13 01:14:59 dickey Exp $ - */ +/* $XTermId: testxmc.c,v 1.44 2009/06/21 15:37:04 tom Exp $ */ /************************************************************ @@ -165,7 +161,8 @@ Jump_XMC(XtermWidget xw) { TScreen *screen = &(xw->screen); if (!screen->move_sgr_ok - && screen->cur_col <= CurMaxCol(screen, screen->cur_row)) { + && screen->cur_col <= LineMaxCol(screen, + getLineData(screen, screen->cur_row))) { Mark_XMC(xw, -1); } } @@ -178,6 +175,7 @@ void Resolve_XMC(XtermWidget xw) { TScreen *screen = &(xw->screen); + LineData *ld; Bool changed = False; Char start; Char my_attrs = CharOf(screen->xmc_attributes & XMC_FLAGS); @@ -186,32 +184,33 @@ Resolve_XMC(XtermWidget xw) /* Find the preceding cell. */ + ld = getLineData(screen, row); if (XTERM_CELL(row, col) != XMC_GLITCH) { if (col != 0) { col--; } else if (!screen->xmc_inline && row != 0) { - row--; - col = CurMaxCol(screen, row); + ld = getLineData(screen, --row); + col = LineMaxCol(screen, ld); } } - start = (SCRN_BUF_ATTRS(screen, row)[col] & my_attrs); + start = (ld->attribs[col] & my_attrs); /* Now propagate the starting state until we reach a cell which holds * a glitch. */ for (;;) { - if (col < CurMaxCol(screen, row)) { + if (col < LineMaxCol(screen, ld)) { col++; } else if (!screen->xmc_inline && row < screen->max_row) { - row++; col = 0; + ld = getLineData(screen, ++row); } else break; if (XTERM_CELL(row, col) == XMC_GLITCH) break; - if ((SCRN_BUF_ATTRS(screen, row)[col] & my_attrs) != start) { - SCRN_BUF_ATTRS(screen, row)[col] = - CharOf(start | (SCRN_BUF_ATTRS(screen, row)[col] & ~my_attrs)); + if ((ld->attribs[col] & my_attrs) != start) { + ld->attribs[col] = + CharOf(start | (ld->attribs[col] & ~my_attrs)); changed = True; } } diff --git a/app/xterm/trace.c b/app/xterm/trace.c index 6e3e5dbfb..dd1694583 100644 --- a/app/xterm/trace.c +++ b/app/xterm/trace.c @@ -1,4 +1,4 @@ -/* $XTermId: trace.c,v 1.87 2009/03/23 20:08:03 tom Exp $ */ +/* $XTermId: trace.c,v 1.102 2009/07/03 13:57:08 tom Exp $ */ /************************************************************ @@ -109,6 +109,9 @@ Trace(const char *fmt,...) (void) fclose(fp); (void) fflush(stdout); (void) fflush(stderr); + (void) visibleChars(NULL, 0); + (void) visibleIChars(NULL, 0); + (void) visibleIChar(NULL, 0); } va_end(ap); } @@ -161,7 +164,7 @@ formatAscii(char *dst, unsigned value) #if OPT_DEC_CHRSET const char * -visibleChrsetName(int chrset) +visibleChrsetName(unsigned chrset) { const char *result = "?"; switch (chrset) { @@ -183,32 +186,64 @@ visibleChrsetName(int chrset) #endif char * -visibleChars(PAIRED_CHARS(Char * buf, Char * buf2), unsigned len) +visibleChars(Char * buf, unsigned len) { static char *result; static unsigned used; - unsigned limit = ((len + 1) * 8) + 1; - char *dst; - if (limit > used) { - used = limit; - result = XtRealloc(result, used); + if (buf != 0) { + unsigned limit = ((len + 1) * 8) + 1; + char *dst; + + if (limit > used) { + used = limit; + result = XtRealloc(result, used); + } + dst = result; + *dst = '\0'; + while (len--) { + unsigned value = *buf++; + formatAscii(dst, value); + dst += strlen(dst); + } + } else if (result != 0) { + free(result); + result = 0; + used = 0; } - dst = result; - *dst = '\0'; - while (len--) { - unsigned value = *buf++; -#if OPT_WIDE_CHARS - if (buf2 != 0) { - value |= (*buf2 << 8); - buf2++; + return result; +} + +char * +visibleIChars(IChar * buf, unsigned len) +{ + static char *result; + static unsigned used; + + if (buf != 0) { + unsigned limit = ((len + 1) * 8) + 1; + char *dst; + + if (limit > used) { + used = limit; + result = XtRealloc(result, used); } - if (value > 255) - sprintf(dst, "\\u+%04X", value); - else + dst = result; + *dst = '\0'; + while (len--) { + unsigned value = *buf++; +#if OPT_WIDE_CHARS + if (value > 255) + sprintf(dst, "\\u+%04X", value); + else #endif - formatAscii(dst, value); - dst += strlen(dst); + formatAscii(dst, value); + dst += strlen(dst); + } + } else if (result != 0) { + free(result); + result = 0; + used = 0; } return result; } @@ -218,23 +253,30 @@ visibleIChar(IChar * buf, unsigned len) { static char *result; static unsigned used; - unsigned limit = ((len + 1) * 6) + 1; - char *dst; - if (limit > used) { - used = limit; - result = XtRealloc(result, used); - } - dst = result; - while (len--) { - unsigned value = *buf++; + if (buf != 0) { + unsigned limit = ((len + 1) * 6) + 1; + char *dst; + + if (limit > used) { + used = limit; + result = XtRealloc(result, used); + } + dst = result; + while (len--) { + unsigned value = *buf++; #if OPT_WIDE_CHARS - if (value > 255) - sprintf(dst, "\\u+%04X", value); - else + if (value > 255) + sprintf(dst, "\\u+%04X", value); + else #endif - formatAscii(dst, value); - dst += strlen(dst); + formatAscii(dst, value); + dst += strlen(dst); + } + } else if (result != 0) { + free(result); + result = 0; + used = 0; } return result; } @@ -355,88 +397,56 @@ visibleXError(int code) #define isScrnFlag(flag) ((flag) == LINEWRAPPED) static char * -ScrnText(TScreen * screen, int row) +ScrnText(LineData * ld) { - Char *chars = SCRN_BUF_CHARS(screen, row); -#if OPT_WIDE_CHARS - Char *widec = 0; -#endif - - if_OPT_WIDE_CHARS(screen, { - widec = SCRN_BUF_WIDEC(screen, row); - }); - return visibleChars(PAIRED_CHARS(chars, widec), screen->max_col + 1); + return visibleIChars(ld->charData, ld->lineSize); } -#if OPT_TRACE_FLAGS > 1 -#define DETAILED_FLAGS(name) \ - Trace("TEST " #name " %d [%d..%d] top %d chars %p (%d)\n", \ - row, \ - -screen->savedlines, \ - screen->max_row, \ - screen->topline, \ - SCRN_BUF_CHARS(screen, row), \ - (&(SCRN_BUF_FLAGS(screen, row)) - screen->visbuf) / MAX_PTRS) -#else -#define DETAILED_FLAGS(name) /* nothing */ -#endif - -#define SHOW_BAD_ROW(name, screen, row) \ - Trace("OOPS " #name " bad row %d [%d..%d]\n", \ - row, -(screen->savedlines), screen->max_row) +#define SHOW_BAD_LINE(name, ld) \ + Trace("OOPS " #name " bad row\n") #define SHOW_SCRN_FLAG(name,code) \ - Trace(#name " {%d, top=%d, saved=%d}%05d%s:%s\n", \ - row, screen->topline, screen->savedlines, \ - ROW2ABS(screen, row), \ + Trace(#name " %s:%s\n", \ code ? "*" : "", \ - ScrnText(screen, row)) + ScrnText(ld)) void -ScrnClrFlag(TScreen * screen, int row, int flag) +LineClrFlag(LineData * ld, int flag) { - DETAILED_FLAGS(ScrnClrFlag); - if (!okScrnRow(screen, row)) { - SHOW_BAD_ROW(ScrnClrFlag, screen, row); + if (ld == 0) { + SHOW_BAD_LINE(LineClrFlag, ld); assert(0); } else if (isScrnFlag(flag)) { - SHOW_SCRN_FLAG(ScrnClrFlag, 0); + SHOW_SCRN_FLAG(LineClrFlag, 0); } - SCRN_BUF_FLAGS(screen, row) = - (Char *) ((long) SCRN_BUF_FLAGS(screen, row) & ~(flag)); + LineFlags(ld) &= ~flag; } void -ScrnSetFlag(TScreen * screen, int row, int flag) +LineSetFlag(LineData * ld, int flag) { - DETAILED_FLAGS(ScrnSetFlag); - if (!okScrnRow(screen, row)) { - SHOW_BAD_ROW(ScrnSetFlag, screen, row); + if (ld == 0) { + SHOW_BAD_LINE(LineSetFlag, ld); assert(0); } else if (isScrnFlag(flag)) { - SHOW_SCRN_FLAG(ScrnSetFlag, 1); + SHOW_SCRN_FLAG(LineSetFlag, 1); } - SCRN_BUF_FLAGS(screen, row) = - (Char *) (((long) SCRN_BUF_FLAGS(screen, row) | (flag))); + LineFlags(ld) |= flag; } int -ScrnTstFlag(TScreen * screen, int row, int flag) +LineTstFlag(LineData ld, int flag) { int code = 0; - if (!okScrnRow(screen, row)) { - SHOW_BAD_ROW(ScrnTstFlag, screen, row); + if (ld == 0) { + SHOW_BAD_LINE(LineTstFlag, ld); } else { - code = ((long) SCRN_BUF_FLAGS(screen, row) & (flag)) != 0; - - DETAILED_FLAGS(ScrnTstFlag); - if (!okScrnRow(screen, row)) { - SHOW_BAD_ROW(ScrnSetFlag, screen, row); - assert(0); - } else if (isScrnFlag(flag)) { - SHOW_SCRN_FLAG(ScrnTstFlag, code); + code = LineFlags(ld); + + if (isScrnFlag(flag)) { + SHOW_SCRN_FLAG(LineTstFlag, code); } } return code; @@ -607,7 +617,7 @@ parse_option(char *dst, char *src, int first) char *s; if (!strncmp(src, "-/+", 3)) { - dst[0] = first; + dst[0] = (char) first; strcpy(dst + 1, src + 3); } else { strcpy(dst, src); diff --git a/app/xterm/trace.h b/app/xterm/trace.h index f841624d1..982ae6de8 100644 --- a/app/xterm/trace.h +++ b/app/xterm/trace.h @@ -1,4 +1,4 @@ -/* $XTermId: trace.h,v 1.45 2009/03/19 23:47:59 tom Exp $ */ +/* $XTermId: trace.h,v 1.47 2009/06/17 09:24:31 tom Exp $ */ /************************************************************ @@ -47,12 +47,13 @@ extern void Trace ( const char *, ... ) #define TRACE2(p) Trace p #endif -extern const char * visibleChrsetName(int /* chrset */); -extern char * visibleChars (PAIRED_CHARS(Char * /* buf */, Char * /* buf2 */), unsigned /* len */); +extern char * visibleChars (Char * /* buf */, unsigned /* len */); extern char * visibleIChar (IChar *, unsigned); +extern char * visibleIChars (IChar * /* buf */, unsigned /* len */); extern const char * visibleEventType (int); extern const char * visibleSelectionTarget(Display * /* d */, Atom /* a */); extern const char * visibleXError (int /* code */); +extern const char * visibleChrsetName(unsigned /* chrset */); extern void TraceArgv(const char * /* tag */, char ** /* argv */); #undef TRACE_ARGV diff --git a/app/xterm/util.c b/app/xterm/util.c index b8cf5b746..7f590539e 100644 --- a/app/xterm/util.c +++ b/app/xterm/util.c @@ -1,4 +1,4 @@ -/* $XTermId: util.c,v 1.421 2009/03/16 00:37:25 tom Exp $ */ +/* $XTermId: util.c,v 1.486 2009/08/15 00:40:38 tom Exp $ */ /* * Copyright 1999-2008,2009 by Thomas E. Dickey @@ -163,7 +163,8 @@ FlushScroll(XtermWidget xw) if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > (i = screen->max_row - screen->scroll_amt + 1)) refreshtop = i; - if (screen->scrollWidget && !screen->alternate + if (screen->scrollWidget + && !screen->whichBuf && screen->top_marg == 0) { scrolltop = 0; if ((scrollheight += shift) > i) @@ -302,7 +303,7 @@ adjustHiliteOnFwdScroll(XtermWidget xw, int amount, Bool all_lines) int hi_row = screen->bot_marg; TRACE2(("adjustSelection FWD %s by %d (%s)\n", - screen->alternate ? "alternate" : "normal", + screen->whichBuf ? "alternate" : "normal", amount, all_lines ? "all" : "visible")); TRACE2((" before highlite %d.%d .. %d.%d\n", @@ -360,7 +361,7 @@ adjustHiliteOnBakScroll(XtermWidget xw, int amount) int hi_row = screen->bot_marg; TRACE2(("adjustSelection BAK %s by %d (%s)\n", - screen->alternate ? "alternate" : "normal", + screen->whichBuf ? "alternate" : "normal", amount, "visible")); TRACE2((" before highlite %d.%d .. %d.%d\n", @@ -423,7 +424,7 @@ xtermScroll(XtermWidget xw, int amount) int scrolltop; int scrollheight; Boolean scroll_all_lines = (Boolean) (screen->scrollWidget - && !screen->alternate + && !screen->whichBuf && screen->top_marg == 0); TRACE(("xtermScroll count=%d\n", amount)); @@ -442,13 +443,17 @@ xtermScroll(XtermWidget xw, int amount) if (screen->jumpscroll) { if (screen->scroll_amt > 0) { - if (screen->refresh_amt + amount > i) - FlushScroll(xw); + if (!screen->fastscroll) { + if (screen->refresh_amt + amount > i) + FlushScroll(xw); + } screen->scroll_amt += amount; screen->refresh_amt += amount; } else { - if (screen->scroll_amt < 0) - FlushScroll(xw); + if (!screen->fastscroll) { + if (screen->scroll_amt < 0) + FlushScroll(xw); + } screen->scroll_amt = amount; screen->refresh_amt = amount; } @@ -515,18 +520,16 @@ xtermScroll(XtermWidget xw, int amount) if (amount > 0) { if (scroll_all_lines) { ScrnDeleteLine(xw, - screen->allbuf, + screen->saveBuf_index, screen->bot_marg + screen->savelines, 0, - (unsigned) amount, - (unsigned) MaxCols(screen)); + (unsigned) amount); } else { ScrnDeleteLine(xw, screen->visbuf, screen->bot_marg, screen->top_marg, - (unsigned) amount, - (unsigned) MaxCols(screen)); + (unsigned) amount); } } @@ -619,8 +622,7 @@ RevScroll(XtermWidget xw, int amount) screen->visbuf, screen->bot_marg, screen->top_marg, - (unsigned) amount, - (unsigned) MaxCols(screen)); + (unsigned) amount); } screen->cursor_busy -= 1; return; @@ -634,17 +636,16 @@ void WriteText(XtermWidget xw, IChar * str, Cardinal len) { TScreen *screen = &(xw->screen); - ScrnPtr temp_str = 0; + LineData *ld = 0; unsigned test; unsigned flags = xw->flags; - unsigned fg_bg = makeColorPair(xw->cur_foreground, xw->cur_background); + CellColor fg_bg = makeColorPair(xw->cur_foreground, xw->cur_background); unsigned cells = visual_width(str, len); GC currentGC; - TRACE(("WriteText (%2d,%2d) (%d) %3d:%s\n", + TRACE(("WriteText (%2d,%2d) %3d:%s\n", screen->cur_row, screen->cur_col, - curXtermChrSet(xw, screen->cur_row), len, visibleIChar(str, len))); if (ScrnHaveSelection(screen) @@ -657,7 +658,8 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) InsertChar(xw, cells); } - if (AddToVisible(xw)) { + if (AddToVisible(xw) + && (ld = getLineData(screen, screen->cur_row)) != 0) { if (screen->cursor_state) HideCursor(); @@ -678,7 +680,8 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) str[n] = ' '; } - TRACE(("WriteText calling drawXtermText (%d,%d)\n", + TRACE(("WriteText calling drawXtermText (%d) (%d,%d)\n", + LineCharSet(screen, ld), screen->cur_col, screen->cur_row)); @@ -688,11 +691,11 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) /* make sure that the correct GC is current */ currentGC = updatedXtermGC(xw, flags, fg_bg, False); - drawXtermIChars(xw, test & DRAWX_MASK, currentGC, - CurCursorX(screen, screen->cur_row, screen->cur_col), - CursorY(screen, screen->cur_row), - curXtermChrSet(xw, screen->cur_row), - str, len, 0); + drawXtermText(xw, test & DRAWX_MASK, currentGC, + LineCursorX(screen, ld, screen->cur_col), + CursorY(screen, screen->cur_row), + LineCharSet(screen, ld), + str, len, 0); resetXtermGC(xw, flags, False); } @@ -720,8 +723,6 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len) } mapstate = -1; #endif /* OPT_ZICONBEEP */ - if (temp_str != 0) - free(temp_str); return; } @@ -765,8 +766,10 @@ InsertLine(XtermWidget xw, int n) FlushScroll(xw); screen->scroll_amt -= n; screen->refresh_amt -= n; - } else if (screen->scroll_amt) - FlushScroll(xw); + } else { + if (screen->scroll_amt) + FlushScroll(xw); + } } if (!screen->scroll_amt) { shift = INX2ROW(screen, 0); @@ -793,8 +796,7 @@ InsertLine(XtermWidget xw, int n) screen->visbuf, screen->bot_marg, screen->cur_row, - (unsigned) n, - (unsigned) MaxCols(screen)); + (unsigned) n); } } @@ -813,6 +815,9 @@ DeleteLine(XtermWidget xw, int n) int refreshheight; int scrolltop; int scrollheight; + Boolean scroll_all_lines = (Boolean) (screen->scrollWidget + && !screen->whichBuf + && screen->cur_row == 0); if (!ScrnIsLineInMargins(screen, INX2ROW(screen, screen->cur_row))) return; @@ -836,8 +841,10 @@ DeleteLine(XtermWidget xw, int n) FlushScroll(xw); screen->scroll_amt += n; screen->refresh_amt += n; - } else if (screen->scroll_amt) - FlushScroll(xw); + } else { + if (screen->scroll_amt) + FlushScroll(xw); + } } if (!screen->scroll_amt) { @@ -848,7 +855,7 @@ DeleteLine(XtermWidget xw, int n) if ((refreshtop = screen->bot_marg - refreshheight + 1 + shift) > (i = screen->max_row - refreshheight + 1)) refreshtop = i; - if (screen->scrollWidget && !screen->alternate && screen->cur_row == 0) { + if (scroll_all_lines) { scrolltop = 0; if ((scrollheight += shift) > i) scrollheight = i; @@ -878,22 +885,18 @@ DeleteLine(XtermWidget xw, int n) } /* adjust screen->buf */ if (n > 0) { - if (screen->scrollWidget - && !screen->alternate - && screen->cur_row == 0) + if (scroll_all_lines) ScrnDeleteLine(xw, - screen->allbuf, + screen->saveBuf_index, screen->bot_marg + screen->savelines, 0, - (unsigned) n, - (unsigned) MaxCols(screen)); + (unsigned) n); else ScrnDeleteLine(xw, screen->visbuf, screen->bot_marg, screen->cur_row, - (unsigned) n, - (unsigned) MaxCols(screen)); + (unsigned) n); } } @@ -904,6 +907,7 @@ void InsertChar(XtermWidget xw, unsigned n) { TScreen *screen = &(xw->screen); + LineData *ld; unsigned limit; int row = INX2ROW(screen, screen->cur_row); @@ -925,7 +929,8 @@ InsertChar(XtermWidget xw, unsigned n) n = limit; assert(n != 0); - if (AddToVisible(xw)) { + if (AddToVisible(xw) + && (ld = getLineData(screen, screen->cur_row)) != 0) { int col = MaxCols(screen) - (int) n; /* @@ -948,7 +953,7 @@ InsertChar(XtermWidget xw, unsigned n) }); #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { col = MaxCols(screen) / 2 - (int) n; } #endif @@ -965,9 +970,9 @@ InsertChar(XtermWidget xw, unsigned n) ClearCurBackground(xw, CursorY(screen, screen->cur_row), - CurCursorX(screen, screen->cur_row, screen->cur_col), + LineCursorX(screen, ld, screen->cur_col), (unsigned) FontHeight(screen), - n * (unsigned) CurFontWidth(screen, screen->cur_row)); + n * (unsigned) LineFontWidth(screen, ld)); } /* adjust screen->buf */ ScrnInsertChar(xw, n); @@ -980,6 +985,7 @@ void DeleteChar(XtermWidget xw, unsigned n) { TScreen *screen = &(xw->screen); + LineData *ld; unsigned limit; int row = INX2ROW(screen, screen->cur_row); @@ -1001,7 +1007,8 @@ DeleteChar(XtermWidget xw, unsigned n) n = limit; assert(n != 0); - if (AddToVisible(xw)) { + if (AddToVisible(xw) + && (ld = getLineData(screen, screen->cur_row)) != 0) { int col = MaxCols(screen) - (int) n; /* @@ -1016,7 +1023,7 @@ DeleteChar(XtermWidget xw, unsigned n) }); #if OPT_DEC_CHRSET - if (CSET_DOUBLE(SCRN_BUF_CSETS(screen, screen->cur_row)[0])) { + if (CSET_DOUBLE(GetLineDblCS(ld))) { col = MaxCols(screen) / 2 - (int) n; } #endif @@ -1027,9 +1034,9 @@ DeleteChar(XtermWidget xw, unsigned n) ClearCurBackground(xw, CursorY(screen, screen->cur_row), - CurCursorX(screen, screen->cur_row, col), + LineCursorX(screen, ld, col), (unsigned) FontHeight(screen), - n * (unsigned) CurFontWidth(screen, screen->cur_row)); + n * (unsigned) LineFontWidth(screen, ld)); } if (n != 0) { /* adjust screen->buf */ @@ -1121,6 +1128,7 @@ static int ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) { TScreen *screen = &(xw->screen); + LineData *ld; int rc = 1; TRACE(("ClearInLine(row=%d, col=%d, len=%d) vs %d..%d\n", @@ -1142,7 +1150,7 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) */ if (screen->protected_mode != OFF_PROTECT) { unsigned n; - Char *attrs = SCRN_BUF_ATTRS(screen, row) + col; + Char *attrs = getLineData(screen, row)->attribs + col; int saved_mode = screen->protected_mode; Bool done; @@ -1154,11 +1162,13 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) for (n = 0; n < len; n++) { if (attrs[n] & PROTECTED) { rc = 0; /* found a protected segment */ - if (n != 0) + if (n != 0) { ClearInLine(xw, row, col, n); + } while ((n < len) - && (attrs[n] & PROTECTED)) + && (attrs[n] & PROTECTED)) { n++; + } done = False; break; } @@ -1181,12 +1191,14 @@ ClearInLine2(XtermWidget xw, int flags, int row, int col, unsigned len) HideCursor(); screen->do_wrap = False; - if (AddToVisible(xw)) { + if (AddToVisible(xw) + && (ld = getLineData(screen, row)) != 0) { + ClearCurBackground(xw, CursorY(screen, row), - CurCursorX(screen, row, col), + LineCursorX(screen, ld, col), (unsigned) FontHeight(screen), - len * (unsigned) CurFontWidth(screen, row)); + len * (unsigned) LineFontWidth(screen, ld)); } if (len != 0) { @@ -1222,6 +1234,7 @@ void ClearRight(XtermWidget xw, int n) { TScreen *screen = &(xw->screen); + LineData *ld; unsigned len = (unsigned) (MaxCols(screen) - screen->cur_col); assert(screen->max_col >= 0); @@ -1235,6 +1248,7 @@ ClearRight(XtermWidget xw, int n) if (len > (unsigned) n) len = (unsigned) n; + ld = getLineData(screen, screen->cur_row); if (AddToVisible(xw)) { if_OPT_WIDE_CHARS(screen, { int col = screen->cur_col; @@ -1259,7 +1273,7 @@ ClearRight(XtermWidget xw, int n) } /* with the right part cleared, we can't be wrapping */ - ScrnClrWrapped(screen, screen->cur_row); + LineClrWrapped(ld); screen->do_wrap = False; } @@ -1337,8 +1351,9 @@ do_erase_line(XtermWidget xw, int param, int mode) int saved_mode = screen->protected_mode; if (saved_mode == DEC_PROTECT - && saved_mode != mode) + && saved_mode != mode) { screen->protected_mode = OFF_PROTECT; + } switch (param) { case -1: /* DEFAULT */ @@ -1509,13 +1524,17 @@ horizontal_copy_area(XtermWidget xw, int amount) /* number of characters to move right */ { TScreen *screen = &(xw->screen); - int src_x = CurCursorX(screen, screen->cur_row, firstchar); - int src_y = CursorY(screen, screen->cur_row); + LineData *ld; + + if ((ld = getLineData(screen, screen->cur_row)) != 0) { + int src_x = LineCursorX(screen, ld, firstchar); + int src_y = CursorY(screen, screen->cur_row); - copy_area(xw, src_x, src_y, - (unsigned) (nchars * CurFontWidth(screen, screen->cur_row)), - (unsigned) FontHeight(screen), - src_x + amount * CurFontWidth(screen, screen->cur_row), src_y); + copy_area(xw, src_x, src_y, + (unsigned) (nchars * LineFontWidth(screen, ld)), + (unsigned) FontHeight(screen), + src_x + amount * LineFontWidth(screen, ld), src_y); + } } /* @@ -1668,7 +1687,7 @@ handle_translated_exposure(XtermWidget xw, if (toprow < 0) toprow = 0; - leftcol = x0 / CurFontWidth(screen, screen->cur_row); + leftcol = x0 / FontWidth(screen); if (leftcol < 0) leftcol = 0; @@ -2106,29 +2125,29 @@ getXftColor(XtermWidget xw, Pixel pixel) * Otherwise, interpret according to internal data. */ #if OPT_RENDERWIDE -static int -xtermCellWidth(XtermWidget xw, wchar_t ch) -{ - int result = 0; - (void) xw; - if (ch == 0 || ch == 127) { - result = 0; - } else if (ch < 256) { #if OPT_C1_PRINT - if (ch >= 128 && ch < 160) { - result = (xw->screen.c1_printable ? 1 : 0); - } else +#define XtermCellWidth(xw, ch) \ + (((ch) == 0 || (ch) == 127) \ + ? 0 \ + : (((ch) < 256) \ + ? (((ch) >= 128 && (ch) < 160) \ + ? ((xw)->screen.c1_printable ? 1 : 0) \ + : 1) \ + : my_wcwidth(ch))) +#else +#define XtermCellWidth(xw, ch) \ + (((ch) == 0 || (ch) == 127) \ + ? 0 \ + : (((ch) < 256) \ + ? 1 \ + : my_wcwidth(ch))) #endif - result = 1; /* 1..31 are line-drawing characters */ - } else { - result = my_wcwidth(ch); - } - return result; -} #endif /* OPT_RENDERWIDE */ +#define XFT_FONT(name) screen->name.font + /* * fontconfig/Xft combination prior to 2.2 has a problem with * CJK truetype 'double-width' (bi-width/monospace) fonts leading @@ -2146,7 +2165,7 @@ xtermXftDrawString(XtermWidget xw, XftFont * font, int x, int y, - PAIRED_CHARS(Char * text, Char * text2), + IChar * text, Cardinal len, Bool really) { @@ -2155,9 +2174,7 @@ xtermXftDrawString(XtermWidget xw, if (len != 0) { #if OPT_RENDERWIDE - static XftCharSpec *sbuf; - static Cardinal slen = 0; - + XftCharSpec *sbuf; XftFont *wfont; Cardinal src, dst; XftFont *lastFont = 0; @@ -2170,30 +2187,24 @@ xtermXftDrawString(XtermWidget xw, #if OPT_ISO_COLORS if ((flags & UNDERLINE) && screen->italicULMode - && screen->renderWideItal[fontnum]) { - wfont = screen->renderWideItal[fontnum]; + && XFT_FONT(renderWideItal[fontnum])) { + wfont = XFT_FONT(renderWideItal[fontnum]); } else #endif if ((flags & BOLDATTR(screen)) - && screen->renderWideBold[fontnum]) { - wfont = screen->renderWideBold[fontnum]; + && XFT_FONT(renderWideBold[fontnum])) { + wfont = XFT_FONT(renderWideBold[fontnum]); } else { - wfont = screen->renderWideNorm[fontnum]; + wfont = XFT_FONT(renderWideNorm[fontnum]); } - if (slen < len) { - slen = (len + 1) * 2; - sbuf = (XftCharSpec *) XtRealloc((char *) sbuf, - slen * sizeof(XftCharSpec)); - } + BumpTypedBuffer(XftCharSpec, len); + sbuf = BfBuf(XftCharSpec); for (src = dst = 0; src < len; src++) { FcChar32 wc = *text++; - if (text2) - wc |= (*text2++ << 8); - - charWidth = xtermCellWidth(xw, (wchar_t) wc); + charWidth = XtermCellWidth(xw, (wchar_t) wc); if (charWidth < 0) continue; @@ -2225,25 +2236,30 @@ xtermXftDrawString(XtermWidget xw, (int) (dst - start)); } #else /* !OPT_RENDERWIDE */ - PAIRED_CHARS((void) text, (void) text2); if (really) { + XftChar8 *buffer; + int dst; + + BumpTypedBuffer(XftChar8, len); + buffer = BfBuf(XftChar8); + + for (dst = 0; dst < (int) len; ++dst) + buffer[dst] = CharOf(text[dst]); + XftDrawString8(screen->renderDraw, color, font, - x, y, (unsigned char *) text, len); + x, y, buffer, (int) len); } - ncells = len; + ncells = (int) len; #endif } return ncells; } -#define xtermXftWidth(xw, flags, color, font, x, y, paired_chars, len) \ - xtermXftDrawString(xw, flags, color, font, x, y, paired_chars, len, False) +#define xtermXftWidth(xw, flags, color, font, x, y, chars, len) \ + xtermXftDrawString(xw, flags, color, font, x, y, chars, len, False) #endif /* OPT_RENDERFONT */ -#define DrawX(col) x + (col * (font_width)) -#define DrawSegment(first,last) (void)drawXtermText(xw, flags|NOTRANSLATION, gc, DrawX(first), y, chrset, PAIRED_CHARS(text+first, text2+first), (unsigned)(last - first), on_wide) - #if OPT_WIDE_CHARS /* * Map characters commonly "fixed" by groff back to their ASCII equivalents. @@ -2308,15 +2324,10 @@ ucs_workaround(XtermWidget xw, int fixed = False; if (screen->wide_chars && screen->utf8_mode && ch > 256) { - unsigned eqv = AsciiEquivs(ch); + IChar eqv = (IChar) AsciiEquivs(ch); - if (eqv != ch) { + if (eqv != (IChar) ch) { int width = my_wcwidth((int) ch); - Char text[2]; - Char text2[2]; - - text[0] = (Char) eqv; - text2[0] = 0; do { drawXtermText(xw, @@ -2325,11 +2336,11 @@ ucs_workaround(XtermWidget xw, x, y, chrset, - PAIRED_CHARS(text, text2), + &eqv, 1, on_wide); x += FontWidth(screen); - text[0] = '?'; + eqv = '?'; } while (width-- > 1); fixed = True; @@ -2457,7 +2468,7 @@ xtermSetClipRectangles(Display * dpy, #endif XSetClipRectangles(dpy, gc, - x, y, rp, nr, order); + x, y, rp, (int) nr, order); TRACE(("clipping @(%3d,%3d) (%3d,%3d)..(%3d,%3d)\n", y, x, rp->y, rp->x, rp->height, rp->width)); @@ -2465,7 +2476,7 @@ xtermSetClipRectangles(Display * dpy, #else #define xtermSetClipRectangles(dpy, gc, x, y, rp, nr, order) \ - XSetClipRectangles(dpy, gc, x, y, rp, nr, order) + XSetClipRectangles(dpy, gc, x, y, rp, (int) nr, order) #endif #if OPT_CLIP_BOLD @@ -2522,13 +2533,13 @@ drawClippedXftString(XtermWidget xw, XftColor * fg_color, int x, int y, - PAIRED_CHARS(Char * text, Char * text2), + IChar * text, Cardinal len) { int ncells = xtermXftWidth(xw, flags, fg_color, font, x, y, - PAIRED_CHARS(text, text2), + text, len); TScreen *screen = &(xw->screen); @@ -2536,7 +2547,7 @@ drawClippedXftString(XtermWidget xw, xtermXftDrawString(xw, flags, fg_color, font, x, y, - PAIRED_CHARS(text, text2), + text, len, True); endXftClipping(screen); @@ -2544,6 +2555,15 @@ drawClippedXftString(XtermWidget xw, } #endif +#ifndef NO_ACTIVE_ICON +#define WhichVFontData(screen,name) \ + (IsIcon(screen) ? &((screen)->fnt_icon) \ + : &((screen)->name)) +#else +#define WhichVFontData(screen,name) \ + (&((screen)->name)) +#endif + /* * Draws text with the specified combination of bold/underline. The return * value is the updated x position. @@ -2555,7 +2575,7 @@ drawXtermText(XtermWidget xw, int x, int y, int chrset, - PAIRED_CHARS(Char * text, Char * text2), + IChar * text, Cardinal len, int on_wide) { @@ -2570,21 +2590,6 @@ drawXtermText(XtermWidget xw, #if OPT_WIDE_CHARS if (text == 0) return 0; - /* - * It's simpler to pass in a null pointer for text2 in places where - * we only use codes through 255. Fix text2 here so we can increment - * it, etc. - */ - if (text2 == 0) { - static Char *dbuf; - static unsigned dlen; - if (dlen <= len) { - dlen = (len + 1) * 2; - dbuf = (Char *) XtRealloc((char *) dbuf, dlen); - memset(dbuf, 0, dlen); - } - text2 = dbuf; - } #endif #if OPT_DEC_CHRSET if (CSET_DOUBLE(chrset)) { @@ -2600,7 +2605,7 @@ drawXtermText(XtermWidget xw, TRACE(("DRAWTEXT%c[%4d,%4d] (%d)%3d:%s\n", screen->cursor_state == OFF ? ' ' : '*', y, x, chrset, len, - visibleChars(PAIRED_CHARS(text, text2), len))); + visibleIChars(text, len))); if (gc2 != 0) { /* draw actual double-sized characters */ XFontStruct *fs = screen->double_fonts[inx].fs; @@ -2610,7 +2615,7 @@ drawXtermText(XtermWidget xw, #endif { XRectangle rect, *rp = ▭ - int nr = 1; + Cardinal nr = 1; font_width *= 2; flags |= DOUBLEWFONT; @@ -2620,7 +2625,7 @@ drawXtermText(XtermWidget xw, rect.width = (unsigned short) ((int) len * font_width); rect.height = (unsigned short) (FontHeight(screen)); - TRACE(("drawing %s\n", visibleChrsetName(chrset))); + TRACE(("drawing %s\n", visibleChrsetName((unsigned) chrset))); switch (chrset) { case CSET_DHL_TOP: rect.y = (short) -(fs->ascent / 2); @@ -2662,34 +2667,25 @@ drawXtermText(XtermWidget xw, while (len--) { x = drawXtermText(xw, flags, gc2, x, y, 0, - PAIRED_CHARS(text++, text2++), + text++, 1, on_wide); x += FontWidth(screen); } } else { x = drawXtermText(xw, flags, gc2, x, y, 0, - PAIRED_CHARS(text, text2), + text, len, on_wide); x += (int) len *FontWidth(screen); } TRACE(("drawtext [%4d,%4d]\n", y, x)); } else { /* simulate double-sized characters */ -#if OPT_WIDE_CHARS - Char *wide = 0; -#endif unsigned need = 2 * len; - Char *temp = TypeMallocN(Char, need); + IChar *temp = TypeMallocN(IChar, need); unsigned n = 0; - if_OPT_WIDE_CHARS(screen, { - wide = TypeMallocN(Char, need); - }); + while (len--) { - if_OPT_WIDE_CHARS(screen, { - wide[n] = *text2++; - wide[n + 1] = 0; - }); temp[n++] = *text++; temp[n++] = ' '; } @@ -2698,13 +2694,10 @@ drawXtermText(XtermWidget xw, gc, x, y, 0, - PAIRED_CHARS(temp, wide), + temp, n, on_wide); free(temp); - if_OPT_WIDE_CHARS(screen, { - free(wide); - }); } return x; } @@ -2731,16 +2724,16 @@ drawXtermText(XtermWidget xw, #if OPT_ISO_COLORS if ((flags & UNDERLINE) && screen->italicULMode - && screen->renderFontItal[fontnum]) { - font = screen->renderFontItal[fontnum]; + && XFT_FONT(renderFontItal[fontnum])) { + font = XFT_FONT(renderFontItal[fontnum]); did_ul = True; } else #endif if ((flags & BOLDATTR(screen)) - && screen->renderFontBold[fontnum]) { - font = screen->renderFontBold[fontnum]; + && XFT_FONT(renderFontBold[fontnum])) { + font = XFT_FONT(renderFontBold[fontnum]); } else { - font = screen->renderFontNorm[fontnum]; + font = XFT_FONT(renderFontNorm[fontnum]); } values.foreground = getCgsFore(xw, currentWin, gc); values.background = getCgsBack(xw, currentWin, gc); @@ -2750,7 +2743,7 @@ drawXtermText(XtermWidget xw, ncells = xtermXftWidth(xw, flags, bg_color, font, x, y, - PAIRED_CHARS(text, text2), + text, len); XftDrawRect(screen->renderDraw, bg_color, @@ -2770,11 +2763,9 @@ drawXtermText(XtermWidget xw, for (last = 0; last < (int) len; last++) { Boolean replace = False; Boolean missing = False; - unsigned ch = (unsigned) PACK_PAIR(text, text2, last); + unsigned ch = (unsigned) text[last]; int nc; - Char temp[2]; #if OPT_WIDE_CHARS - Char temp2[2]; if (xtermIsDecGraphic(ch)) { /* @@ -2836,8 +2827,7 @@ drawXtermText(XtermWidget xw, getXftColor(xw, values.foreground), curX, y, - PAIRED_CHARS(text + first, - text2 + first), + text + first, (Cardinal) (last - first)); curX += nc * FontWidth(screen); underline_len += (Cardinal) nc; @@ -2854,18 +2844,14 @@ drawXtermText(XtermWidget xw, screen->fnt_wide = old_wide; screen->fnt_high = old_high; } else { - temp[0] = LO_BYTE(ch); -#if OPT_WIDE_CHARS - temp2[0] = HI_BYTE(ch); -#endif + IChar ch2 = (IChar) ch; nc = drawClippedXftString(xw, flags, font, getXftColor(xw, values.foreground), curX, y, - PAIRED_CHARS(temp, - temp2), + &ch2, 1); curX += nc * FontWidth(screen); underline_len += (Cardinal) nc; @@ -2874,28 +2860,27 @@ drawXtermText(XtermWidget xw, } } if (last > first) { - underline_len += + underline_len += (Cardinal) drawClippedXftString(xw, flags, font, getXftColor(xw, values.foreground), curX, y, - PAIRED_CHARS(text + first, - text2 + first), + text + first, (Cardinal) (last - first)); } } #else { - underline_len += + underline_len += (Cardinal) drawClippedXftString(xw, flags, font, getXftColor(xw, values.foreground), x, y, - PAIRED_CHARS(text, text2), + text, len); } #endif /* OPT_BOX_CHARS */ @@ -2919,27 +2904,41 @@ drawXtermText(XtermWidget xw, */ if (!IsIcon(screen) && !(flags & CHARBYCHAR) && screen->fnt_prop) { int adj, width; - XFontStruct *fs = ((flags & BOLDATTR(screen)) - ? BoldFont(screen) - : NormalFont(screen)); + XTermFonts *font = ((flags & BOLDATTR(screen)) + ? WhichVFontData(screen, fnts[fBold]) + : WhichVFontData(screen, fnts[fNorm])); xtermFillCells(xw, flags, gc, x, y, len); while (len--) { - if_WIDE_OR_NARROW(screen, { - XChar2b temp[1]; - temp[0].byte2 = *text; - temp[0].byte1 = *text2; - width = XTextWidth16(fs, temp, 1); +#if OPT_BOX_CHARS + if (IsXtermMissingChar(screen, *text, font)) { + + width = 1; + if_OPT_WIDE_CHARS(screen, { + width = my_wcwidth((wchar_t) (*text)) * FontWidth(screen); + }); + adj = 0; + } else +#endif + { + if_WIDE_OR_NARROW(screen, { + XChar2b temp[1]; + temp[0].byte2 = LO_BYTE(*text); + temp[0].byte1 = HI_BYTE(*text); + width = XTextWidth16(font->fs, temp, 1); + } + , { + char temp[1]; + temp[0] = (char) LO_BYTE(*text); + width = XTextWidth(font->fs, temp, 1); + }); + adj = (FontWidth(screen) - width) / 2; } - , { - width = XTextWidth(fs, (char *) text, 1); - }); - adj = (FontWidth(screen) - width) / 2; - (void) drawXtermText(xw, flags | NOBACKGROUND | CHARBYCHAR, - gc, x + adj, y, chrset, - PAIRED_CHARS(text++, text2++), 1, on_wide); - x += FontWidth(screen); + x = drawXtermText(xw, + flags | NOBACKGROUND | CHARBYCHAR, + gc, x + adj, y, chrset, + text++, 1, on_wide) - adj; } return x; } @@ -2952,31 +2951,38 @@ drawXtermText(XtermWidget xw, Find regions without missing characters, and draw them calling ourselves recursively. Draw missing characters via xtermDrawBoxChar(). */ - XFontStruct *font = ((flags & BOLD) - ? BoldFont(screen) - : NormalFont(screen)); + XTermFonts *font = ((flags & BOLDATTR(screen)) + ? WhichVFontData(screen, fnts[fBold]) + : WhichVFontData(screen, fnts[fNorm])); int last, first = 0; + Bool drewBoxes = False; + for (last = 0; last < (int) len; last++) { - unsigned ch = (unsigned) PACK_PAIR(text, text2, last); + unsigned ch = (unsigned) text[last]; Bool isMissing; int ch_width; #if OPT_WIDE_CHARS if (ch == HIDDEN_CHAR) { - if (last > first) - DrawSegment(first, last); + if (last > first) { + x = drawXtermText(xw, flags | NOTRANSLATION, gc, + x, y, + chrset, text + first, + (unsigned) (last - first), on_wide); + } first = last + 1; + drewBoxes = True; continue; } ch_width = my_wcwidth((int) ch); isMissing = - xtermMissingChar(xw, ch, - ((on_wide || ch_width > 1) - && okFont(NormalWFont(screen))) - ? NormalWFont(screen) - : font); + IsXtermMissingChar(screen, ch, + ((on_wide || ch_width > 1) + && okFont(NormalWFont(screen))) + ? WhichVFontData(screen, fnts[fWide]) + : font); #else - isMissing = xtermMissingChar(xw, ch, font); + isMissing = IsXtermMissingChar(screen, ch, font); ch_width = 1; #endif /* @@ -2997,35 +3003,41 @@ drawXtermText(XtermWidget xw, }); if (isMissing) { - if (last > first) - DrawSegment(first, last); + if (last > first) { + x = drawXtermText(xw, flags | NOTRANSLATION, gc, + x, y, + chrset, text + first, + (unsigned) (last - first), on_wide); + } #if OPT_WIDE_CHARS - if (!ucs_workaround(xw, ch, flags, gc, DrawX(last), y, + if (!ucs_workaround(xw, ch, flags, gc, + x, y, chrset, on_wide)) #endif - xtermDrawBoxChar(xw, ch, flags, gc, DrawX(last), y, ch_width); - if (ch_width > 1) - x += (ch_width - 1) * FontWidth(screen); + { + xtermDrawBoxChar(xw, ch, flags, gc, + x, y, + ch_width); + } + x += (ch_width * FontWidth(screen)); first = last + 1; + drewBoxes = True; } } if (last <= first) { - return x + (int) real_length *FontWidth(screen); + return x; } text += first; -#if OPT_WIDE_CHARS - text2 += first; -#endif len = (Cardinal) (last - first); flags |= NOTRANSLATION; - if (DrawX(first) != x) { + if (drewBoxes) { return drawXtermText(xw, flags, gc, - DrawX(first), + x, y, chrset, - PAIRED_CHARS(text, text2), + text, len, on_wide); } @@ -3039,24 +3051,22 @@ drawXtermText(XtermWidget xw, TRACE(("drawtext%c[%4d,%4d] (%d) %d:%s\n", screen->cursor_state == OFF ? ' ' : '*', y, x, chrset, len, - visibleChars(PAIRED_CHARS(text, text2), len))); + visibleIChars(text, len))); y += FontAscent(screen); #if OPT_WIDE_CHARS + if (screen->wide_chars || screen->unicode_font) { + XChar2b *buffer; Bool needWide = False; int ascent_adjust = 0; int src, dst; - if (screen->draw_len < len) { - screen->draw_len = (len + 1) * 2; - screen->draw_buf = (XChar2b *) XtRealloc((char *) screen->draw_buf, - screen->draw_len * - sizeof(*screen->draw_buf)); - } + BumpTypedBuffer(XChar2b, len); + buffer = BfBuf(XChar2b); for (src = dst = 0; src < (int) len; src++) { - unsigned ch = (unsigned) PACK_PAIR(text, text2, src); + IChar ch = text[src]; if (ch == HIDDEN_CHAR) continue; @@ -3071,21 +3081,20 @@ drawXtermText(XtermWidget xw, /* * bitmap-fonts are limited to 16-bits. */ +#if OPT_WIDER_ICHAR if (ch > 0xffff) { ch = UCS_REPL; - screen->draw_buf[dst].byte2 = LO_BYTE(ch); - screen->draw_buf[dst].byte1 = HI_BYTE(ch); - } else { - screen->draw_buf[dst].byte2 = text[src]; - screen->draw_buf[dst].byte1 = text2[src]; } +#endif + buffer[dst].byte2 = LO_BYTE(ch); + buffer[dst].byte1 = HI_BYTE(ch); #if OPT_MINI_LUIT -#define UCS2SBUF(value) screen->draw_buf[dst].byte2 = LO_BYTE(value);\ - screen->draw_buf[dst].byte1 = HI_BYTE(value) +#define UCS2SBUF(value) buffer[dst].byte2 = LO_BYTE(value);\ + buffer[dst].byte1 = HI_BYTE(value) #define Map2Sbuf(from,to) (text[src] == from) { UCS2SBUF(to); } - if (screen->latin9_mode && !screen->utf8_mode && text2[src] == 0) { + if (screen->latin9_mode && !screen->utf8_mode && text[src] < 256) { /* see http://www.cs.tut.fi/~jkorpela/latin9.html */ /* *INDENT-OFF* */ @@ -3101,7 +3110,6 @@ drawXtermText(XtermWidget xw, } if (screen->unicode_font - && text2[src] == 0 && (text[src] == ANSI_DEL || text[src] < ANSI_SPA)) { unsigned ni = dec2ucs((unsigned) ((text[src] == ANSI_DEL) @@ -3169,12 +3177,12 @@ drawXtermText(XtermWidget xw, XDrawString16(screen->display, VWindow(screen), gc, x, y + ascent_adjust, - screen->draw_buf, dst); + buffer, dst); } else { XDrawImageString16(screen->display, VWindow(screen), gc, x, y + ascent_adjust, - screen->draw_buf, dst); + buffer, dst); } if ((flags & BOLDATTR(screen)) && screen->enbolden) { @@ -3182,7 +3190,7 @@ drawXtermText(XtermWidget xw, XDrawString16(screen->display, VWindow(screen), gc, x + 1, y + ascent_adjust, - screen->draw_buf, dst); + buffer, dst); endClipping(screen, gc); } @@ -3190,19 +3198,31 @@ drawXtermText(XtermWidget xw, #endif /* OPT_WIDE_CHARS */ { int length = (int) len; /* X should have used unsigned */ +#if OPT_WIDE_CHARS + char *buffer; + int dst; + + BumpTypedBuffer(char, len); + buffer = BfBuf(char); + + for (dst = 0; dst < length; ++dst) + buffer[dst] = (char) LO_BYTE(text[dst]); +#else + char *buffer = (char *) text; +#endif if (flags & NOBACKGROUND) { XDrawString(screen->display, VWindow(screen), gc, - x, y, (char *) text, length); + x, y, buffer, length); } else { XDrawImageString(screen->display, VWindow(screen), gc, - x, y, (char *) text, length); + x, y, buffer, length); } underline_len = (Cardinal) length; if ((flags & BOLDATTR(screen)) && screen->enbolden) { beginClipping(screen, gc, font_width, length); XDrawString(screen->display, VWindow(screen), gc, - x + 1, y, (char *) text, length); + x + 1, y, buffer, length); endClipping(screen, gc); } } @@ -3222,52 +3242,16 @@ drawXtermText(XtermWidget xw, * Allocate buffer - workaround for wide-character interfaces. */ void -allocXtermChars(Char ** buffer, Cardinal length) +allocXtermChars(ScrnPtr * buffer, Cardinal length) { if (*buffer == 0) { - *buffer = (Char *) XtMalloc(length); + *buffer = (ScrnPtr) XtMalloc(length); } else { - *buffer = (Char *) XtRealloc((char *) *buffer, length); + *buffer = (ScrnPtr) XtRealloc((char *) *buffer, length); } } #endif -int -drawXtermIChars(XtermWidget xw, - unsigned flags, - GC gc, - int x, - int y, - int chrset, - IChar * text, - Cardinal len, - int on_wide) -{ - int rc = 0; -#if OPT_WIDE_CHARS - static Char *text1 = 0; - static Char *text2 = 0; - static Cardinal used = 0; - Cardinal n; - - if (text != 0) { - if (len >= used) { - used = 1 + (2 * len); - allocXtermChars(&text1, used); - allocXtermChars(&text2, used); - } - for (n = 0; n < len; ++n) { - text1[n] = LO_BYTE(text[n]); - text2[n] = HI_BYTE(text[n]); - } - rc = drawXtermText(xw, flags, gc, x, y, chrset, text1, text2, len, on_wide); - } -#else - rc = drawXtermText(xw, flags, gc, x, y, chrset, text, len, on_wide); -#endif - return rc; -} - /* set up size hints for window manager; min 1 char by 1 char */ void xtermSizeHints(XtermWidget xw, int scrollbarWidth) @@ -3310,7 +3294,7 @@ getXtermSizeHints(XtermWidget xw) if (!XGetWMNormalHints(screen->display, XtWindow(SHELL_OF(xw)), &xw->hints, &supp)) - bzero(&xw->hints, sizeof(xw->hints)); + memset(&xw->hints, 0, sizeof(xw->hints)); TRACE_HINTS(&(xw->hints)); } @@ -3320,7 +3304,7 @@ getXtermSizeHints(XtermWidget xw) * current screen foreground and background colors. */ GC -updatedXtermGC(XtermWidget xw, unsigned flags, unsigned fg_bg, Bool hilite) +updatedXtermGC(XtermWidget xw, unsigned flags, CellColor fg_bg, Bool hilite) { TScreen *screen = &(xw->screen); VTwin *win = WhichVWin(screen); @@ -3454,7 +3438,7 @@ resetXtermGC(XtermWidget xw, unsigned flags, Bool hilite) * BOLD or UNDERLINE color-mode active, those will be used. */ unsigned -extract_fg(XtermWidget xw, unsigned color, unsigned flags) +extract_fg(XtermWidget xw, CellColor color, unsigned flags) { unsigned fg = ExtractForeground(color); @@ -3475,7 +3459,7 @@ extract_fg(XtermWidget xw, unsigned color, unsigned flags) * If we've got INVERSE color-mode active, that will be used. */ unsigned -extract_bg(XtermWidget xw, unsigned color, unsigned flags) +extract_bg(XtermWidget xw, CellColor color, unsigned flags) { unsigned bg = ExtractBackground(color); @@ -3496,16 +3480,13 @@ extract_bg(XtermWidget xw, unsigned color, unsigned flags) * This assumes that fg/bg are equal when we override with one of the special * attribute colors. */ -unsigned +CellColor makeColorPair(int fg, int bg) { unsigned my_bg = (bg >= 0) && (bg < NUM_ANSI_COLORS) ? (unsigned) bg : 0; unsigned my_fg = (fg >= 0) && (fg < NUM_ANSI_COLORS) ? (unsigned) fg : my_bg; -#if OPT_EXT_COLORS - return (my_fg << 8) | my_bg; -#else - return (my_fg << 4) | my_bg; -#endif + + return (CellColor) (my_fg | (my_bg << COLOR_BITS)); } /* @@ -3535,41 +3516,40 @@ ClearCurBackground(XtermWidget xw, #endif /* OPT_ISO_COLORS */ /* - * Returns a single 8/16-bit number for the given cell + * Returns a single base character for the given cell. */ unsigned getXtermCell(TScreen * screen, int row, int col) { - unsigned ch = SCRN_BUF_CHARS(screen, row)[col]; - if_OPT_WIDE_CHARS(screen, { - ch |= (SCRN_BUF_WIDEC(screen, row)[col] << 8); - }); - return ch; + LineData *ld = getLineData(screen, row); + + return ld->charData[col]; } /* - * Sets a single 8/16-bit number for the given cell + * Sets a single base character for the given cell. */ void putXtermCell(TScreen * screen, int row, int col, int ch) { - SCRN_BUF_CHARS(screen, row)[col] = LO_BYTE(ch); + LineData *ld = getLineData(screen, row); + + ld->charData[col] = (CharData) ch; if_OPT_WIDE_CHARS(screen, { - int off; - SCRN_BUF_WIDEC(screen, row)[col] = HI_BYTE(ch); - for (off = OFF_WIDEC + 1; off < MAX_PTRS; ++off) { - SCREEN_PTR(screen, row, off)[col] = 0; + size_t off; + for_each_combData(off, ld) { + ld->combData[off][col] = 0; } }); } #if OPT_WIDE_CHARS unsigned -getXtermCellComb(TScreen * screen, int row, int col, int off) +getXtermCellComb(TScreen * screen, int row, int col, unsigned off) { - return (unsigned) PACK_PAIR(SCREEN_PTR(screen, row, off), - SCREEN_PTR(screen, row, off + 1), - col); + LineData *ld = getLineData(screen, row); + + return (unsigned) ld->combData[off][col]; } /* @@ -3579,16 +3559,15 @@ void addXtermCombining(TScreen * screen, int row, int col, unsigned ch) { if (ch != 0) { - int off; + LineData *ld = getLineData(screen, row); + size_t off; TRACE(("addXtermCombining %d,%d %#x (%d)\n", - row, col, ch, my_wcwidth(ch))); + row, col, ch, my_wcwidth((wchar_t) ch))); - for (off = OFF_FINAL; off < MAX_PTRS; off += 2) { - if (!SCREEN_PTR(screen, row, off + 0)[col] - && !SCREEN_PTR(screen, row, off + 1)[col]) { - SCREEN_PTR(screen, row, off + 0)[col] = LO_BYTE(ch); - SCREEN_PTR(screen, row, off + 1)[col] = HI_BYTE(ch); + for_each_combData(off, ld) { + if (!ld->combData[off][col]) { + ld->combData[off][col] = (CharData) ch; break; } } @@ -3598,11 +3577,14 @@ addXtermCombining(TScreen * screen, int row, int col, unsigned ch) #ifdef HAVE_CONFIG_H #ifdef USE_MY_MEMMOVE -char * -my_memmove(char *s1, char *s2, size_t n) +void * +my_memmove(void *s1, void *s2, size_t n) { if (n != 0) { - if ((s1 + n > s2) && (s2 + n > s1)) { + char *p1 = (char *) s1; + char *p2 = (char *) s2; + + if ((p1 + n > p2) && (p2 + n > p1)) { static char *bfr; static size_t length; size_t j; @@ -3615,11 +3597,11 @@ my_memmove(char *s1, char *s2, size_t n) SysError(ERROR_MMALLOC); } for (j = 0; j < n; j++) - bfr[j] = s2[j]; - s2 = bfr; + bfr[j] = p2[j]; + p2 = bfr; } while (n-- != 0) - s1[n] = s2[n]; + p1[n] = p2[n]; } return s1; } @@ -3792,6 +3774,25 @@ systemWcwidthOk(int samplesize, int samplepass) wchar_t n; int oops = 0; + for (n = 21; n <= 25; ++n) { + int code = (int) dec2ucs((unsigned) n); + int system_code = wcwidth(code); + int intern_code = mk_wcwidth(code); + + /* + * Solaris 10 wcwidth() returns "2" for all of the line-drawing (page + * 0x2500) and most of the geometric shapes (a few are excluded, just + * to make it more difficult to use). Do a sanity check to avoid using + * it. + */ + if ((system_code < 0 && intern_code >= 1) + || (system_code >= 0 && intern_code != system_code)) { + TRACE(("systemWcwidthOk: broken system line-drawing wcwidth\n")); + oops += (samplepass + 1); + break; + } + } + for (n = 0; n < (wchar_t) samplesize; ++n) { int system_code = wcwidth(n); int intern_code = mk_wcwidth(n); diff --git a/app/xterm/version.h b/app/xterm/version.h index 4d009ec65..5b4de28aa 100644 --- a/app/xterm/version.h +++ b/app/xterm/version.h @@ -1,4 +1,4 @@ -/* $XTermId: version.h,v 1.299 2009/02/28 15:56:11 tom Exp $ */ +/* $XTermId: version.h,v 1.302 2009/08/14 09:04:02 tom Exp $ */ /* * These definitions are used to build the string that's printed in response to @@ -6,7 +6,7 @@ * version of X to which this version of xterm has been built. The number in * parentheses is my patch number (Thomas E. Dickey). */ -#define XTERM_PATCH 243 +#define XTERM_PATCH 246 #ifndef __vendorversion__ #define __vendorversion__ "XTerm/OpenBSD" diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h index 79aa6beed..25d308429 100644 --- a/app/xterm/xterm.h +++ b/app/xterm/xterm.h @@ -1,4 +1,4 @@ -/* $XTermId: xterm.h,v 1.523 2009/03/28 14:56:54 tom Exp $ */ +/* $XTermId: xterm.h,v 1.581 2009/08/08 14:04:16 tom Exp $ */ /************************************************************ @@ -274,8 +274,6 @@ extern int errno; #endif #if OPT_WIDE_CHARS -#define HIDDEN_HI 0xff -#define HIDDEN_LO 0xff #define HIDDEN_CHAR 0xffff #endif @@ -393,6 +391,7 @@ extern char **environ; #define XtNfaceName "faceName" #define XtNfaceNameDoublesize "faceNameDoublesize" #define XtNfaceSize "faceSize" +#define XtNfastScroll "fastScroll" #define XtNfont1 "font1" #define XtNfont2 "font2" #define XtNfont3 "font3" @@ -457,6 +456,7 @@ extern char **environ; #define XtNquietGrab "quietGrab" #define XtNrenderFont "renderFont" #define XtNresizeGravity "resizeGravity" +#define XtNretryInputMethod "retryInputMethod" #define XtNreverseWrap "reverseWrap" #define XtNrightScrollBar "rightScrollBar" #define XtNsaveLines "saveLines" @@ -550,6 +550,7 @@ extern char **environ; #define XtCFaceName "FaceName" #define XtCFaceNameDoublesize "FaceNameDoublesize" #define XtCFaceSize "FaceSize" +#define XtCFastScroll "FastScroll" #define XtCFont1 "Font1" #define XtCFont2 "Font2" #define XtCFont3 "Font3" @@ -606,6 +607,7 @@ extern char **environ; #define XtCQuietGrab "QuietGrab" #define XtCRenderFont "RenderFont" #define XtCResizeGravity "ResizeGravity" +#define XtCRetryInputMethod "RetryInputMethod" #define XtCReverseWrap "ReverseWrap" #define XtCRightScrollBar "RightScrollBar" #define XtCSaveLines "SaveLines" @@ -687,7 +689,7 @@ extern void TekRefresh (TekWidget /* tw */); extern void TekRepaint (TekWidget /* xw */); extern void TekReverseVideo (TekWidget /* tw */); extern void TekRun (void); -extern void TekSetFontSize (TekWidget /* tw */, int /* newitem */); +extern void TekSetFontSize (TekWidget /* tw */, Bool /* fromMenu */, int /* newitem */); extern void TekSimulatePageButton (TekWidget /* tw */, Bool /* reset */); #endif @@ -746,7 +748,7 @@ extern void ReadLineButton PROTO_XT_ACTIONS_ARGS; #if OPT_WIDE_CHARS extern Bool iswide(int /* i */); #define FIRST_WIDECHAR 256 -#define isWide(n) ((n) >= FIRST_WIDECHAR && iswide(n)) +#define isWide(n) ((int) (n) >= FIRST_WIDECHAR && iswide(n)) #endif /* cachedCgs.c */ @@ -771,7 +773,7 @@ extern void noleaks_cachedCgs (XtermWidget /* xw */); /* charproc.c */ extern Bool CheckBufPtrs (TScreen * /* screen */); -extern int VTInit (void); +extern int VTInit (XtermWidget /* xw */); extern int v_write (int /* f */, Char * /* d */, unsigned /* len */); extern void FindFontSelection (XtermWidget /* xw */, const char * /* atom_name */, Bool /* justprobe */); extern void HideCursor (void); @@ -779,7 +781,7 @@ extern void ShowCursor (void); extern void SwitchBufPtrs (TScreen * /* screen */); extern void ToggleAlternate (XtermWidget /* xw */); extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */); -extern void VTRun (void); +extern void VTRun (XtermWidget /* xw */); extern void dotext (XtermWidget /* xw */, int /* charset */, IChar * /* buf */, Cardinal /* len */); extern void releaseCursorGCs(XtermWidget /*xw*/); extern void releaseWindowGCs(XtermWidget /*xw*/, VTwin * /*win*/); @@ -856,6 +858,15 @@ extern void StringInput (XtermWidget /* xw */, Char * /* string */, size_t /* n extern void VTInitModifiers(XtermWidget /* xw */); #endif +/* linedata.c */ +extern LineData *getLineData(TScreen * /* screen */, int /* row */); +extern void copyLineData(LineData * /* dst */, LineData * /* src */); +extern void initLineData(XtermWidget /* xw */); + +extern CellData *newCellData(XtermWidget /* xw */, Cardinal /* count */); +extern void saveCellData(TScreen * /* screen */, CellData * /* data */, Cardinal /* cell */, LineData * /* ld */, int /* column */); +extern void restoreCellData(TScreen * /* screen */, CellData * /* data */, Cardinal /* cell */, LineData * /* ld */, int /* column */); + /* main.c */ #ifndef __UNIXOS2__ #define ENVP_ARG /**/ @@ -978,12 +989,13 @@ extern void FlushLog (TScreen * /* screen */); #endif /* print.c */ -extern Bool xtermHasPrinter (void); -extern int xtermPrinterControl (int /* chr */); -extern void setPrinterControlMode (int /* mode */); -extern void xtermAutoPrint (unsigned /* chr */); -extern void xtermMediaControl (int /* param */, int /* private_seq */); -extern void xtermPrintScreen (Bool /* use_DECPEX */); +extern Bool xtermHasPrinter (XtermWidget /* xw */); +extern int xtermPrinterControl (XtermWidget /* xw */, int /* chr */); +extern void setPrinterControlMode (XtermWidget /* xw */, int /* mode */); +extern void xtermAutoPrint (XtermWidget /* xw */, unsigned /* chr */); +extern void xtermMediaControl (XtermWidget /* xw */, int /* param */, int /* private_seq */); +extern void xtermPrintScreen (XtermWidget /* xw */, Bool /* use_DECPEX */); +extern void xtermPrintEverything (XtermWidget /* xw */); /* ptydata.c */ #ifdef VMS @@ -1003,13 +1015,19 @@ extern void noleaks_ptydata ( void ); #endif #if OPT_WIDE_CHARS -extern Bool morePtyData (TScreen * /* screen */, PtyData * /* data */); extern Char *convertToUTF8 (Char * /* lp */, unsigned /* c */); extern IChar nextPtyData (TScreen * /* screen */, PtyData * /* data */); extern IChar skipPtyData (PtyData * /* data */); extern PtyData * fakePtyData(PtyData * /* result */, Char * /* next */, Char * /* last */); extern void switchPtyData (TScreen * /* screen */, int /* f */); extern void writePtyData (int /* f */, IChar * /* d */, unsigned /* len */); + +#define morePtyData(screen,data) \ + (((data)->last > (data)->next) \ + ? (((screen)->utf8_inparse && !(data)->utf_size) \ + ? decodeUtf8(data) \ + : True) \ + : False) #else #define morePtyData(screen, data) ((data)->last > (data)->next) #define nextPtyData(screen, data) (*((data)->next++) & \ @@ -1021,48 +1039,48 @@ 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 ScrnBuf Allocate (int /* nrow */, int /* ncol */, Char ** /* addr */); +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 ScrnAllocBuf (XtermWidget /* xw */); extern void ScrnClearCells (XtermWidget /* xw */, int /* row */, int /* col */, unsigned /* len */); extern void ScrnDeleteChar (XtermWidget /* xw */, unsigned /* n */); -extern void ScrnDeleteLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* n */, int /* last */, unsigned /* size */, unsigned /* where */); +extern void ScrnDeleteLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* n */, int /* last */, unsigned /* where */); extern void ScrnDisownSelection (XtermWidget /* xw */); extern void ScrnFillRectangle (XtermWidget /* xw */, XTermRect *, int , unsigned /* flags */, Bool /* keepColors */); extern void ScrnInsertChar (XtermWidget /* xw */, unsigned /* n */); -extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last */, int /* where */, unsigned /* n */, unsigned /* size */); +extern void ScrnInsertLine (XtermWidget /* xw */, ScrnBuf /* sb */, int /* last */, int /* where */, unsigned /* n */); extern void ScrnRefresh (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); extern void ScrnUpdate (XtermWidget /* xw */, int /* toprow */, int /* leftcol */, int /* nrows */, int /* ncols */, Bool /* force */); -extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned /* flags */, unsigned /* cur_fg_bg */, unsigned /* length */); +extern void ScrnWriteText (XtermWidget /* xw */, IChar * /* str */, unsigned /* flags */, CellColor /* cur_fg_bg */, unsigned /* length */); +extern void setupLineData (TScreen * /* screen */, ScrnBuf /* base */, Char * /* data */, unsigned /* nrow */, unsigned /* ncol */); extern void xtermParseRect (XtermWidget /* xw */, int, int *, XTermRect *); #if OPT_TRACE && OPT_TRACE_FLAGS -extern int ScrnTstFlag(TScreen * /* screen */, int /* row */, int /* flag */); -extern void ScrnClrFlag(TScreen * /* screen */, int /* row */, int /* flag */); -extern void ScrnSetFlag(TScreen * /* screen */, int /* row */, int /* flag */); +extern int LineTstFlag(LineData /* ld */, int /* flag */); +extern void LineClrFlag(LineData /* ld */, int /* flag */); +extern void LineSetFlag(LineData /* ld */, int /* flag */); #else -#define ScrnClrFlag(screen, row, flag) \ - SCRN_BUF_FLAGS(screen, row) = \ - (Char *)((long)SCRN_BUF_FLAGS(screen, row) & ~ (flag)) -#define ScrnSetFlag(screen, row, flag) \ - SCRN_BUF_FLAGS(screen, row) = \ - (Char *)(((long)SCRN_BUF_FLAGS(screen, row) | (flag))) +#define LineFlags(ld) GetLineFlags(ld) + +#define LineClrFlag(ld, flag) SetLineFlags(ld, (GetLineFlags(ld) & ~ (flag))) +#define LineSetFlag(ld, flag) SetLineFlags(ld, (GetLineFlags(ld) | (flag))) +#define LineTstFlag(ld, flag) ((GetLineFlags(ld) & flag) != 0) -#define ScrnTstFlag(screen, row, flag) \ - (okScrnRow(screen, row) && \ - ((long)SCRN_BUF_FLAGS(screen, row) & (flag)) != 0) #endif /* OPT_TRACE && OPT_TRACE_FLAGS */ -#define ScrnClrBlinked(screen, row) ScrnClrFlag(screen, ROW2INX(screen, row), BLINK) -#define ScrnSetBlinked(screen, row) ScrnSetFlag(screen, ROW2INX(screen, row), BLINK) -#define ScrnTstBlinked(screen, row) ScrnTstFlag(screen, ROW2INX(screen, row), BLINK) +#define LineClrBlinked(ld) LineClrFlag(ld, LINEBLINKED) +#define LineSetBlinked(ld) LineSetFlag(ld, LINEBLINKED) +#define LineTstBlinked(ld) LineTstFlag(ld, LINEBLINKED) -#define ScrnClrWrapped(screen, row) ScrnClrFlag(screen, ROW2INX(screen, row), LINEWRAPPED) -#define ScrnSetWrapped(screen, row) ScrnSetFlag(screen, ROW2INX(screen, row), LINEWRAPPED) -#define ScrnTstWrapped(screen, row) ScrnTstFlag(screen, ROW2INX(screen, row), LINEWRAPPED) +#define LineClrWrapped(ld) LineClrFlag(ld, LINEWRAPPED) +#define LineSetWrapped(ld) LineSetFlag(ld, LINEWRAPPED) +#define LineTstWrapped(ld) LineTstFlag(ld, LINEWRAPPED) #define ScrnHaveSelection(screen) \ ((screen)->startH.row != (screen)->endH.row \ @@ -1091,6 +1109,11 @@ extern void ScrnWipeRectangle (XtermWidget /* xw */, XTermRect *); extern void ChangeToWide(XtermWidget /* xw */); #endif +/* scrollback.c */ +extern LineData *getScrollback (TScreen * /* screen */, int /* row */); +extern LineData *addScrollback (TScreen * /* screen */); +extern void deleteScrollback (TScreen * /* screen */, int /* row */); + /* scrollbar.c */ extern void DoResizeScreen (XtermWidget /* xw */); extern void HandleScrollBack PROTO_XT_ACTIONS_ARGS; @@ -1098,7 +1121,7 @@ extern void HandleScrollForward PROTO_XT_ACTIONS_ARGS; extern void ResizeScrollBar (XtermWidget /* xw */); extern void ScrollBarDrawThumb (Widget /* scrollWidget */); extern void ScrollBarOff (XtermWidget /* xw */); -extern void ScrollBarOn (XtermWidget /* xw */, int /* init */, int /* doalloc */); +extern void ScrollBarOn (XtermWidget /* xw */, Bool /* init */); extern void ScrollBarReverseVideo (Widget /* scrollWidget */); extern void ToggleScrollBar (XtermWidget /* xw */); extern void WindowScroll (XtermWidget /* xw */, int /* top */); @@ -1120,12 +1143,11 @@ extern void TabZonk (Tabs /* tabs */); /* util.c */ 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 GC updatedXtermGC (XtermWidget /* xw */, unsigned /* flags */, CellColor /* 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 drawXtermIChars(XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, IChar * /* text */, Cardinal /* len */, int /* on_wide */); -extern int drawXtermText (XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, PAIRED_CHARS(Char * /* text */, Char * /* text2 */), Cardinal /* len */, int /* on_wide */); +extern int drawXtermText (XtermWidget /* xw */, unsigned /* flags */, GC /* gc */, int /* x */, int /* y */, int /* chrset */, IChar * /* text */, Cardinal /* len */, int /* on_wide */); extern void ChangeColors (XtermWidget /* xw */, ScrnColors * /* pNew */); extern void ClearRight (XtermWidget /* xw */, int /* n */); extern void ClearScreen (XtermWidget /* xw */); @@ -1157,9 +1179,9 @@ extern void xtermSizeHints (XtermWidget /* xw */, int /* scrollbarWidth */); #if OPT_ISO_COLORS -extern unsigned extract_fg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */); -extern unsigned extract_bg (XtermWidget /* xw */, unsigned /* color */, unsigned /* flags */); -extern unsigned makeColorPair (int /* fg */, int /* bg */); +extern unsigned extract_fg (XtermWidget /* xw */, CellColor /* color */, unsigned /* flags */); +extern unsigned extract_bg (XtermWidget /* xw */, CellColor /* color */, unsigned /* flags */); +extern CellColor makeColorPair (int /* fg */, int /* bg */); extern void ClearCurBackground (XtermWidget /* xw */, int /* top */, int /* left */, unsigned /* height */, unsigned /* width */); #define xtermColorPair(xw) makeColorPair(xw->sgr_foreground, xw->sgr_background) @@ -1187,13 +1209,8 @@ extern Pixel xtermGetColorRes(ColorRes *res); #define T_COLOR(v,n) (v)->Tcolors[n] #endif -#if OPT_EXT_COLORS -#define ExtractForeground(color) ((color >> 8) & 0xff) -#define ExtractBackground(color) (color & 0xff) -#else -#define ExtractForeground(color) ((color >> 4) & 0xf) -#define ExtractBackground(color) (color & 0xf) -#endif +#define ExtractForeground(color) (unsigned) GetCellColorFG(color) +#define ExtractBackground(color) (unsigned) GetCellColorBG(color) #define checkVeryBoldAttr(flags, fg, code, attr) \ if ((flags & FG_COLOR) != 0 \ @@ -1231,15 +1248,6 @@ extern Pixel xtermGetColorRes(ColorRes *res); #endif /* OPT_ISO_COLORS */ -#if OPT_DEC_CHRSET -#define curXtermChrSet(xw, row) \ - ((CSET_DOUBLE(SCRN_ROW_CSET((&xw->screen), row))) \ - ? SCRN_ROW_CSET((&xw->screen), row) \ - : (xw->screen).cur_chrset) -#else -#define curXtermChrSet(xw, row) 0 -#endif - #define XTERM_CELL(row,col) getXtermCell(screen, ROW2INX(screen, row), col) #define XTERM_CELLC(row,col,n) getXtermCellComb(screen, ROW2INX(screen, row), col, n) @@ -1264,9 +1272,9 @@ extern Boolean isWideControl(unsigned /* ch */); extern int DamagedCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */, int /* row */, int /* col */); extern int DamagedCurCells(TScreen * /* screen */, unsigned /* n */, int * /* klp */, int * /* krp */); extern unsigned AsciiEquivs(unsigned /* ch */); -extern unsigned getXtermCellComb (TScreen * /* screen */, int /* row */, int /* col */, int /* off */); +extern unsigned getXtermCellComb (TScreen * /* screen */, int /* row */, int /* col */, unsigned /* off */); extern void addXtermCombining (TScreen * /* screen */, int /* row */, int /* col */, unsigned /* ch */); -extern void allocXtermChars(Char ** /* buffer */, Cardinal /* length */); +extern void allocXtermChars(ScrnPtr * /* buffer */, Cardinal /* length */); #endif #if OPT_XMC_GLITCH diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html index 4b8e008ac..a2719afe4 100644 --- a/app/xterm/xterm.log.html +++ b/app/xterm/xterm.log.html @@ -1,4 +1,4 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +t<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- ***************************************************************************** * Copyright 1996-2008,2009 by Thomas E. Dickey * @@ -20,7 +20,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ***************************************************************************** - $XTermId: xterm.log.html,v 1.744 2009/03/29 00:29:55 tom Exp $ + $XTermId: xterm.log.html,v 1.781 2009/08/16 22:51:21 tom Exp $ --> <HTML> <HEAD> @@ -45,6 +45,9 @@ Most of these are summarized in the XFree86 CHANGELOG is the latest version of this file. <UL> +<LI><A HREF="#xterm_246">Patch #246 - 2009/8/16</A> +<LI><A HREF="#xterm_245">Patch #245 - 2009/8/12</A> +<LI><A HREF="#xterm_244">Patch #244 - 2009/8/9</A> <LI><A HREF="#xterm_243">Patch #243 - 2009/3/28</A> <LI><A HREF="#xterm_242">Patch #242 - 2009/2/15</A> <LI><A HREF="#xterm_241">Patch #241 - 2009/1/26</A> @@ -291,6 +294,138 @@ is the latest version of this file. <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A> </UL> +<H1><A NAME="xterm_246">Patch #246 - 2009/8/16</A></H1> +<ul> + <li>remove obsolete logic for saving/restoring wrapping flags, which + did not work on 64-bit platform. Wrapping flags (stored in the + line-index) are now copied with line-data (Debian #541160). + + <li>modify comments in app-defaults files to avoid problem with + C preprocessor used by <code>xrdb</code> (Debian #541603). + + <li>restore special case in <code>makeColorPair</code>, + needed for <code>colorBDMode</code> resource (Debian #541089). + + <li>correct <code>SetLineFlags()</code> macro, broken in + <a href="#xterm_244">patch #244</a> + when recoding to avoid gcc-specific bitfields (Debian #541236). + + <li>modify initialization of screen buffers to ensure that pointers + align to int-boundaries. + This fixes a problem introduced in + <a href="#xterm_244">patch #244</a> + where the color- and character-arrays + (stored after the video-attributes in each row) + might be misaligned (report by Rajeev V Pillai). + + <li>add limit-check in <code>ScrnRefresh</code> for handling + saved-lines from the circular buffer which are repainted on a + screen whose width has increased. To improve performance, circular + buffer entries are not resized (report by Rajeev V Pillai). + + <li>correct type for <code>CellColor</code> (a late change in + <a href="#xterm_244">patch #244</a> + to avoid gcc-specifc enums made that unsigned + rather than unsigned short, for the 256-color option). + + <li>fix typo in configure option --enable-16bit-chars (report by + Rajeev V. Pillai). +</ul> + +<H1><A NAME="xterm_245">Patch #245 - 2009/8/12</A></H1> +<ul> + <li>correct a special case in saving FIFO-lines from + <a href="#xterm_244">patch #244</a>. + If the screen was shrunk, xterm used the wrong amount for copying + to FIFO-lines, and then used this amount to adjust the current + row on the screen. That was both a visible defect (Debian #541109) + as well as a potential addressing error (Debian #541132, #541160, + and #541236). + + <li>add clarification in xterm manual about the + various <code>allow<em>XXX</em>Ops</code> resources, which + are disabled when the + <code>allowSendEvents</code> resource is active (patch by + Julien Cristau, Debian #531597). +</ul> + +<H1><A NAME="xterm_244">Patch #244 - 2009/8/9</A></H1> +<ul> + <li>refactored storage of saved-lines, providing a configure option + to manage them as a FIFO (actually a circular buffer), improving + performance. + Added configure option <code>--enable-fifo-lines</code> to + enable/disable the new feature (it is enabled by default). + + <li>added <code>fastScroll</code> resource, to amuse + people who measure terminal emulator performance by + <code>cat</code>'ing large files to the screen. + + <li>modify check in <code>readPtyData</code> from return values + to provide exit on zero-bytes read from pty for FreeBSD, or + eliminate high-CPU in "xterm-hold" processing + (discussion with Ulrich Spoerlein, FreeBSD ports/136686). + The check was originally modified to combine negative/zero + values in XFree86-3.1.2E, 1996/05/06. + + <li>add configure option <code>--enable-16bit-chars</code> to + provide wide-characters with 16-bits (rather than the default + 32-bits). + + <li>add <code>retryInputMethod</code> resource to allow configuring + out the retries xterm uses to connect to non-responsive XIM + server, to work around defective X configurations as noted in + <a href="http://mail-index.netbsd.org/tech-x11/2009/06/07/msg000511.html">NetBSD mailing list</a>. + + <li>make regular-expression selection work for VT100 double-sized + characters. + + <li>improve layout when drawing missing characters in a proportional + font, e.g., as boxes, to take into account whether they are + double-width (report by Guilbert Stabilo on comp.unix.shell). + + <li>add capability for keypad-center (kb2/KA2) to termcap entry for + xterm-new, as well as xterm-8bit, xterm-sun and xterm-vt220 + (FreeBSD conf/136336). + + <li>change default for <code>keepSelection</code> resource to true + (prompted by discussion with David Muir Sharnoff). + + <li>remove a limit-check in ptydata.c, allowing Unicode values past + 64k to be displayed using TrueType fonts (Debian #458432). + + <li>remove a vt52-specific ifdef to allow mapping F1-F4 to PF1-PF4 + when vt52 support is not compiled (report by Olaf 'Rhialto' + Seibert). + + <li>save/restore line-wrapping flags when converting from ISO-8859-1 + encoding to UTF-8 encoding, as well as when resizing screen. + + <li>remove extra adjustment of position in fix for Debian #418324. + + <li>modify default check for <code>mkWidth</code> resource to check + for line-drawing characters, which are categorized as double-width + in Solaris 10 (report by Sebastian Kayser). + + <li>add "print-everything" action (patch by Ovidiu Gheorghioiu). + + <li>start refactoring scrollback data using new getLineData() function. + + <li>demote recent change to Debian #252873 fix to experimental, + ifdef'd out as <code>EXP_BOGUS_FG</code> (Debian #522141). + + <li>work around groff mapping of ASCII quotes using macros (requested + by Reuben Thomas based on Colin Watson advice, fixes Debian #378700). + + <li>correct symbol used for default of <code>allowWindowOps</code> + which was <code>DEF_ALLOW_FONT</code> + rather than <code>DEF_ALLOW_WINDOW</code> + (report by Matthieu Herrb). + + <li>amend fix for tek4014 from <a href="#xterm_243">patch #243</a> + to make it only apply to the Tek Options menu. +</ul> + <H1><A NAME="xterm_243">Patch #243 - 2009/3/28</A></H1> <ul> <li>revert change to default for <code>allowTcapOps</code> (request by diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man index 6aaea1457..9055fd5ca 100644 --- a/app/xterm/xterm.man +++ b/app/xterm/xterm.man @@ -1,5 +1,5 @@ '\" t -.\" $XTermId: xterm.man,v 1.423 2009/03/25 22:39:57 tom Exp $ +.\" $XTermId: xterm.man,v 1.433 2009/08/13 01:18:00 tom Exp $ .\" .\" Copyright 1996-2008,2009 by Thomas E. Dickey .\" @@ -70,6 +70,13 @@ .sp .in -4 .. +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds AQ \(aq +.el .ds AQ ' +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' .TH XTERM 1 __vendorversion__ .SH NAME xterm \- terminal emulator for X @@ -96,11 +103,11 @@ This box is located in the upper left area of the window. . .PP Although both windows may be displayed at the same time, one of them is -considered the ``active'' window for receiving keyboard input and terminal +considered the \*(``active\*('' window for receiving keyboard input and terminal output. This is the window that contains the text cursor. The active window can be chosen through escape sequences, -the ``VT Options'' menu in the VTxxx window, and the ``Tek Options'' +the \*(``VT Options\*('' menu in the VTxxx window, and the \*(``Tek Options\*('' menu in the 4014 window. . .SH EMULATIONS @@ -114,13 +121,17 @@ entries that work with .I xterm include an optional platform-specific entry, -``xterm,'' ``vt102,'' ``vt100'' and ``ansi,'' and ``dumb.'' +\*(``xterm,\*('' +\*(``vt102,\*('' +\*(``vt100,\*('' +\*(``ansi\*('' and +\*(``dumb.\*('' .I xterm automatically searches the termcap file in this order for these entries and then -sets the ``TERM'' and the ``TERMCAP'' environment variables. -You may also use ``vt220,'' but must set the terminal emulation level +sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables. +You may also use \*(``vt220,\*('' but must set the terminal emulation level with the \fBdecTerminalID\fP resource. -(The ``TERMCAP'' environment variable is not set if \fIxterm\fP is linked +(The \*(``TERMCAP\*('' environment variable is not set if \fIxterm\fP is linked against a terminfo library, since the requisite information is not provided by the termcap emulation of terminfo libraries). . @@ -146,7 +157,7 @@ the .B Tektronix menu; see below). The name of the file will be -``\fBCOPY\fIyyyy\fB-\fIMM\fB-\fIdd\fB.\fIhh\fB:\fImm\fB:\fIss\fR'', where +\*(``\fBCOPY\fIyyyy\fB-\fIMM\fB-\fIdd\fB.\fIhh\fB:\fImm\fB:\fIss\fR\*('', where .IR yyyy , .IR MM , .IR dd , @@ -284,13 +295,13 @@ should do text cursor highlighting based on focus. This option disables active icon support if that feature was compiled into \fIxterm\fP. This is equivalent to setting the \fIvt100\fP resource -\fBactiveIcon\fP to ``false''. +\fBactiveIcon\fP to \*(``false\*(''. .TP 8 .B +ai This option enables active icon support if that feature was compiled into \fIxterm\fP. This is equivalent to setting the \fIvt100\fP resource -\fBactiveIcon\fP to ``true''. +\fBactiveIcon\fP to \*(``true\*(''. .TP 8 .B -aw This option indicates that auto-wraparound should be allowed. @@ -326,19 +337,19 @@ set the amount of time text cursor is on when blinking via the \fIcursorOffTime\fP resource. .TP 8 .B "-bdc" -Set the \fIvt100\fP resource \fBcolorBDMode\fR to ``false'', +Set the \fIvt100\fP resource \fBcolorBDMode\fR to \*(``false\*('', disabling the display of characters with bold attribute as color .TP 8 .B "+bdc" -Set the \fIvt100\fP resource \fBcolorBDMode\fR to ``true'', +Set the \fIvt100\fP resource \fBcolorBDMode\fR to \*(``true\*('', enabling the display of characters with bold attribute as color rather than bold .TP 8 .B "-cb" -Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to ``false''. +Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to \*(``false\*(''. .TP 8 .B "+cb" -Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to ``true''. +Set the \fIvt100\fP resource \fBcutToBeginningOfLine\fP to \*(``true\*(''. .TP 8 .B "-cc \fIcharacterclassrange\fP:\fIvalue\fP[,...]" This sets classes indicated by the given ranges for using in selecting by @@ -347,7 +358,7 @@ See the section specifying character classes. and discussion of the \fIcharClass\fP resource. .TP 8 .B "-cjk_width" -Set the \fBcjkWidth\fP resource to ``true''. +Set the \fBcjkWidth\fP resource to \*(``true\*(''. When turned on, characters with East Asian Ambiguous (A) category in UTR 11 have a column width of 2. Otherwise, they have a column width of 1. @@ -357,19 +368,19 @@ width of 2. It also should be turned on when you specify a TrueType CJK double-width (bi-width/monospace) font either with \fB-fa\fP at the command line or \fBfaceName\fP resource. -The default is ``false'' +The default is \*(``false\*('' .TP 8 .B "+cjk_width" Reset the \fBcjkWidth\fP resource. .TP 8 .BI -class " string" This option allows you to override \fIxterm\fP's resource class. -Normally it is ``XTerm'', but -can be set to another class such as ``UXTerm'' to override selected resources. +Normally it is \*(``XTerm\*('', but +can be set to another class such as \*(``UXTerm\*('' to override selected resources. .TP 8 .B "-cm" This option disables recognition of ANSI color-change escape sequences. -It sets the \fIcolorMode\fP resource to ``false''. +It sets the \fIcolorMode\fP resource to \*(``false\*(''. .TP 8 .B "+cm" This option enables recognition of ANSI color-change escape sequences. @@ -378,11 +389,11 @@ This is the same as the \fIvt100\fP resource \fBcolorMode\fP. .B "-cn" This option indicates that newlines should not be cut in line-mode selections. -It sets the \fIcutNewline\fP resource to ``false''. +It sets the \fIcutNewline\fP resource to \*(``false\*(''. .TP 8 .B +cn This option indicates that newlines should be cut in line-mode selections. -It sets the \fIcutNewline\fP resource to ``true''. +It sets the \fIcutNewline\fP resource to \*(``true\*(''. .TP 8 .BI -cr " color" This option specifies the color to use for text cursor. @@ -415,11 +426,11 @@ the pointer cursor foreground and background colors, the Tektronix emulator foreground and background colors, its text cursor color and highlight color. -The option sets the \fIdynamicColors\fP option to ``false''. +The option sets the \fIdynamicColors\fP option to \*(``false\*(''. .TP 8 .B "+dc" This option enables the escape sequence to change dynamic colors. -The option sets the \fIdynamicColors\fP option to ``true''. +The option sets the \fIdynamicColors\fP option to \*(``true\*(''. .TP 8 .BI -e " program \fP[ \fIarguments \fP.\|.\|. ]\fI" This option specifies the program (and its command line arguments) to be @@ -458,23 +469,23 @@ initially active. .BI -fbb This option indicates that \fIxterm\fP should compare normal and bold fonts bounding boxes to ensure they are compatible. -It sets the \fBfreeBoldBox\fP resource to ``false''. +It sets the \fBfreeBoldBox\fP resource to \*(``false\*(''. .TP 8 .BI +fbb This option indicates that \fIxterm\fP should not compare normal and bold fonts bounding boxes to ensure they are compatible. -It sets the \fBfreeBoldBox\fP resource to ``true''. +It sets the \fBfreeBoldBox\fP resource to \*(``true\*(''. .TP 8 .BI -fbx This option indicates that \fIxterm\fP should not assume that the normal and bold fonts have VT100 line-drawing characters. If any are missing, \fIxterm\fP will draw the characters directly. -It sets the \fBforceBoxChars\fP resource to ``false''. +It sets the \fBforceBoxChars\fP resource to \*(``false\*(''. .TP 8 .BI +fbx This option indicates that \fIxterm\fP should assume that the normal and bold fonts have VT100 line-drawing characters. -It sets the \fBforceBoxChars\fP resource to ``true''. +It sets the \fBforceBoxChars\fP resource to \*(``true\*(''. .TP 8 .BI -fd " pattern" This option sets the pattern for double-width fonts selected from the FreeType @@ -520,24 +531,24 @@ See also the discussion of the \fBximFont\fP resource. .BI -hf This option indicates that HP Function Key escape codes should be generated for function keys. -It sets the \fBhpFunctionKeys\fP resource to ``true''. +It sets the \fBhpFunctionKeys\fP resource to \*(``true\*(''. .TP 8 .BI +hf This option indicates that HP Function Key escape codes should not be generated for function keys. -It sets the \fBhpFunctionKeys\fP resource to ``false''. +It sets the \fBhpFunctionKeys\fP resource to \*(``false\*(''. .TP 8 .BI -hm Tells \fIxterm\fP to use \fBhighlightTextColor\fP and \fBhighlightColor\fP to override the reversed foreground/background colors in a selection. -It sets the \fBhighlightColorMode\fP resource to ``true''. +It sets the \fBhighlightColorMode\fP resource to \*(``true\*(''. .TP 8 .BI +hm Tells \fIxterm\fP not to use \fBhighlightTextColor\fP and \fBhighlightColor\fP to override the reversed foreground/background colors in a selection. -It sets the \fBhighlightColorMode\fP resource to ``false''. +It sets the \fBhighlightColorMode\fP resource to \*(``false\*(''. .TP 8 .BI -hold Turn on the \fBhold\fP resource, i.e., @@ -581,7 +592,7 @@ Its use is strongly recommended since it makes \fIxterm\fP much faster when scanning through large amounts of text. The VT100 escape sequences for enabling and -disabling smooth scroll as well as the ``VT Options'' +disabling smooth scroll as well as the \*(``VT Options\*('' menu can be used to turn this feature on or off. .TP 8 @@ -599,18 +610,18 @@ This option resets the \fBallowC1Printable\fP resource. .BI -kt " keyboardtype" This option sets the \fBkeyboardType\fP resource. Possible values include: -``unknown'', -``default'', -``hp'', -``sco'', -``sun'', -``tcap'' and -``vt220''. +\*(``unknown\*('', +\*(``default\*('', +\*(``hp\*('', +\*(``sco\*('', +\*(``sun\*('', +\*(``tcap\*('' and +\*(``vt220\*(''. .IP -The value ``unknown'', +The value \*(``unknown\*('', causes the corresponding resource to be ignored. .IP -The value ``default'', +The value \*(``default\*('', suppresses the associated resources .BR hpFunctionKeys , .BR scoFunctionKeys , @@ -709,13 +720,13 @@ maximize its layout on startup. .TP 8 .B +ls This option indicates that the shell that is started should not be a login -shell (i.e., it will be a normal ``subshell''). +shell (i.e., it will be a normal \*(``subshell\*(''). .TP 8 .B -mb This option indicates that \fIxterm\fP should ring a margin bell when the user types near the right end of a line. This option can be turned on -and off from the ``VT Options'' menu. +and off from the \*(``VT Options\*('' menu. .TP 8 .B +mb This option indicates that margin bell should not be rung. @@ -732,10 +743,10 @@ Turn on the \fBmessages\fP resource, i.e., allow write access to the terminal. .TP 8 .B "-mk_width" -Set the \fBmkWidth\fP resource to ``true''. +Set the \fBmkWidth\fP resource to \*(``true\*(''. This makes \fIxterm\fP use a built-in version of the wide-character width calculation. -The default is ``false'' +The default is \*(``false\*('' .TP 8 .B "+mk_width" Reset the \fBmkWidth\fP resource. @@ -789,7 +800,7 @@ column of the previous line. This is very useful for editing long shell command lines and is encouraged. This option can be turned on and off from -the ``VT Options'' menu. +the \*(``VT Options\*('' menu. .TP 8 .B +rw This option indicates that reverse-wraparound should not be allowed. @@ -821,7 +832,7 @@ This option indicates that some number of lines that are scrolled off the top of the window should be saved and that a scrollbar should be displayed so that those lines can be viewed. This option may be turned on and off from the -``VT Options'' menu. +\*(``VT Options\*('' menu. .TP 8 .B +sb This option indicates that a scrollbar should not be displayed. @@ -847,7 +858,7 @@ function keys. .B -si This option indicates that output to a window should not automatically reposition the screen to the bottom of the scrolling region. -This option can be turned on and off from the ``VT Options'' menu. +This option can be turned on and off from the \*(``VT Options\*('' menu. .TP 8 .B +si This option indicates that output to a window should cause it to @@ -880,7 +891,7 @@ not set up session manager callbacks. .TP 8 .B -sp This option indicates that Sun/PC keyboard should be assumed, -providing mapping for keypad `+' to `,', and +providing mapping for keypad \*(``+' to \*(``,', and CTRL-F1 to F13, CTRL-F2 to F14, etc. .TP 8 .B +sp @@ -891,14 +902,19 @@ keypad and function keys. This option indicates that \fIxterm\fP should start in Tektronix mode, rather than in VT102 mode. Switching between the two windows is done using the -``Options'' menus. +\*(``Options\*('' menus. .IR Termcap (5) entries that work with .I xterm -``tek4014,'' ``tek4015,'' ``tek4012'', ``tek4013'' and ``tek4010,'' and ``dumb.'' +\*(``tek4014,\*('' +\*(``tek4015,\*('' +\*(``tek4012,\*('' +\*(``tek4013,\*('' +\*(``tek4010,\*('' and +\*(``dumb.\*('' .I xterm automatically searches the termcap file in this order for these entries and then -sets the ``TERM'' and the ``TERMCAP'' environment variables. +sets the \*(``TERM\*('' and the \*(``TERMCAP\*('' environment variables. .TP 8 .B +t This option indicates that \fIxterm\fP should start in VT102 mode. @@ -940,7 +956,7 @@ database (termcap or terminfo, depending on how \fIxterm\fP is built) and should have \fIli#\fP and \fIco#\fP entries. If the terminal type is not found, \fIxterm\fP uses the built-in list -``xterm'', ``vt102'', etc. +\*(``xterm\*('', \*(``vt102\*('', etc. .TP 8 .B -u8 This option sets the \fButf8\fP resource. @@ -952,12 +968,12 @@ If you must turn it on and off, use the \fBwideChars\fP resource. This option and the \fButf8\fR resource are overridden by the \fB-lc\fP and \fB-en\fP options and \fBlocale\fR resource. That is, if \fIxterm\fP has been compiled to support \fIluit\fR, -and the \fBlocale\fP resource is not ``false'' +and the \fBlocale\fP resource is not \*(``false\*('' this option is ignored. We recommend using -the \fB-lc\fR option or the ``\fBlocale:\ true\fR'' resource +the \fB-lc\fR option or the \*(``\fBlocale:\ true\fR\*('' resource in UTF-8 locales when your operating system supports locale, -or \fB-en\ UTF-8\fP option or the ``\fBlocale:\ UTF-8\fR'' resource +or \fB-en\ UTF-8\fP option or the \*(``\fBlocale:\ UTF-8\fR\*('' resource when your operating system does not support locale. .TP 8 .B +u8 @@ -1007,9 +1023,9 @@ This option indicates that a visual bell should not be used. This option sets the \fBwideChars\fP resource. When \fBwideChars\fP is set, \fIxterm\fP maintains internal structures for 16-bit characters. -If you do not set this resource to ``true'', +If you do not set this resource to \*(``true\*('', \fIxterm\fP will ignore the escape sequence which turns UTF-8 mode on and off. -The default is ``false''. +The default is \*(``false\*(''. .TP 8 .B +wc This option resets the \fBwideChars\fP resource. @@ -1051,7 +1067,7 @@ output channel for an existing program and is sometimes used in specialized applications. The option value specifies the last few letters of the name of a pseudo-terminal to use in slave mode, plus the number of the inherited file descriptor. -If the option contains a ``/'' character, that delimits the characters +If the option contains a \*(``/\*('' character, that delimits the characters used for the pseudo-terminal name from the file descriptor. Otherwise, exactly two characters are used from the option for the pseudo-terminal name, the remainder is the file descriptor. @@ -1076,11 +1092,11 @@ Toolkit provides standard options that accomplish the same task. .TP 8 .B "%\fIgeom\fP" This option specifies the preferred size and position of the Tektronix window. -It is shorthand for specifying the ``\fI*tekGeometry\fP'' resource. +It is shorthand for specifying the \*(``\fI*tekGeometry\fP\*('' resource. .TP 8 .B \ #\fIgeom\fP This option specifies the preferred position of the icon window. -It is shorthand for specifying the ``\fI*iconGeometry\fP'' resource. +It is shorthand for specifying the \*(``\fI*iconGeometry\fP\*('' resource. .TP 8 .BI -T " string" This option specifies the title for \fIxterm\fP's windows. @@ -1088,7 +1104,7 @@ It is equivalent to \fB-title\fP. .TP 8 .BI -n " string" This option specifies the icon name for \fIxterm\fP's windows. -It is shorthand for specifying the ``\fI*iconName\fP'' resource. +It is shorthand for specifying the \*(``\fI*iconName\fP\*('' resource. Note that this is not the same as the toolkit option \fB-name\fP (see below). The default icon name is the application name. .TP 8 @@ -1108,11 +1124,11 @@ with \fIxterm\fP: .TP 8 .B -bd \fIcolor\fP This option specifies the color to use for the border of the window. -\fIxterm\fP uses the X Toolkit default, which is ``XtDefaultForeground''. +\fIxterm\fP uses the X Toolkit default, which is \*(``XtDefaultForeground\*(''. .TP 8 .B -bg \fIcolor\fP This option specifies the color to use for the background of the window. -The default is ``XtDefaultBackground.'' +The default is \*(``XtDefaultBackground.\*('' .TP 8 .B -bw \fInumber\fP This option specifies the width in pixels of the border surrounding the window. @@ -1131,7 +1147,7 @@ This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP. .B -fg \fIcolor\fP This option specifies the color to use for displaying text. The default is -``XtDefaultForeground.'' +\*(``XtDefaultForeground.\*('' .TP 8 .B -fn \fIfont\fP This option specifies the font to be used for displaying normal text. @@ -1152,7 +1168,7 @@ start it as an icon rather than as the normal window. .B -name \fIname\fP This option specifies the application name under which resources are to be obtained, rather than the default executable file name. -\fIName\fP should not contain ``.'' or ``*'' characters. +\fIName\fP should not contain \*(``.\*('' or \*(``*\*('' characters. .TP 8 .B -rv This option indicates that reverse video should be simulated by swapping @@ -1183,7 +1199,7 @@ Application specific resources (e.g., "\fBXTerm.\fP\fINAME\fP") follow: Tie the VTxxx \fBbackarrowKey\fP and \fBptyInitialErase\fP resources together by setting the DECBKM state according to whether the initial value of stty erase is a backspace (8) or delete (127) character. -The default is ``false'', which disables this feature. +The default is \*(``false\*('', which disables this feature. .TP 8 .B "hold (\fPclass\fB Hold)" If true, @@ -1215,7 +1231,11 @@ Enables one (or none) of the various keyboard-type resources: \fBtcapFunctionKeys\fP and \fBsunKeyboard\fP. The resource's value should be one of the corresponding strings -``hp'', ``sco'', ``sun'', ``tcap'' or ``vt220''. +\*(``hp\*('', +\*(``sco\*('', +\*(``sun\*('', +\*(``tcap\*('' or +\*(``vt220\*(''. The individual resources are provided for legacy support; this resource is simpler to use. .TP 8 @@ -1234,13 +1254,13 @@ if the operating system prefers larger buffer sizes. Specifies whether or not \fIxterm\fP should ask the window manager to maximize its layout on startup. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "messages (\fPclass\fB Messages)" Specifies whether write access to the terminal is allowed initially. See .BR mesg (1). -The default is ``true''. +The default is \*(``true\*(''. .TP 9 .B "menuLocale (\fPclass\fB MenuLocale)" Specify the locale used for character-set computations when loading @@ -1250,7 +1270,7 @@ which may load unnecessary (and very large) fonts, e.g., in a locale having UTF-8 encoding. The default is an empty string, which uses the current locale setting. .IP -Set it to ``C'' to achieve the best performance using the default +Set it to \*(``C\*('' to achieve the best performance using the default menu resource settings. If you happen to be using localized menu resources, set the resource accordingly. @@ -1262,28 +1282,28 @@ The default is 4096. You cannot set this to a value less than 64. .TP 8 .B "ptyHandshake (\fPclass\fB PtyHandshake) -If ``true'', \fIxterm\fP will perform handshaking during initialization +If \*(``true\*('', \fIxterm\fP will perform handshaking during initialization to ensure that the parent and child processes update the \fButmp\fP and \fBstty\fP state. See also \fBwaitForMap\fP which waits for the pseudo-terminal's notion of the screen size, and \fBptySttySize\fP which resets the screen size after other terminal initialization is complete. -The default is ``true''. +The default is \*(``true\*(''. .TP 8 .B "ptyInitialErase (\fPclass\fB PtyInitialErase)" -If ``true'', \fIxterm\fP will use the pseudo-terminal's sense of the stty erase +If \*(``true\*('', \fIxterm\fP will use the pseudo-terminal's sense of the stty erase value. -If ``false'', \fIxterm\fP will set the stty erase value to match its own +If \*(``false\*('', \fIxterm\fP will set the stty erase value to match its own configuration, using the \fBkb\fP string from the termcap entry as a reference, if available. In either case, the result is applied to the TERMCAP variable which \fIxterm\fP sets. See also the \fBttyModes\fP resource, which may modify this. -The default is ``false''. +The default is \*(``false\*(''. .TP 8 .B "ptySttySize (\fPclass\fB PtySttySize) -If ``true'', \fIxterm\fP will reset the screen size after +If \*(``true\*('', \fIxterm\fP will reset the screen size after terminal initialization is complete. This is needed for some systems whose pseudo-terminals cannot propagate terminal characteristics. @@ -1291,11 +1311,11 @@ Where it is not needed, it can interfere with other methods for setting the intial screen size, e.g., via window manager interaction. See also \fBwaitForMap\fP which waits for a handshake-message giving the pseudo-terminal's notion of the screen size. -The default is ``false'' on Linux and OS X systems, -``true'' otherwise. +The default is \*(``false\*('' on Linux and OS X systems, +\*(``true\*('' otherwise. .TP 8 .B "sameName (\fPclass\fB SameName)" -If the value of this resource is ``true'', \fIxterm\fP does not send +If the value of this resource is \*(``true\*('', \fIxterm\fP does not send title and icon name change requests when the request would have no effect: the name is not changed. This has the advantage @@ -1303,7 +1323,7 @@ of preventing flicker and the disadvantage of requiring an extra round trip to the server to find out the previous value. In practice this should never be a problem. -The default is ``true''. +The default is \*(``true\*(''. .TP 8 .B "scoFunctionKeys (\fPclass\fB ScoFunctionKeys)" Specifies whether or not SCP Function Key escape codes should be generated for @@ -1311,10 +1331,10 @@ function keys instead of standard escape sequences. See also the \fBkeyboardType\fP resource. .TP 8 .B "sessionMgt (\fPclass\fB SessionMgt)" -If the value of this resource is ``true'', +If the value of this resource is \*(``true\*('', \fIxterm\fP sets up session manager callbacks for \fBXtNdieCallback\fR and \fBXtNsaveCallback\fR. -The default is ``true''. +The default is \*(``true\*(''. .TP 8 .B "sunFunctionKeys (\fPclass\fB SunFunctionKeys)" Specifies whether or not Sun Function Key escape codes should be generated for @@ -1324,12 +1344,12 @@ See also the \fBkeyboardType\fP resource. .B "sunKeyboard (\fPclass\fB SunKeyboard)" Specifies whether or not Sun/PC keyboard layout should be assumed rather than DEC VT220. -This causes the keypad `+' to be mapped to `,'. +This causes the keypad \*(``+' to be mapped to \*(``,'. and CTRL F1-F12 to F11-F20, depending on the setting of the \fBctrlFKeys\fP resource. so \fIxterm\fP emulates a DEC VT220 more accurately. -Otherwise (the default, with \fBsunKeyboard\fP set to ``false''), +Otherwise (the default, with \fBsunKeyboard\fP set to \*(``false\*(''), \fIxterm\fP uses PC-style bindings for the function keys and keypad. .IP PC-style bindings @@ -1358,7 +1378,7 @@ this application. .B "toolBar (\fPclass\fB ToolBar)" Specifies whether or not the toolbar should be displayed. The default is -``true.'' +\*(``true.\*('' .TP 8 .B "ttyModes (\fPclass\fB TtyModes)" Specifies a string containing terminal setting keywords and the characters @@ -1403,20 +1423,20 @@ i.e., \fIxterm\fP initializes the terminal to match that value. Force use of insert mode by adding appropriate entries to the TERMCAP environment variable. This is useful if the system termcap is broken. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "utmpDisplayId (\fPclass\fB UtmpDisplayId)" Specifies whether or not \fIxterm\fP should try to record the display identifier (display number and screen number) as well as the hostname in the system \fIutmp\fP log file. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "utmpInhibit (\fPclass\fB UtmpInhibit)" Specifies whether or not \fIxterm\fP should try to record the user's terminal in the system \fIutmp\fP log file. If true, \fIxterm\fP will not try. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "waitForMap (\fPclass\fB WaitForMap)" Specifies whether or not \fIxterm\fP should wait for the initial window map @@ -1429,7 +1449,7 @@ it passes the terminal size from the display end of the pseudo-terminal to the terminal I/O connection, e.g., according to the window manager. Otherwise, it uses the size as given in resource values or command-line option \fB-geom\fP. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "zIconBeep (\fPclass\fB ZIconBeep)" Same as -ziconbeep command line argument. @@ -1439,7 +1459,7 @@ and have "***" prepended to their icon titles. Most window managers will detect this change immediately, showing you which window has the output. (A similar feature was in x10 \fIxterm\fR.) -The default is ``false.'' +The default is \*(``false.\*('' .\" .SS VT100 Widget Resources .PP @@ -1462,7 +1482,7 @@ Not all window managers necessarily support application icon windows. Some window managers will allow you to enter keystrokes into the active icon window. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "allowC1Printable (\fPclass\fB AllowC1Printable)" If true, overrides the mapping of C1 controls @@ -1470,25 +1490,25 @@ If true, overrides the mapping of C1 controls as if they were printable characters. Although this corresponds to no particular standard, some users insist it is a VT100. -The default is ``false.'' +The default is \*(``false.\*('' .TP .B "allowFontOps (\fPclass\fB AllowFontOps)" Specifies whether control sequences that set/query the font should be allowed. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "allowSendEvents (\fPclass\fB AllowSendEvents)" Specifies whether or not synthetic key and button events (generated using the X protocol SendEvent request) should be interpreted or discarded. -The default is ``false'' meaning they are discarded. -Note that allowing -such events creates a very large security hole. -The default is ``false.'' +The default is \*(``false\*('' meaning they are discarded. +Note that allowing such events creates a very large security hole, and +forcefully disables the \fBallow\fP\fIXXX\fP\fBOps\fR resources. +The default is \*(``false.\*('' .TP .B "allowTcapOps (\fPclass\fB AllowTcapOps)" Specifies whether control sequences that query the terminal's notion of its function-key strings, as termcap or terminfo capabilities should be allowed. -The default is ``false.'' +The default is \*(``false.\*('' .IP A few programs, e.g,. \fIvim\fP, use this feature to get an accurate description of the terminal's capabilities, @@ -1511,37 +1531,37 @@ Reporting control- and alt-modifiers is a feature that relies on the .B "allowTitleOps (\fPclass\fB AllowTitleOps)" Specifies whether control sequences that modify the window title or icon name should be allowed. -The default is ``true.'' +The default is \*(``true.\*('' .TP .B "allowWindowOps (\fPclass\fB AllowWindowOps)" Specifies whether extended window control sequences (as used in dtterm) should be allowed. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "altIsNotMeta (\fPclass\fB AltIsNotMeta\fP)" -If ``true'', treat the Alt-key as if it were the Meta-key. +If \*(``true\*('', treat the Alt-key as if it were the Meta-key. Your keyboard may happen to be configured so they are the same. But if they are not, this allows you to use the same prefix- and shifting operations with the Alt-key as with the Meta-key. See \fBaltSendsEscape\fP and \fBmetaSendsEscape\fP. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "altSendsEscape (\fPclass\fB AltSendsEscape\fP)" This is an additional keyboard operation that may be processed after the logic for \fBmetaSendsEscape\fP. It is only available if the \fBaltIsNotMeta\fP resource is set. .IP -If ``true'', Alt characters +If \*(``true\*('', Alt characters (a character combined with the modifier associated with left/right Alt-keys) are converted into a two-character sequence with the character itself preceded by ESC. This applies as well to function key control sequences, unless \fIxterm\fP sees that \fBAlt\fP is used in your key translations. -If ``false'', Alt characters input from the keyboard cause a shift to +If \*(``false\*('', Alt characters input from the keyboard cause a shift to 8-bit characters (just like \fBmetaSendsEscape\fP). By combining the Alt- and Meta-modifiers, you can create corresponding combinations of ESC-prefix and 8-bit characters. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "alwaysBoldMode (\fPclass\fB AlwaysBoldMode)" Specifies whether \fIxterm\fP should check if the normal and bold @@ -1550,7 +1570,7 @@ simulate bold fonts. If this resource is true, \fIxterm\fP does not make the check for distinct fonts when deciding how to handle the \fBboldMode\fP resource. -The default is ``false.'' +The default is \*(``false.\*('' .TS l l l l _ _ _ _ @@ -1569,61 +1589,61 @@ text cursor. By default (if this resource is false), a hollow text cursor is displayed whenever the pointer moves out of the window or the window loses the input focus. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "alwaysUseMods (\fPclass\fB AlwaysUseMods)" Override the \fBnumLock\fP resource, telling \fIxterm\fR to use the Alt and Meta modifiers to construct parameters for function key sequences even if those modifiers appear in the translations resource. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "answerbackString (\fPclass\fB AnswerbackString)" Specifies the string that \fIxterm\fR sends in response to an ENQ (control/E) character from the host. -The default is a blank string, i.e., ``''. +The default is a blank string, i.e., \*(``\*(''. A hardware VT100 implements this feature as a setup option. .TP 8 .B "appcursorDefault (\fPclass\fB AppcursorDefault)" -If ``true,'' the cursor keys are initially in application mode. +If \*(``true,\*('' the cursor keys are initially in application mode. This is the same as the VT102 private DECCKM mode, -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "appkeypadDefault (\fPclass\fB AppkeypadDefault)" -If ``true,'' the keypad keys are initially in application mode. -The default is ``false.'' +If \*(``true,\*('' the keypad keys are initially in application mode. +The default is \*(``false.\*('' .TP 8 .B "autoWrap (\fPclass\fB AutoWrap)" Specifies whether or not auto-wraparound should be enabled. This is the same as the VT102 DECAWM. The -default is ``true.'' +default is \*(``true.\*('' .TP 8 .B "awaitInput (\fPclass\fB AwaitInput)" Specifies whether or not the \fIxterm\fR uses a 50 millisecond timeout to await input (i.e., to support the Xaw3d arrow scrollbar). -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "backarrowKey (\fPclass\fB BackarrowKey)" Specifies whether the backarrow key transmits a backspace (8) or delete (127) character. This corresponds to the DECBKM control sequence. -The default (backspace) is ``true.'' +The default (backspace) is \*(``true.\*('' Pressing the control key toggles this behavior. .TP 8 .B "background (\fPclass\fB Background)" Specifies the color to use for the background of the window. The default is -``XtDefaultBackground.'' +\*(``XtDefaultBackground.\*('' .TP 8 .B "bellIsUrgent (\fPclass\fB BellIsUrgent)" Specifies whether to set the Urgency hint for the window manager when making a bell sound. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "bellOnReset (\fPclass\fB BellOnReset)" Specifies whether to sound a bell when doing a hard reset. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "bellSuppressTime (\fPclass\fB BellSuppressTime)" Number of milliseconds after a bell command is sent during which additional @@ -1639,7 +1659,7 @@ the visible bell. Specifies whether to combine bold attribute with colors like the IBM PC, i.e., map colors 0 through 7 to colors 8 through 15. These normally are the brighter versions of the first 8 colors, hence bold. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "boldFont (\fPclass\fB BoldFont)" Specifies the name of the bold font to use instead of overstriking. @@ -1658,7 +1678,7 @@ Note that \fIxterm\fP has one bold font which you may set explicitly. If it cannot find a bold font, it will use the normal font. In each case (whether the explicit resource or the derived font), if the normal and bold fonts are distinct, this resource has no effect. -The default is ``true.'' +The default is \*(``true.\*('' .IP See the \fBalwaysBoldMode\fP resource which can modify the behavior of this resource. @@ -1695,7 +1715,7 @@ If true, \fIxterm\fP applies a workaround to ignore malformed control sequences that a Linux script might send. Compare the palette control sequences documented in \fIconsole_codes\fR with ECMA-48. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "brokenSelections (\fPclass\fB BrokenSelections)" If true, \fIxterm\fP in 8-bit mode will interpret @@ -1705,20 +1725,20 @@ Normally .B STRING selections carry ISO-8859-1 encoded text. Setting this resource to -``true'' violates the ICCCM; it may, however, be useful for interacting +\*(``true\*('' violates the ICCCM; it may, however, be useful for interacting with some broken X clients. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "brokenStringTerm (\fPclass\fB BrokenStringTerm)" provides a work-around for some ISDN routers which start an application control string without completing it. -Set this to ``true'' if \fIxterm\fP appears to freeze when connecting. -The default is ``false.'' +Set this to \*(``true\*('' if \fIxterm\fP appears to freeze when connecting. +The default is \*(``false.\*('' .TP 8 .B "c132 (\fPclass\fB C132)" Specifies whether or not the VT102 DECCOLM escape sequence, used to switch between 80 and 132 columns, should be honored. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "cacheDoublesize (\fPclass\fB CacheDoublesize)" Tells whether to cache double-sized fonts by \fIxterm\fR. @@ -1736,12 +1756,12 @@ Specifies whether \fIxterm\fP should follow the traditional East Asian width convention. When turned on, characters with East Asian Ambiguous (A) category in UTR 11 have a column width of 2. -You may have to set this option to ``true'' +You may have to set this option to \*(``true\*('' if you have some old East Asian terminal based programs that assume that line-drawing characters have a column width of 2. If this resource is false, the \fBmkWidth\fP resource controls the choice between the system's \fBwcwidth\fP and \fIxterm\fP's built-in tables. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "color0 (\fPclass\fB Color0)" .TP 8 @@ -1816,70 +1836,70 @@ Specifies whether \fBcolorBD\fP, \fBcolorBL\fP, \fBcolorRV\fP, and \fBcolorUL\fP should override ANSI colors. If not, these are displayed only when no ANSI colors have been set for the corresponding position. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "colorBD (\fPclass\fB ColorBD)" This specifies the color to use to display bold characters if -the ``colorBDMode'' resource is enabled. -The default is ``XtDefaultForeground.'' +the \*(``colorBDMode\*('' resource is enabled. +The default is \*(``XtDefaultForeground.\*('' .TP 8 .B "colorBDMode (\fPclass\fB ColorAttrMode)" Specifies whether characters with the bold attribute should be displayed in color or as bold characters. Note that setting \fBcolorMode\fR off disables all colors, including bold. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "colorBL (\fPclass\fB ColorBL)" This specifies the color to use to display blink characters if -the ``colorBLMode'' resource is enabled. -The default is ``XtDefaultForeground.'' +the \*(``colorBLMode\*('' resource is enabled. +The default is \*(``XtDefaultForeground.\*('' .TP 8 .B "colorBLMode (\fPclass\fB ColorAttrMode)" Specifies whether characters with the blink attribute should be displayed in color. Note that setting \fBcolorMode\fR off disables all colors, including this. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "colorMode (\fPclass\fB ColorMode)" Specifies whether or not recognition of ANSI (ISO-6429) color change escape sequences should be enabled. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "colorRV (\fPclass\fB ColorRV)" This specifies the color to use to display reverse characters if -the ``colorRVMode'' resource is enabled. -The default is ``XtDefaultForeground.'' +the \*(``colorRVMode\*('' resource is enabled. +The default is \*(``XtDefaultForeground.\*('' .TP 8 .B "colorRVMode (\fPclass\fB ColorAttrMode)" Specifies whether characters with the reverse attribute should be displayed in color. Note that setting \fBcolorMode\fR off disables all colors, including this. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "colorUL (\fPclass\fB ColorUL)" This specifies the color to use to display underlined characters if -the ``colorULMode'' resource is enabled. -The default is ``XtDefaultForeground.'' +the \*(``colorULMode\*('' resource is enabled. +The default is \*(``XtDefaultForeground.\*('' .TP 8 .B "colorULMode (\fPclass\fB ColorAttrMode)" Specifies whether characters with the underline attribute should be displayed in color or as underlined characters. Note that setting \fBcolorMode\fR off disables all colors, including underlining. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "combiningChars (\fPclass\fB CombiningChars)" Specifies the number of wide-characters which can be stored in a cell to overstrike (combine) with the base character of the cell. This can be set to values in the range 0 to 4. -The default is ``2''. +The default is \*(``2\*(''. .TP 8 .B "ctrlFKeys (\fPclass\fB CtrlFKeys)" In VT220 keyboard mode (see \fBsunKeyboard\fP resource), specifies the amount by which to shift F1-F12 given a control modifier (CTRL). This allows you to generate key symbols for F10-F20 on a Sun/PC keyboard. -The default is ``10'', which means that CTRL F1 generates the key +The default is \*(``10\*('', which means that CTRL F1 generates the key symbol for F11. .TP 8 .B "curses (\fPclass\fB Curses)" @@ -1887,15 +1907,15 @@ Specifies whether or not the last column bug in .IR more (1) should be worked around. See the \fB-cu\fP option for details. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "cursorBlink (\fPclass\fB CursorBlink)" Specifies whether to make the cursor blink. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "cursorColor (\fPclass\fB CursorColor)" Specifies the color to use for the text cursor. -The default is ``XtDefaultForeground.'' +The default is \*(``XtDefaultForeground.\*('' By default, \fIxterm\fP attempts to keep this color from being the same as the background color, since it draws the cursor by filling the background of a text cell. @@ -1919,20 +1939,20 @@ The same timer is used for text blinking. The default is 600. .TP 8 .B "cutNewline (\fPclass\fB CutNewline)" -If ``false'', triple clicking to select a line does not include the Newline +If \*(``false\*('', triple clicking to select a line does not include the Newline at the end of the line. -If ``true'', the Newline is selected. -The default is ``true.'' +If \*(``true\*('', the Newline is selected. +The default is \*(``true.\*('' .TP 8 .B "cursorUnderLine (\fPclass\fB CursorUnderLine)" Specifies whether to make the cursor underlined or a box. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "cutToBeginningOfLine (\fPclass\fB CutToBeginningOfLine)" -If ``false'', triple clicking to select a line selects only from the +If \*(``false\*('', triple clicking to select a line selects only from the current word forward. -If ``true'', the entire line is selected. -The default is ``true.'' +If \*(``true\*('', the entire line is selected. +The default is \*(``true.\*('' .TP 8 .B "decTerminalID (\fPclass\fB DecTerminalID)" Specifies the emulation level (100=VT100, 220=VT220, etc.), used to determine @@ -1947,16 +1967,16 @@ current encoding. For instance, pasting UTF-8 text into a display of ISO-8859-1 characters will only be able to display codes 0-255, while UTF-8 text can include Unicode values above 255. -The default is ``#'' (a single pound sign). +The default is \*(``#\*('' (a single pound sign). .IP If the undisplayable text would be double-width, -\fIxterm\fP will add a space after the ``#'' character, to give roughly +\fIxterm\fP will add a space after the \*(``#\*('' character, to give roughly the same layout on the screen as the original text. .TP 8 .B "deleteIsDEL (\fPclass\fB DeleteIsDEL)" Specifies whether the Delete key on the editing keypad should send DEL (127) or the VT220-style Remove escape sequence. -The default is ``false,'' for the latter. +The default is \*(``false,\*('' for the latter. .TP 8 .B "dynamicColors (\fPclass\fB DynamicColors)" Specifies whether or not escape sequences to change colors assigned to @@ -1965,19 +1985,19 @@ different attributes are recognized. .B "eightBitControl (\fPclass\fB EightBitControl\fP)" Specifies whether or not control sequences sent by the terminal should be eight-bit characters or escape sequences. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "eightBitInput (\fPclass\fB EightBitInput\fP)" -If ``true'', Meta characters +If \*(``true\*('', Meta characters (a single-byte character combined with the \fIMeta\fP modifier key) input from the keyboard are presented as a single character with the eighth bit turned on. The terminal is put into 8-bit mode. -If ``false'', Meta characters are converted into a two-character +If \*(``false\*('', Meta characters are converted into a two-character sequence with the character itself preceded by ESC. On startup, \fIxterm\fP tries to put the terminal into 7-bit mode. The \fBmetaSendsEscape\fP and \fBaltSendsEscape\fP resources may override this. -The default is ``true.'' +The default is \*(``true.\*('' .IP Generally keyboards do not have a key labeled "Meta", but "Alt" keys are common, and they are conventionally used for "Meta". @@ -2008,7 +2028,7 @@ otherwise some of \fIxterm\fP's functionality is not available. .B "eightBitOutput (\fPclass\fB EightBitOutput\fP)" Specifies whether or not eight-bit characters sent from the host should be accepted as is or stripped when printed. -The default is ``true,'' +The default is \*(``true,\*('' which means that they are accepted as is. .TP 8 .B "eightBitSelectTypes (\fPclass\fB EightBitSelectTypes\fP)" @@ -2034,14 +2054,14 @@ If the application uses double-wide characters and this resource is not given, .B "faceSize (\fPclass\fB FaceSize)" Specify the pointsize for fonts selected from the FreeType library if support for that library was compiled into \fIxterm\fR. -The default is ``14.'' +The default is \*(``14.\*('' On the \fBVT\ Fonts\fP menu, this corresponds to the \fIDefault\fP entry. .IP You can specify the pointsize for TrueType fonts selected with the other size-related menu entries such as Medium, Huge, etc., by using one of the following resource values. If you do not specify a value, -they default to ``0.0'', +they default to \*(``0.0\*('', which causes \fIxterm\fP to use the ratio of font sizes from the corresponding bitmap font resources to obtain a TrueType pointsize. @@ -2073,7 +2093,7 @@ Specifies the pointsize of the sixth alternative font. .TP 8 .B "font (\fPclass\fB Font)" Specifies the name of the normal font. -The default is ``fixed.'' +The default is \*(``fixed.\*('' .IP See the discussion of the \fBlocale\fP resource, which describes how this font may be overridden. @@ -2095,6 +2115,13 @@ xterm.vt100.utf8fonts.font .IP which is probably not what you intended. .TP 8 +.B "fastScroll (\fPclass\fB FastScroll)" +Modifies the effect of jump scroll (\fBjumpScroll\fP) +by suppressing screen refreshes +for the special case when output to the screen has completely shifted +the contents off-screen. +For instance, \fIcat\fP'ing a large file to the screen does this. +.TP 8 .B "font1 (\fPclass\fB Font1)" Specifies the name of the first alternative font. .TP 8 @@ -2118,7 +2145,7 @@ Specifies whether \fIxterm\fP should attempt to use font scaling to draw double-sized characters. Some older font servers cannot do this properly, will return misleading font metrics. -The default is ``true''. +The default is \*(``true\*(''. If disabled, \fIxterm\fP will simulate double-sized characters by drawing normal characters with spaces between them. .TP 8 @@ -2151,11 +2178,11 @@ 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 .IP -If ``false'', \fIxterm\fP checks for missing glyphs in the font +If \*(``false\*('', \fIxterm\fP checks for missing glyphs in the font and makes line-drawing characters directly as needed. -If ``true'', \fIxterm\fP assumes the font does not contain the +If \*(``true\*('', \fIxterm\fP assumes the font does not contain the line-drawing characters, and draws them directly. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "foreground (\fPclass\fB Foreground)" Specifies the color to use for displaying text in the window. @@ -2163,7 +2190,7 @@ Setting the class name instead of the instance name is an easy way to have everything that would normally appear in the text color change color. The default -is ``XtDefaultForeground.'' +is \*(``XtDefaultForeground.\*('' .TP 8 .B "formatOtherKeys (\fPclass\fB FormatOtherKeys)" Overrides the format of the escape sequence used to report modified keys @@ -2180,9 +2207,9 @@ send modified keys as parameters for CSI\ u. .B "freeBoldBox (\fPclass\fB FreeBoldBox)" Specifies whether \fIxterm\fP should assume the bounding boxes for normal and bold fonts are compatible. -If ``false'', \fIxterm\fP compares them and will reject choices of +If \*(``false\*('', \fIxterm\fP compares them and will reject choices of bold fonts that do not match the size of the normal font. -The default is ``false'', which means that the comparison is performed. +The default is \*(``false\*('', which means that the comparison is performed. .TP 8 .B "geometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the VT102 window. @@ -2191,7 +2218,7 @@ There is no default for this resource. .B "highlightColor (\fPclass\fB HighlightColor)" Specifies the color to use for the background of selected (highlighted) text. If not specified (i.e., matching the default foreground), reverse video is used. -The default is ``XtDefaultForeground.'' +The default is \*(``XtDefaultForeground.\*('' .TP 8 .B "highlightColorMode (\fPclass\fB HighlightColorMode)" Specifies whether \fIxterm\fP should use @@ -2262,16 +2289,16 @@ and background colors when selecting text with reverse-video attribute. This applies only to the \fBhighlightColor\fP and \fBhighlightTextColor\fP resources, e.g., to match the color scheme of \fIxwsh\fP. -If ``true'', \fIxterm\fP reverses the colors, -If ``false'', \fIxterm\fP does not reverse colors, -The default is ``true.'' +If \*(``true\*('', \fIxterm\fP reverses the colors, +If \*(``false\*('', \fIxterm\fP does not reverse colors, +The default is \*(``true.\*('' .TP 8 .B "highlightSelection (\fPclass\fB HighlightSelection)" -If ``false'', selecting with the mouse highlights all positions on the screen +If \*(``false\*('', selecting with the mouse highlights all positions on the screen between the beginning of the selection and the current position. -If ``true'', \fIxterm\fP highlights only the positions that contain text that +If \*(``true\*('', \fIxterm\fP highlights only the positions that contain text that can be selected. -The default is ``false.'' +The default is \*(``false.\*('' .IP Depending on the way your applications write to the screen, there may be trailing blanks on a line. @@ -2285,22 +2312,22 @@ use the \fBtrimSelection\fP resource. .B "highlightTextColor (\fPclass\fB HighlightTextColor)" Specifies the color to use for the foreground of selected (highlighted) text. If not specified (i.e., matching the default background), reverse video is used. -The default is ``XtDefaultBackground.'' +The default is \*(``XtDefaultBackground.\*('' .TP 8 .B "hpLowerleftBugCompat (\fPclass\fB HpLowerleftBugCompat)" Specifies whether to work around a bug in HP's \fIxdb\fP, which ignores termcap and always sends ESC F to move to the lower left corner. -``true'' causes \fIxterm\fP to interpret ESC F as a request to move to the +\*(``true\*('' causes \fIxterm\fP to interpret ESC F as a request to move to the lower left corner of the screen. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "i18nSelections (\fPclass\fB I18nSelections)" If false, \fIxterm\fP will not request the targets .B COMPOUND_TEXT or .BR TEXT . -The default is ``true.'' It may be set to false in order to work around +The default is \*(``true.\*('' It may be set to false in order to work around ICCCM violations by other X clients. .TP 8 .B "iconBorderColor (\fPclass\fB BorderColor)" @@ -2323,7 +2350,7 @@ The default is "nil2". .B "initialFont (\fPclass\fB InitialFont)" Specifies which of the VT100 fonts to use initially. Values are the same as for the \fIset-vt-font\fP action. -The default is ``d'', i.e., "default". +The default is \*(``d\*('', i.e., "default". .TP 8 .B "inputMethod (\fPclass\fB XtCInputMethod)" Tells \fIxterm\fP which type of input method to use. @@ -2341,19 +2368,20 @@ It is implemented only for TrueType fonts. .B "jumpScroll (\fPclass\fB JumpScroll)" Specifies whether or not jump scroll should be used. This corresponds to the VT102 DECSCLM private mode. -The default is ``true.'' +The default is \*(``true.\*('' +See \fBfastScroll\fP for a variation. .TP 8 .B "keepSelection (\fPclass\fB KeepSelection)" Specifies whether \fIxterm\fR will keep the selection even after the selected area was touched by some output to the terminal. -The default is ``false''. +The default is \*(``true\*(''. .TP 8 .B "keyboardDialect (\fPclass\fB KeyboardDialect)" Specifies the initial keyboard dialect, as well as the default value when the terminal is reset. The value given is the same as the final character in the control sequences which change character sets. -The default is ``B'', which corresponds to US ASCII. +The default is \*(``B\*('', which corresponds to US ASCII. .TP 8 .B "\fIname\fP\fBKeymap\fP (class\fB \fIName\fP\fBKeymap\fP)" See the discussion of the \fBkeymap()\fP action. @@ -2361,7 +2389,7 @@ See the discussion of the \fBkeymap()\fP action. .B "limitResize (\fPclass\fB LimitResize)" Limits resizing of the screen via control sequence to a given multiple of the display dimensions. -The default is ``1''. +The default is \*(``1\*(''. .TP 8 .B "locale (\fPclass\fB Locale)" Specifies how to use \fIluit\fR, an encoding converter between UTF-8 @@ -2397,11 +2425,11 @@ For other encodings, \fIxterm\fR assumes that UTF-8 encoding is required. or UTF-8 mode according to \fButf8\fR resource or \fB-u8\fP option. .RE .IP -Any other value, e.g., ``UTF-8'' or ``ISO8859-2'', +Any other value, e.g., \*(``UTF-8\*('' or \*(``ISO8859-2\*('', is assumed to be an encoding name; \fIluit\fR will be invoked to support the encoding. The actual list of supported encodings depends on \fIluit\fR. -The default is ``medium''. +The default is \*(``medium\*(''. .IP Regardless of your locale and encoding, you need an ISO-10646-1 font to display the result. @@ -2421,7 +2449,7 @@ but do not rely on them unless you are using the locale mechanism. .B "localeFilter (\fPclass\fB LocaleFilter)" Specifies the file name for the encoding converter from/to locale encodings and UTF-8 which is used with the \fB-lc\fR option or \fBlocale\fR resource. -The help message shown by ``xterm -help'' lists the default value, +The help message shown by \*(``xterm -help\*('' lists the default value, which depends on your system configuration. .IP If the encoding converter requires command-line parameters, @@ -2431,23 +2459,23 @@ and set this resource to point to the shell script. .B "loginShell (\fPclass\fB LoginShell)" Specifies whether or not the shell to be run in the window should be started as a login shell. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "marginBell (\fPclass\fB MarginBell)" Specifies whether or not the bell should be rung when the user types near the right margin. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "metaSendsEscape (\fPclass\fB MetaSendsEscape\fP)" -If ``true'', Meta characters +If \*(``true\*('', Meta characters (a character combined with the \fIMeta\fP modifier key) are converted into a two-character sequence with the character itself preceded by ESC. This applies as well to function key control sequences, unless \fIxterm\fP sees that \fBMeta\fP is used in your key translations. -If ``false'', Meta characters input from the keyboard are handled according +If \*(``false\*('', Meta characters input from the keyboard are handled according to the \fBeightBitInput\fP resource. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "mkSamplePass (\fPclass\fB MkSamplePass)" If \fBmkSampleSize\fP is nonzero, @@ -2467,7 +2495,7 @@ The default (number of characters to check) is 1024. Specifies whether \fIxterm\fP should use a built-in version of the wide character width calculation. See also the \fBcjkWidth\fP resource which can override this. -The default is ``false.'' +The default is \*(``false.\*('' .IP Here is a summary of the resources which control the choice of wide character width calculation: @@ -2486,7 +2514,7 @@ true true use built-in CJK tables Tells how to handle the special case where Control-, Shift-, Alt- or Meta-modifiers are used to add a parameter to the escape sequence returned by a cursor-key. -The default is ``2'': +The default is \*(``2\*('': .IP Set it to -1 to disable it. .br @@ -2497,13 +2525,13 @@ Set it to 1 to prefix modified sequences with CSI. Set it to 2 to force the modifier to be the second parameter if it would otherwise be the first. .br -Set it to 3 to mark the sequence with a '>' to hint that it is private. +Set it to 3 to mark the sequence with a \*(``>\*('' to hint that it is private. .TP 8 .B "modifyFunctionKeys (\fPclass\fB ModifyFunctionKeys\fP)" Tells how to handle the special case where Control-, Shift-, Alt- or Meta-modifiers are used to add a parameter to the escape sequence returned by a (numbered) function-key. -The default is ``2''. +The default is \*(``2\*(''. The resource values are similar to \fBmodifyCursorKeys\fP: .IP Set it to -1 to permit the user to use shift- and control-modifiers @@ -2516,7 +2544,7 @@ Set it to 1 to prefix modified sequences with CSI. Set it to 2 to force the modifier to be the second parameter if it would otherwise be the first. .br -Set it to 3 to mark the sequence with a '>' to hint that it is private. +Set it to 3 to mark the sequence with a \*(``>\*('' to hint that it is private. .IP If \fBmodifyFunctionKeys\fP is zero, \fIxterm\fP uses Control- and Shift-modifiers to allow the user to @@ -2547,7 +2575,7 @@ escape sequence for other keys (such as "2") when modified by Control-, Alt- or Meta-modifiers. This feature does not apply to function keys and well-defined keys such as ESC or the control keys. -The default is ``0'': +The default is \*(``0\*('': .RS .TP 5 0 @@ -2569,7 +2597,7 @@ The default is 250 milliseconds. .TP 8 .B "multiScroll (\fPclass\fB MultiScroll)" Specifies whether or not scrolling should be done asynchronously. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "nMarginBell (\fPclass\fB Column)" Specifies the number of characters from the right margin at which the margin @@ -2577,19 +2605,19 @@ bell should be rung, when enabled by the \fBmarginBell\fP resource. The default is 10. .TP 8 .B "numLock (\fPclass\fB NumLock)" -If ``true'', \fIxterm\fR checks if NumLock is used as a modifier (see \fIxmodmap\fP(__mansuffix__)). +If \*(``true\*('', \fIxterm\fR checks if NumLock is used as a modifier (see \fIxmodmap\fP(__mansuffix__)). If so, this modifier is used to simplify the logic when implementing special NumLock for the \fBsunKeyboard\fP resource. Also (when \fBsunKeyboard\fP is false), similar logic is used to find the modifier associated with the left and right Alt keys. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "oldXtermFKeys (\fPclass\fB OldXtermFKeys)" -If ``true'', \fIxterm\fR will use old-style control sequences for function keys F1 to F4, +If \*(``true\*('', \fIxterm\fR will use old-style control sequences for function keys F1 to F4, for compatibility with X Consortium \fIxterm\fR. Otherwise, it uses the VT100-style codes for PF1 to PF4. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "on2Clicks (\fPclass\fB On2Clicks)" .TP @@ -2608,7 +2636,7 @@ The resource value can be one of these: .RS .TP 3 word -Select a ``word'' as determined by the \fBcharClass\fP resource. +Select a \*(``word\*('' as determined by the \fBcharClass\fP resource. See the \fBCHARACTER CLASSES\fP section. .TP line @@ -2625,18 +2653,18 @@ all Select all lines, i.e., including the saved lines. .TP regex -Select a ``word'' as determined by the regular expression which +Select a \*(``word\*('' as determined by the regular expression which follows in the resource value. .TP none No selection action is associated with this resource. \fIxterm\fP interprets it as the end of the list. For example, you may use it to disable triple (and higher) clicking -by setting \fBon3Clicks\fP to ``none''. +by setting \fBon3Clicks\fP to \*(``none\*(''. .RE .IP The default values for \fBon2Clicks\fP and \fBon3Clicks\fP are -``word'' and ``line'', respectively. +\*(``word\*('' and \*(``line\*('', respectively. There is no default value for \fBon4Clicks\fP or \fBon5Clicks\fP, making those inactive. On startup, \fIxterm\fP determines the maximum number of clicks @@ -2644,17 +2672,17 @@ by the \fBon\fP\fIX\fP\fBClicks\fP resource values which are set. .TP 8 .B "openIm (\fPclass\fB XtCOpenIm)" Tells \fIxterm\fP whether to open the input method at startup. -The default is ``true''. +The default is \*(``true\*(''. .TP 8 .B "pointerColor (\fPclass\fB PointerColor)" Specifies the foreground color of the pointer. The default is -``XtDefaultForeground.'' +\*(``XtDefaultForeground.\*('' .TP 8 .B "pointerColorBackground (\fPclass\fB PointerColorBackground)" Specifies the background color of the pointer. The default is -``XtDefaultBackground.'' +\*(``XtDefaultBackground.\*('' .TP 8 .B "pointerMode (\fPclass\fB PointerMode)" Specifies when the pointer may be hidden as the user types. @@ -2675,30 +2703,30 @@ always. .TP 8 .B "pointerShape (\fPclass\fB Cursor)" Specifies the name of the shape of the pointer. -The default is ``xterm.'' +The default is \*(``xterm.\*('' .TP 8 .B "popOnBell (\fPclass\fB PopOnBell)" Specifies whether the window would be raised when Control-G is received. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "preeditType (\fPclass\fB XtCPreeditType)" Tells \fIxterm\fP which types of preedit (preconversion) string to display. -The default is ``OverTheSpot,Root''. +The default is \*(``OverTheSpot,Root\*(''. .TP 8 .B "printAttributes (\fPclass\fB PrintAttributes)" Specifies whether to print graphic attributes along with the text. A real DEC VTxxx terminal will print the underline, highlighting codes but your printer may not handle these. -A ``0'' disables the attributes. -A ``1'' prints the normal set of attributes (bold, underline, inverse and blink) +A \*(``0\*('' disables the attributes. +A \*(``1\*('' prints the normal set of attributes (bold, underline, inverse and blink) as VT100-style control sequences. -A ``2'' prints ANSI color attributes as well. -The default is ``1.'' +A \*(``2\*('' prints ANSI color attributes as well. +The default is \*(``1.\*('' .TP 8 .B "printerAutoClose (\fPclass\fB PrinterAutoClose)" -If ``true'', \fIxterm\fR will close the printer (a pipe) when the application switches +If \*(``true\*('', \fIxterm\fR will close the printer (a pipe) when the application switches the printer offline with a Media Copy command. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "printerCommand (\fPclass\fB PrinterCommand)" Specifies a shell command to which @@ -2710,35 +2738,35 @@ If the resource value is given as a blank string, the printer is disabled. .TP 8 .B "printerControlMode (\fPclass\fB PrinterControlMode)" Specifies the printer control mode. -A ``1'' selects autoprint mode, which causes +A \*(``1\*('' selects autoprint mode, which causes .I xterm to print a line from the screen when you move the cursor off that line with a line feed, form feed or vertical tab character, or an autowrap occurs. -Autoprint mode is overridden by printer controller mode (a ``2''), +Autoprint mode is overridden by printer controller mode (a \*(``2\*(''), which causes all of the output to be directed to the printer. -The default is ``0.'' +The default is \*(``0.\*('' .TP 8 .B "printerExtent (\fPclass\fB PrinterExtent)" Controls whether a print page function will print the entire page (true), or only the the portion within the scrolling margins (false). -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "printerFormFeed (\fPclass\fB PrinterFormFeed)" Controls whether a form feed is sent to the printer at the end of a print page function. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "quietGrab (\fPclass\fB QuietGrab)" Controls whether the cursor is repainted when \fINotifyGrab\fP and \fINotifyUngrab\fP event types are received during change of focus. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "renderFont (\fPclass\fB RenderFont)" If \fIxterm\fR is built with the Xft library, this controls whether the \fBfaceName\fR resource is used. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "resizeGravity (\fPclass\fB ResizeGravity)" Affects the behavior when the window is resized to be taller or @@ -2757,21 +2785,30 @@ made taller, additional saved lines will be scrolled down onto the screen; if the window is made shorter, lines will be scrolled off the top of the screen, and the top saved lines will be dropped. .TP 8 +.B "retryInputMethod (\fPclass\fB XtCRetryInputMethod)" +Tells \fIxterm\fP how many times to retry, +in case the input-method server is not responding. +This is a different issue than unsupported preedit type, etc. +You may encounter retries if your X configuration (and its libraries) +are missing pieces. +Setting this resource to zero ``0'' will cancel the retrying. +The default is ``3''. +.TP 8 .B "reverseVideo (\fPclass\fB ReverseVideo)" Specifies whether or not reverse video should be simulated. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "reverseWrap (\fPclass\fB ReverseWrap)" Specifies whether or not reverse-wraparound should be enabled. This corresponds to \fIxterm\fP's private mode 45. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "rightScrollBar (\fPclass\fB RightScrollBar)" Specifies whether or not the scrollbar should be displayed on the right rather than the left. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "saveLines (\fPclass\fB SaveLines)" Specifies the number of lines to save beyond the top of the screen when a @@ -2781,7 +2818,7 @@ The default is 64. .B "scrollBar (\fPclass\fB ScrollBar)" Specifies whether or not the scrollbar should be displayed. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "scrollBarBorder (\fPclass\fB ScrollBarBorder)" Specifies the width of the scrollbar border. @@ -2795,7 +2832,7 @@ Specifies whether or not pressing a key should automatically cause the scrollbar to go to the bottom of the scrolling region. This corresponds to \fIxterm\fP's private mode 1011. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "scrollLines (\fPclass\fB ScrollLines)" Specifies the number of lines that the \fIscroll-back\fP and @@ -2805,7 +2842,7 @@ The default value is 1. .B "scrollTtyOutput (\fPclass\fB ScrollCond)" Specifies whether or not output to the terminal should automatically cause the scrollbar to go to the bottom of the scrolling region. -The default is ``true.'' +The default is \*(``true.\*('' .TP .B "selectToClipboard (\fPclass\fB SelectToClipboard)" Tells \fIxterm\fP whether to use the PRIMARY or CLIPBOARD for @@ -2813,31 +2850,31 @@ SELECT tokens in the selection mechanism. The \fBset-select\fP action can change this at runtime, allowing the user to work with programs that handle only one of these mechanisms. -The default is ``false'', which tells it to use PRIMARY. +The default is \*(``false\*('', which tells it to use PRIMARY. .TP 8 .B "shiftFonts (\fPclass\fB ShiftFonts)" Specifies whether to enable the actions \fBlarger-vt-font()\fP and \fBsmaller-vt-font()\fP, which are normally bound to the shifted KP_Add and KP_Subtract. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "showBlinkAsBold (\fPclass\fB ShowBlinkAsBold)" Tells \fIxterm\fP whether to display text with blink-attribute the same as bold. If \fIxterm\fP has not been configured to support blinking text, -the default is ``true.'', which corresponds to older versions of \fIxterm\fP, -otherwise the default is ``false.'' +the default is \*(``true.\*('', which corresponds to older versions of \fIxterm\fP, +otherwise the default is \*(``false.\*('' .TP 8 .B "showMissingGlyphs (\fPclass\fB ShowMissingGlyphs)" Tells \fIxterm\fP whether to display a box outlining places where a character has been used that the font does not represent. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "signalInhibit (\fPclass\fB SignalInhibit)" -Specifies whether or not the entries in the ``Main Options'' menu for sending +Specifies whether or not the entries in the \*(``Main Options\*('' menu for sending signals to \fIxterm\fP should be disallowed. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "tekGeometry (\fPclass\fB Geometry)" Specifies the preferred size and position of the Tektronix window. @@ -2848,27 +2885,27 @@ Specifies whether or not the escape sequence to enter Tektronix mode should be ignored. The default is -``false.'' +\*(``false.\*('' .TP 8 .B "tekSmall (\fPclass\fB TekSmall)" Specifies whether or not the Tektronix mode window should start in its smallest size if no explicit geometry is given. This is useful when running \fIxterm\fP on displays with small screens. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "tekStartup (\fPclass\fB TekStartup)" Specifies whether or not \fIxterm\fP should start up in Tektronix mode. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "tiXtraScroll (\fPclass\fB TiXtraScroll)" Specifies whether \fIxterm\fP should scroll to a new page when processing the \fIti\fP termcap entry, i.e., the private modes 47, 1047 or 1049. -This is only in effect if \fBtiteInhibit\fP is ``true'', +This is only in effect if \fBtiteInhibit\fP is \*(``true\*('', because the intent of this option is to provide a picture of the full-screen application's display on the scrollback without wiping out the text that would be shown before the application was initialized. -The default for this resource is ``false.'' +The default for this resource is \*(``false.\*('' .TP 8 .B "titeInhibit (\fPclass\fB TiteInhibit)" Specifies whether or not \fIxterm\fP should remove \fIti\fP and \fIte\fP @@ -2880,11 +2917,11 @@ alternate screen. \fIXterm\fP supports terminfo in a different way, supporting composite control sequences (also known as private modes) 1047, 1048 and 1049 which have the same effect as the original 47 control sequence. -The default for this resource is ``false.'' +The default for this resource is \*(``false.\*('' .TP 8 .B "translations (\fPclass\fB Translations)" -Specifies the key and button bindings for menus, selections, ``programmed -strings,'' etc. +Specifies the key and button bindings for menus, selections, \*(``programmed +strings,\*('' etc. The \fBtranslations\fP resource, which provides much of \fIxterm\fP's configurability, is a feature of the X Toolkit Intrinsics library (Xt). @@ -2901,21 +2938,21 @@ If this resource is true, \fIxterm\fP will trim trailing spaces from text which is selected. It does not affect spaces which result in a wrapped line, nor will it trim the trailing newline from your selection. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "underLine (\fPclass\fB UnderLine)" This specifies whether or not text with the underline attribute should be underlined. It may be desirable to disable underlining when color is being used for the underline attribute. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "useClipping (\fPclass\fB UseClipping)" Tell \fIxterm\fP whether to use clipping to keep from producing dots outside the text drawing area. Originally used to work around for overstriking effects, this is also needed to work with some incorrectly-sized fonts. -The default is ``true.'' +The default is \*(``true.\*('' .TP 8 .B "utf8 (\fPclass\fB Utf8)" This specifies whether \fIxterm\fP will run in UTF-8 mode. @@ -2944,7 +2981,7 @@ See the \fBlocale\fR resource for additional discussion of non-UTF-8 locales. .RE .IP If you want to set the value of \fButf8\fP, it should be in this range. -Other nonzero values are treated the same as ``1'', +Other nonzero values are treated the same as \*(``1\*('', i.e., UTF-8 mode is initially on, and escape sequences for turning UTF-8 mode on/off are allowed. .TP 8 @@ -2956,7 +2993,7 @@ If true, allow an ISO-8859-1 \fInormal\fP font to be combined with an ISO-10646 font if the latter is given via the \fB-fw\fP option or its corresponding resource value. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "utf8SelectTypes (\fPclass\fB Utf8SelectTypes)" Override \fIxterm\fP's default selection target list (see SELECT/PASTE) for @@ -2973,11 +3010,11 @@ it translates the ISO-8859-1 string to UTF-8 to work with the X libraries which assume the string is UTF-8. .IP However, some users may wish to write a title string encoded in UTF-8. -Set this resource to ``true'' to allow UTF-8 encoded title strings. +Set this resource to \*(``true\*('' to allow UTF-8 encoded title strings. That cancels the translation to UTF-8, allowing UTF-8 strings to be displayed as is. .IP -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "veryBoldColors (\fPclass\fB VeryBoldColors)" Specifies whether to combine video attributes with colors specified by @@ -2992,12 +3029,12 @@ The resource value is the sum of values for each attribute: .fi .RE .IP -The default is ``0.'' +The default is \*(``0.\*('' .TP 8 .B "visualBell (\fPclass\fB VisualBell)" Specifies whether or not a visible bell (i.e., flashing) should be used instead of an audible bell when Control-G is received. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "visualBellDelay (\fPclass\fB VisualBellDelay)" Number of milliseconds to delay when displaying a visual bell. @@ -3008,7 +3045,7 @@ This is useful for very slow displays, e.g., an LCD display on a laptop. .B "vt100Graphics (\fPclass\fB VT100Graphics)" This specifies whether \fIxterm\fP will interpret VT100 graphic character escape sequences while in UTF-8 mode. -The default is ``true'', to provide support for various legacy applications. +The default is \*(``true\*('', to provide support for various legacy applications. .TP 8 .B "wideBoldFont (\fPclass\fB WideBoldFont)" This option specifies the font to be used for displaying bold wide text. @@ -3021,7 +3058,7 @@ the bold font. .B "wideChars (\fPclass\fB WideChars)" Specifies if \fIxterm\fP should respond to control sequences that process 16-bit characters. -The default is ``false.'' +The default is \*(``false.\*('' .TP 8 .B "wideFont (\fPclass\fB WideFont)" This option specifies the font to be used for displaying wide text. @@ -3066,9 +3103,9 @@ Specifies the small font to use in the Tektronix window. .TP 8 .B "ginTerminator (\fPclass\fB GinTerminator)" Specifies what character(s) should follow a GIN report or status report. -The possibilities are ``none,'' which sends no terminating characters, -``CRonly,'' which sends CR, and ``CR&EOT,'' which sends both CR and EOT. -The default is ``none.'' +The possibilities are \*(``none,\*('' which sends no terminating characters, +\*(``CRonly,\*('' which sends CR, and \*(``CR&EOT,\*('' which sends both CR and EOT. +The default is \*(``none.\*('' .TP 8 .B "height (\fPclass\fB Height)" Specifies the height of the Tektronix window in pixels. @@ -3076,7 +3113,7 @@ Specifies the height of the Tektronix window in pixels. .B "initialFont (\fPclass\fB InitialFont)" Specifies which of the four Tektronix fonts to use initially. Values are the same as for the \fIset-tek-text\fP action. -The default is ``large.'' +The default is \*(``large.\*('' .TP 8 .B "width (\fPclass\fB Width)" Specifies the width of the Tektronix window in pixels. @@ -3229,7 +3266,7 @@ This entry toggles active icons on and off if this feature was compiled into \fIxterm\fP. It is enabled only if \fIxterm\fP was started with the command line option +ai or the \fBactiveIcon\fP -resource is set to ``true.'' +resource is set to \*(``true.\*('' .TP 8 .B "softreset (\fPclass\fB SmeBSB)" This entry invokes the \fBsoft-reset()\fP action. @@ -3343,7 +3380,7 @@ Specifies the color to use for the background of the scrollbar. .TP 8 .B "foreground (\fPclass\fB Foreground)" Specifies the color to use for the foreground of the scrollbar. -The ``thumb'' +The \*(``thumb\*('' of the scrollbar is a simple checkerboard pattern alternating pixels for foreground and background color. . @@ -3358,7 +3395,7 @@ allows you to select text and copy it within the same or other windows. .SS "SELECTION" .PP The selection functions are invoked when the pointer buttons are used with no -modifiers, and when they are used with the ``shift'' key. +modifiers, and when they are used with the \*(``shift\*('' key. The assignment of the functions described below to keys and buttons may be changed through the resource database; see \fBACTIONS\fP below. . @@ -3393,7 +3430,7 @@ If the key/button bindings specify that an X selection is to be made, is the selection owner. . .PP -Pointer button two (usually middle) `types' (pastes) the text from +Pointer button two (usually middle) \*(``types\*('' (pastes) the text from the PRIMARY selection, if any, otherwise from the cut buffer, inserting it as keyboard input. @@ -3401,7 +3438,7 @@ inserting it as keyboard input. .PP Pointer button three (usually right) extends the current selection. (Without loss of generality, -you can swap ``right'' and ``left'' everywhere in the rest of this +you can swap \*(``right\*('' and \*(``left\*('' everywhere in the rest of this paragraph.) If pressed while closer to the right edge of the selection than the left, it extends/contracts the right edge of the selection. @@ -3421,7 +3458,7 @@ you can take text from several places in different windows and form a command to the shell, for example, or take output from a program and insert it into your favorite editor. Since cut buffers are globally shared among different applications, -you may regard each as a `file' whose contents you know. +you may regard each as a \*(``file\*('' whose contents you know. The terminal emulator and other text programs should be treating it as if it were a text file, i.e., the text is delimited by new lines. . @@ -3452,9 +3489,9 @@ It does allow Tektronix GIN mode, and in this mode the cursor will change from an arrow to a cross. Pressing any key will send that key and the current coordinate of the cross cursor. -Pressing button one, two, or three will return the letters `l', `m', and -`r', respectively. -If the `shift' key is pressed when a pointer button is pressed, the corresponding +Pressing button one, two, or three will return the letters \*(``l\*('', \*(``m\*('', and +\*(``r\*('', respectively. +If the \*(``shift\*('' key is pressed when a pointer button is pressed, the corresponding upper case letter is sent. To distinguish a pointer button from a key, the high bit of the character is set (but this is bit is normally stripped unless the terminal mode is RAW; @@ -3517,13 +3554,13 @@ This is Latin 1 (ISO-8859-1) data. .RE .PP The middle two (TEXT and COMPOUND_TEXT) are added if \fIxterm\fP -is configured with the \fBi18nSelections\fP resource set to ``true''. +is configured with the \fBi18nSelections\fP resource set to \*(``true\*(''. .PP UTF8_STRING is preferred (therefore first in the list) since \fIxterm\fP stores text as Unicode data when running in wide-character mode, and no translation is needed. On the other hand, TEXT and COMPOUND_TEXT may require translation. -If the translation is incomplete, they will insert X's ``defaultString'' +If the translation is incomplete, they will insert X's \*(``defaultString\*('' whose value cannot be set, and may simply be empty. \fIXterm\fP's \fBdefaultString\fP resource specifies the string to use for incomplete translations of the UTF8_STRING. @@ -3572,7 +3609,7 @@ name in parenthesis. .SS "Main Options" .PP The \fIxterm\fP \fImainMenu\fP pops up -when the ``control'' key and pointer button one are pressed in a window. +when the \*(``control\*('' key and pointer button one are pressed in a window. This menu contains items that apply to both the VT102 and Tektronix windows. There are several sections: .TP @@ -3706,7 +3743,7 @@ the process group of the process running under The .I vtMenu sets various modes in the VT102 emulation, and is popped up when the -``control'' key and pointer button two are pressed in the VT102 window. +\*(``control\*('' key and pointer button two are pressed in the VT102 window. .TP VT102/VT220 Modes: .RS @@ -3957,7 +3994,7 @@ the alternate screen does not. .SS "VT Fonts" .PP The \fIfontMenu\fP pops up when -when the ``control'' key and pointer button three are pressed in a window. +when the \*(``control\*('' key and pointer button three are pressed in a window. It sets the font used in the VT102 window, or modifies the way the font is specified or displayed. There are several sections. @@ -4066,7 +4103,7 @@ This corresponds to the \fBallowWindowOps\fP resource. The .I tekMenu sets various modes in the Tektronix emulation, and is popped up when the -``control'' key and pointer button two are pressed in the Tektronix window. +\*(``control\*('' key and pointer button two are pressed in the Tektronix window. The current font size is checked in the modes section of the menu. .RS .TP @@ -4107,7 +4144,7 @@ Hide Tek Window (tekhide) X environments differ in their security consciousness. Most servers, run under \fIxdm\fP, -are capable of using a ``magic cookie'' authorization +are capable of using a \*(``magic cookie\*('' authorization scheme that can provide a reasonable level of security for many people. If your server is only using a host-based mechanism to control access to the server (see \fIxhost(__mansuffix__)\fP), then if you enable access for a host and @@ -4119,7 +4156,7 @@ Any process which has access to your X display can manipulate it in ways that you might not anticipate, even redirecting your keyboard to itself and sending events to your application's windows. -This is true even with the ``magic cookie'' authorization scheme. +This is true even with the \*(``magic cookie\*('' authorization scheme. While the \fBallowSendEvents\fP provides some protection against rogue applications tampering with your programs, guarding against a snooper is harder. @@ -4179,7 +4216,7 @@ will sound in warning. .SH "CHARACTER CLASSES" Clicking the left pointer button twice in rapid succession (double-clicking) causes all characters of the same class -(e.g., letters, white space, punctuation) to be selected as a ``word''. +(e.g., letters, white space, punctuation) to be selected as a \*(``word\*(''. Since different people have different preferences for what should be selected (for example, should filenames be selected as a whole or only the separate subnames), the default mapping can be overridden through the use @@ -4210,7 +4247,7 @@ static int charClass[256] = { 1, 1, 1, 1, 1, 1, 1, 1, /\(** CAN EM SUB ESC FS GS RS US */ 1, 1, 1, 1, 1, 1, 1, 1, -/\(** SP ! " # $ % & ' */ +/\(** SP ! " # $ % & \*(AQ */ .\" " <- for emacs autocolor to work well :-) 32, 33, 34, 35, 36, 37, 38, 39, /\(** ( ) * + , - . / */ @@ -4247,28 +4284,28 @@ static int charClass[256] = { 160, 161, 162, 163, 164, 165, 166, 167, /\(** .. c0 ip << _ R0 - */ 168, 169, 170, 171, 172, 173, 174, 175, -/\(** o +- 2 3 ' u q| . */ +/\(** o +- 2 3 \*(AQ u q| . */ 176, 177, 178, 179, 180, 181, 182, 183, /\(** , 1 2 >> 1/4 1/2 3/4 ? */ 184, 185, 186, 187, 188, 189, 190, 191, -/\(** A` A' A^ A~ A: Ao AE C, */ +/\(** A` A\*(AQ A^ A~ A: Ao AE C, */ 48, 48, 48, 48, 48, 48, 48, 48, -/\(** E` E' E^ E: I` I' I^ I: */ +/\(** E` E\*(AQ E^ E: I` I\*(AQ I^ I: */ 48, 48, 48, 48, 48, 48, 48, 48, -/\(** D- N~ O` O' O^ O~ O: X */ +/\(** D- N~ O` O\*(AQ O^ O~ O: X */ 48, 48, 48, 48, 48, 48, 48, 215, -/\(** O/ U` U' U^ U: Y' P B */ +/\(** O/ U` U\*(AQ U^ U: Y\*(AQ P B */ 48, 48, 48, 48, 48, 48, 48, 48, -/\(** a` a' a^ a~ a: ao ae c, */ +/\(** a` a\*(AQ a^ a~ a: ao ae c, */ 48, 48, 48, 48, 48, 48, 48, 48, -/\(** e` e' e^ e: i` i' i^ i: */ +/\(** e` e\*(AQ e^ e: i` i\*(AQ i^ i: */ 48, 48, 48, 48, 48, 48, 48, 48, -/\(** d n~ o` o' o^ o~ o: -: */ +/\(** d n~ o` o\*(AQ o^ o~ o: -: */ 48, 48, 48, 48, 48, 48, 48, 247, -/\(** o/ u` u' u^ u: y' P y: */ +/\(** o/ u` u\*(AQ u^ u: y\*(AQ P y: */ 48, 48, 48, 48, 48, 48, 48, 48}; .NE -For example, the string ``33:48,37:48,45-47:48,38:48'' indicates that the +For example, the string \*(``33:48,37:48,45-47:48,38:48\*('' indicates that the exclamation mark, percent sign, dash, period, slash, and ampersand characters should be treated the same way as characters and numbers. This is useful @@ -4338,7 +4375,7 @@ words. Consecutive identical expansions are ignored. The word here is defined as a sequence of non-whitespace characters. This feature partially emulates the behavior -of `dynamic abbreviation' expansion in Emacs (bound there to M-/). +of \*(``dynamic abbreviation\*('' expansion in Emacs (bound there to M-/). Here is a resource setting for \fIxterm\fP which will do the same thing: .NS *VT100*translations: #override \\n\\\& @@ -4357,7 +4394,7 @@ by echoing the event's position (i.e., character line and column) in the following format: .sp .in +8 -^X ESC G <line+' '> <col+' '> +^X ESC G <line+\*(`` \*(''> <col+\*(`` \*(''> .in -8 .TP 8 .B "iconify()" @@ -4432,7 +4469,7 @@ If no name is given, the original set of fontnames is restored. .IP Unlike \fBset-vt-font()\fR, this does not affect the escape- and select-fonts, since those are not based on resource values. -It does affect the fonts loosely organized under the ``Default'' menu +It does affect the fonts loosely organized under the \*(``Default\*('' menu entry: \fBfont\fP, \fBboldFont\fP, \fBwideFont\fP and \fBwideBoldFont\fP. .TP 8 .B "maximize()" @@ -4451,6 +4488,12 @@ and \fItekMenu\fP. This action prints the window and is also invoked by the \fIprint\fP entry in \fImainMenu\fP. .TP 8 +.B "print-everything()" +This action sends the entire text history, in addition to the text +currently visible, to the program given in the \fBprinterCommand\fP resource. +With a suitable printer command, the action can be used to load the text +history in an editor. +.TP 8 .B "print-redir()" This action toggles the \fBprinterControlMode\fR between 0 and 2. The corresponding popup menu entry is useful for switching the printer @@ -4762,7 +4805,7 @@ This action inserts the specified text string as if it had been typed. Quotation is necessary if the string contains whitespace or non-alphanumeric characters. If the string argument begins with the -characters ``0x'', it is interpreted +characters \*(``0x\*('', it is interpreted as a hex character constant. .TP 8 .B "tek-copy()" @@ -4965,7 +5008,7 @@ XTERM_SHELL is set to the pathname of the program which is invoked. Usually that is a shell program, e.g., \fB/bin/sh\fP. Since it is not necessarily a shell program however, -it is distinct from ``SHELL''. +it is distinct from \*(``SHELL\*(''. .TP 5 XTERM_VERSION is set to the string displayed by the \fB-version\fP option. @@ -5231,31 +5274,11 @@ ERROR_SCALLOC2 .br Alloc: calloc() failed on rows .TP -92 -ERROR_SREALLOC -.br -ScreenResize: realloc() failed on alt base -.TP -96 -ERROR_RESIZE -.br -ScreenResize: malloc() or realloc() failed -.TP 102 ERROR_SAVE_PTR .br ScrnPointers: malloc/realloc() failed .TP -110 -ERROR_SBRALLOC -.br -ScrollBarOn: realloc() failed on base -.TP -111 -ERROR_SBRALLOC2 -.br -ScrollBarOn: realloc() failed on rows -.TP 121 ERROR_MMALLOC .br diff --git a/app/xterm/xtermcfg.hin b/app/xterm/xtermcfg.hin index c0395aeae..ff6a4bbd1 100644 --- a/app/xterm/xtermcfg.hin +++ b/app/xterm/xtermcfg.hin @@ -1,12 +1,8 @@ -/* $XTermId: xtermcfg.hin,v 1.171 2008/07/27 15:17:07 tom Exp $ */ - -/* - * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.61 2006/06/19 00:36:52 dickey Exp $ - */ +/* $XTermId: xtermcfg.hin,v 1.178 2009/08/09 17:23:19 tom Exp $ */ /************************************************************ -Copyright 1997-2007,2008 by Thomas E. Dickey +Copyright 1997-2008,2009 by Thomas E. Dickey All Rights Reserved @@ -108,6 +104,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #undef OPT_DEC_LOCATOR /* CF_ARG_ENABLE(dec-locator) */ #undef OPT_DEC_RECTOPS /* CF_ARG_ENABLE(rectangles) */ #undef OPT_EXEC_XTERM /* CF_ARG_ENABLE(exec-xterm) */ +#undef OPT_FIFO_LINES /* CF_ARG_ENABLE(fifo-lines) */ #undef OPT_HIGHLIGHT_COLOR /* CF_ARG_DISABLE(highlighting) */ #undef OPT_HP_FUNC_KEYS /* CF_ARG_ENABLE(hp-fkeys) */ #undef OPT_I18N_SUPPORT /* CF_ARG_DISABLE(i18n) */ @@ -133,6 +130,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #undef OPT_TEK4014 /* CF_ARG_DISABLE(tek4014) */ #undef OPT_TOOLBAR /* CF_ARG_ENABLE(toolbar) */ #undef OPT_VT52_MODE /* CF_ARG_DISABLE(vt52) */ +#undef OPT_WIDER_ICHAR /* CF_ARG_ENABLE(16bit-chars) */ #undef OPT_WIDE_CHARS /* CF_ARG_OPTION(wide-chars) */ #undef OPT_XMC_GLITCH /* CF_ARG_ENABLE(xmc-glitch) */ #undef OPT_ZICONBEEP /* CF_ARG_DISABLE(ziconbeep) */ @@ -192,7 +190,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef USE_MY_MEMMOVE #define memmove(d,s,n) my_memmove(d,s,n) -extern char * my_memmove(char * s1, char * s2, size_t n); +extern void * my_memmove(void * s1, void * s2, size_t n); #endif #ifndef HAVE_STRERROR |