diff -c -r -N cxterm-5.0-orig/README-color-cxterm cxterm-5.0/README-color-cxterm *** cxterm-5.0-orig/README-color-cxterm Wed Dec 31 19:00:00 1969 --- cxterm-5.0/README-color-cxterm Sat Aug 23 19:59:38 1997 *************** *** 0 **** --- 1,143 ---- + A tiny bug fix to refresh the screen during input (input.c, line 179). + Also, added a condition for misc.c (line 356) to compile cleanly on Sun + machines. + + Bruce Cheng (祘厩笷) + bcheng@tnc.org + August 18, 1997 + ________________________________________________________________________________ + + 眒︹ Chinese Xterm + ================== + + This is a patched cxterm-5.0p3 to enable full ANSI color. I didn't write + any of the codes myself, they are based on the work by: + + Ji-Tzay Yang (法膀更) Email: jjyang@csie.nctu.edu.tw + + Please do not send any inquiries to me, though compliments are welcome. + + The following README file is a little outdated, I've still included it for + the original information. + + To INSTALL, please read the README file that came with cxterm-5.0p3, and + ANSI color is enabled by default so you don't have to worry about it. + + + Bruce Cheng (祘厩笷) + Internet E-mail: bcheng@tnc.org + January 31, 1996 + ________________________________________________________________________________ + + README: + + You'd better to read the README after reading the file README.color-cxterm + + 1. Color-cxterm displays color chinese characters on the X11 windows. + It comes from the combination of color-xterm and cxterm in the + contribution directory of X11R5 source distribution. + + 2. It works for both X11R5 and X11R6. + + 3. If you can compile cxterm in your system, it means you can compile + color-cxterm in your system as well. + + 4. The work on color-cxterm is done in the computer center of + Copmuter Science and Information Engineering, Chiao-Tung Univ, Taiwan. + + Since the work is from help@csie.nctu.edu.tw, so you can feed back your + comment to them. + + The lastest version of color-cxterm would be found in: + + ftp://ftp.csie.nctu.edu.tw/pub/unix/color-cxterm.tar.gz + + 5. You can find other chinese-related packags in the same directory. + Trust me, you can find much treasure in the directory. + + ========== Quick Installation =========== + + >> For X11R5 user: + + In this directory, + + run as normal user, + % xmkmf + % make + + run as root, + % make install + + >> For X11R6 user: + + In this directory, run + + run as normal user, + % xmkmf + % make CFLAGS="-DIN_X11R6 -DHANZI" + + run as root, + % make install + + + You'll get your cxterm intalled in $X11/bin/cxterm. + We suggest that you back up the old cxterm before your installation. + + >> History: + + ===12/25/94 + The color cxterm is yet another port. + This work is based on the port of xterm to color xterm. + + This port has been tested on X11 R5/R6 + SunOS 4.1.3. Rumors said + that it also works on most X11 systems. + + >>> Feature in this update <<< + + (1) The copy/paste no longer lost chars. + (2) Add X11R6 support. + + + ===10/25/94 + + >>> Known bugs <<< + + (1) The copy/paste sometimes lost the last one or two chars. + + (2) If the last char of the copy/paste area is in special color, you'll get + incorrect background color when you press 'backspace' on command line. + This can be cured by choosing another copy/paste area which has normal + color attribute. + + >>> Additional Features <<< + + The following resources is added into the color cxterm, you can modify + it to specify how the foreground/background color 0-7 looks. + + cxterm*fcolor0: Black + cxterm*fcolor1: #FF0000 + cxterm*fcolor2: #00FF00 + cxterm*fcolor3: #FFFF00 + cxterm*fcolor4: #0000FF + cxterm*fcolor5: #FF00FF + cxterm*fcolor6: #00FFFF + cxterm*fcolor7: #FFFFFF + + cxterm*bcolor0: #101010 + cxterm*bcolor1: #E00000 + cxterm*bcolor2: #00E000 + cxterm*bcolor3: #E0E000 + cxterm*bcolor4: #0000E0 + cxterm*bcolor5: #E000E0 + cxterm*bcolor6: #00E0E0 + cxterm*bcolor7: #E0E0E0 + + >>> Test files <<< + You can run the two script "gen_text" and "gen_text2" to test the + color function. + + ==================================================================== + Ji-Tzay Yang (法 膀 更) Email: jjyang@csie.nctu.edu.tw + Distributed Software System Lab Phone: 886-35-712121 Ext 54718 + Computer Science & Information Engineering, Chiao-Tung Univ., Taiwan + WWW URL Welcome diff -c -r -N cxterm-5.0-orig/cxterm/CXterm.ad cxterm-5.0/cxterm/CXterm.ad *** cxterm-5.0-orig/cxterm/CXterm.ad Mon May 29 02:07:25 1995 --- cxterm-5.0/cxterm/CXterm.ad Sat Aug 23 19:56:44 1997 *************** *** 2,7 **** --- 2,27 ---- ! XTerm*vtMenu*cxtermconfig*Label: Hanzi Input Configuration + ! CXterm ANSI color configuration + cxterm*fcolor0: Black + cxterm*fcolor1: #FF0000 + cxterm*fcolor2: #00FF00 + cxterm*fcolor3: #FFFF00 + cxterm*fcolor4: #0000FF + cxterm*fcolor5: #FF00FF + cxterm*fcolor6: #00FFFF + cxterm*fcolor7: #FFFFFF + + !cxterm*bcolor0: #101010 + cxterm*bcolor0: Black + cxterm*bcolor1: #E00000 + cxterm*bcolor2: #00E000 + cxterm*bcolor3: #E0E000 + cxterm*bcolor4: #0000E0 + cxterm*bcolor5: #E000E0 + cxterm*bcolor6: #00E0E0 + cxterm*bcolor7: #E0E0E0 + ! ! resource for GB cxterm (Simplified Chinese as used in Mainland China) ! diff -c -r -N cxterm-5.0-orig/cxterm/README-color-cxterm cxterm-5.0/cxterm/README-color-cxterm *** cxterm-5.0-orig/cxterm/README-color-cxterm Wed Dec 31 19:00:00 1969 --- cxterm-5.0/cxterm/README-color-cxterm Sat Aug 23 19:56:44 1997 *************** *** 0 **** --- 1,141 ---- + A tiny bug fix to refresh the screen during input (input.c, line 179). + + Bruce Cheng (祘厩笷) + bcheng@tnc.org + August 18, 1997 + ________________________________________________________________________________ + + 眒︹ Chinese Xterm + ================== + + This is a patched cxterm-5.0p3 to enable full ANSI color. I didn't write + any of the codes myself, they are based on the work by: + + Ji-Tzay Yang (法膀更) Email: jjyang@csie.nctu.edu.tw + + Please do not send any inquiries to me, though compliments are welcome. + + The following README file is a little outdated, I've still included it for + the original information. + + To INSTALL, please read the README file that came with cxterm-5.0p3, and + ANSI color is enabled by default so you don't have to worry about it. + + + Bruce Cheng (祘厩笷) + Internet E-mail: bcheng@tnc.org + January 31, 1996 + ________________________________________________________________________________ + + README: + + You'd better to read the README after reading the file README.color-cxterm + + 1. Color-cxterm displays color chinese characters on the X11 windows. + It comes from the combination of color-xterm and cxterm in the + contribution directory of X11R5 source distribution. + + 2. It works for both X11R5 and X11R6. + + 3. If you can compile cxterm in your system, it means you can compile + color-cxterm in your system as well. + + 4. The work on color-cxterm is done in the computer center of + Copmuter Science and Information Engineering, Chiao-Tung Univ, Taiwan. + + Since the work is from help@csie.nctu.edu.tw, so you can feed back your + comment to them. + + The lastest version of color-cxterm would be found in: + + ftp://ftp.csie.nctu.edu.tw/pub/unix/color-cxterm.tar.gz + + 5. You can find other chinese-related packags in the same directory. + Trust me, you can find much treasure in the directory. + + ========== Quick Installation =========== + + >> For X11R5 user: + + In this directory, + + run as normal user, + % xmkmf + % make + + run as root, + % make install + + >> For X11R6 user: + + In this directory, run + + run as normal user, + % xmkmf + % make CFLAGS="-DIN_X11R6 -DHANZI" + + run as root, + % make install + + + You'll get your cxterm intalled in $X11/bin/cxterm. + We suggest that you back up the old cxterm before your installation. + + >> History: + + ===12/25/94 + The color cxterm is yet another port. + This work is based on the port of xterm to color xterm. + + This port has been tested on X11 R5/R6 + SunOS 4.1.3. Rumors said + that it also works on most X11 systems. + + >>> Feature in this update <<< + + (1) The copy/paste no longer lost chars. + (2) Add X11R6 support. + + + ===10/25/94 + + >>> Known bugs <<< + + (1) The copy/paste sometimes lost the last one or two chars. + + (2) If the last char of the copy/paste area is in special color, you'll get + incorrect background color when you press 'backspace' on command line. + This can be cured by choosing another copy/paste area which has normal + color attribute. + + >>> Additional Features <<< + + The following resources is added into the color cxterm, you can modify + it to specify how the foreground/background color 0-7 looks. + + cxterm*fcolor0: Black + cxterm*fcolor1: #FF0000 + cxterm*fcolor2: #00FF00 + cxterm*fcolor3: #FFFF00 + cxterm*fcolor4: #0000FF + cxterm*fcolor5: #FF00FF + cxterm*fcolor6: #00FFFF + cxterm*fcolor7: #FFFFFF + + cxterm*bcolor0: #101010 + cxterm*bcolor1: #E00000 + cxterm*bcolor2: #00E000 + cxterm*bcolor3: #E0E000 + cxterm*bcolor4: #0000E0 + cxterm*bcolor5: #E000E0 + cxterm*bcolor6: #00E0E0 + cxterm*bcolor7: #E0E0E0 + + >>> Test files <<< + You can run the two script "gen_text" and "gen_text2" to test the + color function. + + ==================================================================== + Ji-Tzay Yang (法 膀 更) Email: jjyang@csie.nctu.edu.tw + Distributed Software System Lab Phone: 886-35-712121 Ext 54718 + Computer Science & Information Engineering, Chiao-Tung Univ., Taiwan + WWW URL Welcome diff -c -r -N cxterm-5.0-orig/cxterm/Tekproc.c cxterm-5.0/cxterm/Tekproc.c *** cxterm-5.0-orig/cxterm/Tekproc.c Sun Apr 17 20:23:23 1994 --- cxterm-5.0/cxterm/Tekproc.c Sat Aug 23 19:56:44 1997 *************** *** 1481,1486 **** --- 1481,1533 ---- if (!Ttoggled) TCursorToggle(TOGGLE); } + void + ChangeTekColors(screen,pNew) + register TScreen *screen; + ScrnColors *pNew; + { + register int i; + XGCValues gcv; + + + if (COLOR_DEFINED(pNew,TEK_FG)) { + screen->Tforeground= COLOR_VALUE(pNew,TEK_FG); + XSetForeground(screen->display,screen->TnormalGC, + screen->Tforeground); + } + if (COLOR_DEFINED(pNew,TEK_BG)) { + screen->Tbackground= COLOR_VALUE(pNew,TEK_BG); + XSetBackground(screen->display,screen->TnormalGC, + screen->Tbackground); + } + + + if (tekWidget) { + if (tekWidget->core.border_pixel == screen->Tbackground) { + tekWidget->core.border_pixel = screen->Tforeground; + tekWidget->core.parent->core.border_pixel = + screen->Tforeground; + if (tekWidget->core.parent->core.window) + XSetWindowBorder (screen->display, + tekWidget->core.parent->core.window, + tekWidget->core.border_pixel); + } + } + + for(i = 0 ; i < TEKNUMLINES ; i++) { + XSetForeground(screen->display, screen->linepat[i], + screen->Tforeground); + } + + screen->Tcursorcolor = screen->Tforeground; + + gcv.plane_mask = screen->xorplane = (screen->Tbackground ^ + screen->Tcursorcolor); + XChangeGC (screen->display, screen->TcursorGC, GCPlaneMask, &gcv); + TekBackground(screen); + return; + } + TekReverseVideo(screen) register TScreen *screen; { diff -c -r -N cxterm-5.0-orig/cxterm/button.c cxterm-5.0/cxterm/button.c *** cxterm-5.0-orig/cxterm/button.c Mon Jun 6 05:41:46 1994 --- cxterm-5.0/cxterm/button.c Sat Aug 23 19:56:44 1997 *************** *** 762,769 **** register Char *ch; for ( i = screen->max_col, ! ch = screen->buf[2 * (row + screen->topline) + 1] + i ; ! i >= 0 && !(*ch & CHARDRAWN) ; ch--, i--) ; return(i); --- 762,769 ---- register Char *ch; for ( i = screen->max_col, ! ch = screen->buf[4 * (row + screen->topline) + 1] + i ; ! i >= 0 && !(*ch & CHARDRAWN || *ch & CHARHANZI) ; ch--, i--) ; return(i); *************** *** 915,924 **** #ifdef HANZI #define RowCol_HZ(r,c) \ (((c) <= screen->max_col) && \ ! ((screen->buf[2 * ((r)+screen->topline) + 1][c]) & CHARHANZI)) #define RowCol_2ndByteHZ(r,c) \ (((c) <= screen->max_col) && \ ! Is2ndByteHZ(screen->buf[2 * ((r)+screen->topline) + 1][c])) /* startSCol, endSCol should always be at the beginning of a HZ */ if (RowCol_2ndByteHZ(startSRow,startSCol)) --- 915,924 ---- #ifdef HANZI #define RowCol_HZ(r,c) \ (((c) <= screen->max_col) && \ ! ((screen->buf[4 * ((r)+screen->topline) + 1][c]) & CHARHANZI)) #define RowCol_2ndByteHZ(r,c) \ (((c) <= screen->max_col) && \ ! Is2ndByteHZ(screen->buf[4 * ((r)+screen->topline) + 1][c])) /* startSCol, endSCol should always be at the beginning of a HZ */ if (RowCol_2ndByteHZ(startSRow,startSCol)) *************** *** 943,949 **** startSCol = 0; startSRow++; } else { ! ptr = screen->buf[2*(startSRow+screen->topline)] + startSCol; class = charClass[*ptr]; do { --- 943,949 ---- startSCol = 0; startSRow++; } else { ! ptr = screen->buf[4*(startSRow+screen->topline)] + startSCol; class = charClass[*ptr]; do { *************** *** 968,974 **** endSRow++; } else { length = LastTextCol(endSRow); ! ptr = screen->buf[2*(endSRow+screen->topline)] + endSCol; class = charClass[*ptr]; do { --- 968,974 ---- endSRow++; } else { length = LastTextCol(endSRow); ! ptr = screen->buf[4*(endSRow+screen->topline)] + endSCol; class = charClass[*ptr]; do { *************** *** 1401,1407 **** int *eol; { register int i = 0; ! register Char *ch = screen->buf[2 * (row + screen->topline)]; Char attr; register int c; --- 1401,1407 ---- int *eol; { register int i = 0; ! register Char *ch = screen->buf[4 * (row + screen->topline)]; Char attr; register int c; diff -c -r -N cxterm-5.0-orig/cxterm/charproc.c cxterm-5.0/cxterm/charproc.c *** cxterm-5.0-orig/cxterm/charproc.c Tue Feb 14 02:43:30 1995 --- cxterm-5.0/cxterm/charproc.c Sat Aug 23 19:56:44 1997 *************** *** 137,142 **** --- 137,161 ---- #define XtNcurses "curses" #define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" #define XtNcursorColor "cursorColor" + + #define XtFcolor0 "fcolor0" + #define XtFcolor1 "fcolor1" + #define XtFcolor2 "fcolor2" + #define XtFcolor3 "fcolor3" + #define XtFcolor4 "fcolor4" + #define XtFcolor5 "fcolor5" + #define XtFcolor6 "fcolor6" + #define XtFcolor7 "fcolor7" + + #define XtBcolor0 "bcolor0" + #define XtBcolor1 "bcolor1" + #define XtBcolor2 "bcolor2" + #define XtBcolor3 "bcolor3" + #define XtBcolor4 "bcolor4" + #define XtBcolor5 "bcolor5" + #define XtBcolor6 "bcolor6" + #define XtBcolor7 "bcolor7" + #define XtNcutNewline "cutNewline" #define XtNcutToBeginningOfLine "cutToBeginningOfLine" #define XtNeightBitInput "eightBitInput" *************** *** 496,502 **** XtRString, "XtDefaultForeground"}, {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), XtOffsetOf(XtermWidgetRec, screen.cursorcolor), ! XtRString, "XtDefaultForeground"}, {XtNeightBitInput, XtCEightBitInput, XtRBoolean, sizeof(Boolean), XtOffsetOf(XtermWidgetRec, screen.input_eight_bits), XtRBoolean, (XtPointer) &defaultTRUE}, --- 515,572 ---- XtRString, "XtDefaultForeground"}, {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), XtOffsetOf(XtermWidgetRec, screen.cursorcolor), ! XtRString, "Green"}, ! ! {XtFcolor0, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_0]), ! XtRString, "Black"}, ! {XtFcolor1, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_1]), ! XtRString, "Red"}, ! {XtFcolor2, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_2]), ! XtRString, "Green"}, ! {XtFcolor3, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_3]), ! XtRString, "Yellow"}, ! {XtFcolor4, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_4]), ! XtRString, "Blue"}, ! {XtFcolor5, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_5]), ! XtRString, "Magenta"}, ! {XtFcolor6, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_6]), ! XtRString, "Cyan"}, ! {XtFcolor7, XtCForeground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[FCOLOR_7]), ! XtRString, "White"}, ! ! {XtBcolor0, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_0]), ! XtRString, "Black"}, ! {XtBcolor1, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_1]), ! XtRString, "Red"}, ! {XtBcolor2, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_2]), ! XtRString, "Green"}, ! {XtBcolor3, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_3]), ! XtRString, "Yellow"}, ! {XtBcolor4, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_4]), ! XtRString, "Blue"}, ! {XtBcolor5, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_5]), ! XtRString, "Magenta"}, ! {XtBcolor6, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_6]), ! XtRString, "Cyan"}, ! {XtBcolor7, XtCBackground, XtRPixel, sizeof(Pixel), ! XtOffsetOf(XtermWidgetRec, screen.colors[BCOLOR_7]), ! XtRString, "White"}, ! {XtNeightBitInput, XtCEightBitInput, XtRBoolean, sizeof(Boolean), XtOffsetOf(XtermWidgetRec, screen.input_eight_bits), XtRBoolean, (XtPointer) &defaultTRUE}, *************** *** 628,633 **** --- 698,706 ---- {"font6", "Font6", XtRString, sizeof(String), XtOffsetOf(XtermWidgetRec, screen.menu_font_names[fontMenu_font6]), XtRString, (XtPointer) NULL}, + {"dynamicColors", "DynamicColors", XtRBoolean, sizeof(Boolean), + XtOffsetOf(XtermWidgetRec, misc.dynamicColors), + XtRBoolean, (XtPointer) &defaultTRUE} }; static void VTClassInit(); *************** *** 738,749 **** --- 811,826 ---- } if(screen->curss) { dotext(screen, term->flags | CHARHANZI, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curss], bptr, bptr + 2); screen->curss = 0; bptr++, bptr++; } if(bptr < cp) dotext(screen, term->flags | CHARHANZI, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curgl], bptr, cp); } else { while (top > 0 && !(*cp & 0x80) && isprint(*cp)) { *************** *** 753,764 **** --- 830,845 ---- } if(screen->curss) { dotext(screen, term->flags & ~CHARHANZI, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curss], bptr, bptr + 1); screen->curss = 0; bptr++; } if(bptr < cp) dotext(screen, term->flags & ~CHARHANZI, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curgl], bptr, cp); } #else /* HANZI */ *************** *** 769,780 **** --- 850,865 ---- } if(screen->curss) { dotext(screen, term->flags, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curss], bptr, bptr + 1); screen->curss = 0; bptr++; } if(bptr < cp) dotext(screen, term->flags, + term->cur_foreground, + term->cur_background, screen->gsets[screen->curgl], bptr, cp); #endif /* HANZI */ bptr = cp; *************** *** 1073,1089 **** switch (param[row]) { case DEFAULT: case 0: ! term->flags &= ~(INVERSE|BOLD|UNDERLINE); break; case 1: case 5: /* Blink, really. */ term->flags |= BOLD; break; case 4: /* Underscore */ term->flags |= UNDERLINE; break; case 7: term->flags |= INVERSE; } } parsestate = groundtable; --- 1158,1202 ---- switch (param[row]) { case DEFAULT: case 0: ! term->flags &= ! ~(INVERSE|BOLD|UNDERLINE|FG_COLOR| ! BG_COLOR|DIM); break; case 1: case 5: /* Blink, really. */ term->flags |= BOLD; break; + case 2: + term->flags |= DIM; + break; case 4: /* Underscore */ term->flags |= UNDERLINE; break; case 7: term->flags |= INVERSE; + break; + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + term->flags |= FG_COLOR; + term->cur_foreground = param[row] - 30; + break; + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + term->flags |= BG_COLOR; + term->cur_background = param[row] - 40; + break; } } parsestate = groundtable; *************** *** 1182,1190 **** if(screen->cursor_state) HideCursor(); for(row = screen->max_row ; row >= 0 ; row--) { ! bzero(screen->buf[2 * row + 1], col = screen->max_col + 1); ! for(cp = (unsigned char *)screen->buf[2 * row] ; col > 0 ; col--) *cp++ = (unsigned char) 'E'; } ScrnRefresh(screen, 0, 0, screen->max_row + 1, --- 1295,1303 ---- if(screen->cursor_state) HideCursor(); for(row = screen->max_row ; row >= 0 ; row--) { ! bzero(screen->buf[4 * row + 1], col = screen->max_col + 1); ! for(cp = (unsigned char *)screen->buf[4 * row] ; col > 0 ; col--) *cp++ = (unsigned char) 'E'; } ScrnRefresh(screen, 0, 0, screen->max_row + 1, *************** *** 1589,1597 **** * by charset. worry about end of line conditions (wraparound if selected). */ static void ! dotext(screen, flags, charset, buf, ptr) register TScreen *screen; unsigned flags; char charset; char *buf; /* start of characters to process */ char *ptr; /* end */ --- 1702,1711 ---- * by charset. worry about end of line conditions (wraparound if selected). */ static void ! dotext(screen, flags, fg, bg, charset, buf, ptr) register TScreen *screen; unsigned flags; + unsigned fg, bg; char charset; char *buf; /* start of characters to process */ char *ptr; /* end */ *************** *** 1658,1664 **** return; #endif /* HANZI */ next_col = screen->cur_col + n; ! WriteText(screen, ptr, n, flags); /* * the call to WriteText updates screen->cur_col. * If screen->cur_col != next_col, we must have --- 1772,1778 ---- return; #endif /* HANZI */ next_col = screen->cur_col + n; ! WriteText(screen, ptr, n, flags, fg, bg); /* * the call to WriteText updates screen->cur_col. * If screen->cur_col != next_col, we must have *************** *** 1675,1690 **** * the current cursor position. update cursor position. */ static void ! WriteText(screen, str, len, flags) register TScreen *screen; register char *str; register int len; unsigned flags; { register int cx, cy; register unsigned fgs = flags; GC currentGC; if(screen->cur_row - screen->topline <= screen->max_row) { /* if(screen->cur_row == screen->cursor_row && screen->cur_col <= --- 1789,1810 ---- * the current cursor position. update cursor position. */ static void ! WriteText(screen, str, len, flags, fg, bg) register TScreen *screen; register char *str; register int len; unsigned flags; + unsigned fg, bg; { register int cx, cy; register unsigned fgs = flags; + register Pixel fg_pix, bg_pix; GC currentGC; + extern XtermWidget term; + fg_pix = (fgs&FG_COLOR) ? screen->colors[fg] : screen->foreground; + bg_pix = (fgs&BG_COLOR) ? screen->colors[bg + N_FGCOLOR] : term->core.background_pixel; + if(screen->cur_row - screen->topline <= screen->max_row) { /* if(screen->cur_row == screen->cursor_row && screen->cur_col <= *************** *** 1700,1723 **** #ifdef HANZI if (fgs & CHARHANZI) ! if (fgs & BOLD) ! if (fgs & INVERSE) ! currentGC = screen->hz_reverseboldGC; ! else currentGC = screen->hz_normalboldGC; ! else /* not bold */ ! if (fgs & INVERSE) ! currentGC = screen->hz_reverseGC; ! else currentGC = screen->hz_normalGC; else #endif /* HANZI */ ! if (fgs & BOLD) ! if (fgs & INVERSE) ! currentGC = screen->reverseboldGC; ! else currentGC = screen->normalboldGC; ! else /* not bold */ ! if (fgs & INVERSE) ! currentGC = screen->reverseGC; ! else currentGC = screen->normalGC; if (fgs & INSERT) InsertChar(screen, len); --- 1820,1858 ---- #ifdef HANZI if (fgs & CHARHANZI) ! if (fgs & INVERSE) { ! if (fgs & BOLD) ! currentGC = screen->hz_reverseboldGC; ! else currentGC = screen->hz_reverseGC; ! ! XSetForeground(screen->display, currentGC, bg_pix); ! XSetBackground(screen->display, currentGC, fg_pix); ! } else { /* not inverse */ ! if (fgs & BOLD) ! currentGC = screen->hz_normalboldGC; ! else currentGC = screen->hz_normalGC; ! ! XSetForeground(screen->display, currentGC, fg_pix); ! XSetBackground(screen->display, currentGC, bg_pix); ! } else #endif /* HANZI */ ! if (fgs & INVERSE) { ! if (fgs & BOLD) ! currentGC = screen->reverseboldGC; ! else currentGC = screen->reverseGC; ! ! XSetForeground(screen->display, currentGC, bg_pix); ! XSetBackground(screen->display, currentGC, fg_pix); ! } else { /* not inverse */ ! if (fgs & BOLD) ! currentGC = screen->normalboldGC; ! else currentGC = screen->normalGC; ! ! XSetForeground(screen->display, currentGC, fg_pix); ! XSetBackground(screen->display, currentGC, bg_pix); ! } ! if (fgs & INSERT) InsertChar(screen, len); *************** *** 1767,1773 **** ++ntotal; } } ! ScreenWrite(screen, str, flags, len); CursorForward(screen, len); } --- 1902,1908 ---- ++ntotal; } } ! ScreenWrite(screen, str, flags, fg, bg, len); CursorForward(screen, len); } *************** *** 2317,2328 **** register TScreen *screen; { register int rows = screen->max_row + 1; ! char *save [2 * MAX_ROWS]; ! memmove( (char *)save, (char *)screen->buf, 2 * sizeof(char *) * rows); memmove( (char *)screen->buf, (char *)screen->altbuf, ! 2 * sizeof(char *) * rows); ! memmove( (char *)screen->altbuf, (char *)save, 2 * sizeof(char *) * rows); } VTRun() --- 2452,2463 ---- register TScreen *screen; { register int rows = screen->max_row + 1; ! char *save [4 * MAX_ROWS]; ! memmove( (char *)save, (char *)screen->buf, 4 * sizeof(char *) * rows); memmove( (char *)screen->buf, (char *)screen->altbuf, ! 4 * sizeof(char *) * rows); ! memmove( (char *)screen->altbuf, (char *)save, 4 * sizeof(char *) * rows); } VTRun() *************** *** 2456,2462 **** screen->allbuf = Allocate (nrows, screen->max_col + 1, &screen->sbuf_address); if (screen->scrollWidget) ! screen->buf = &screen->allbuf[2 * screen->savelines]; else screen->buf = screen->allbuf; return; --- 2591,2597 ---- screen->allbuf = Allocate (nrows, screen->max_col + 1, &screen->sbuf_address); if (screen->scrollWidget) ! screen->buf = &screen->allbuf[4 * screen->savelines]; else screen->buf = screen->allbuf; return; *************** *** 2520,2525 **** --- 2655,2663 ---- for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { new->screen.menu_font_names[i] = request->screen.menu_font_names[i]; } + for (i = 0; i < MAXCOLORS; i++) { + new->screen.colors[i] = request->screen.colors[i]; + } /* set default in realize proc */ new->screen.menu_font_names[fontMenu_fontdefault] = NULL; new->screen.menu_font_names[fontMenu_fontescape] = NULL; *************** *** 2898,2904 **** if (screen->cur_row - screen->topline > screen->max_row) return; ! c = screen->buf[y = 2 * (screen->cursor_row = screen->cur_row)] [x = screen->cursor_col = screen->cur_col]; flags = screen->buf[y + 1][x]; #ifdef HANZI --- 3036,3042 ---- if (screen->cur_row - screen->topline > screen->max_row) return; ! c = screen->buf[y = 4 * (screen->cursor_row = screen->cur_row)] [x = screen->cursor_col = screen->cur_col]; flags = screen->buf[y + 1][x]; #ifdef HANZI *************** *** 3072,3078 **** if(screen->cursor_row - screen->topline > screen->max_row) return; ! c = screen->buf[y = 2 * screen->cursor_row][x = screen->cursor_col]; flags = screen->buf[y + 1][x]; #ifdef HANZI if (flags & CHARHANZI) --- 3210,3216 ---- if(screen->cursor_row - screen->topline > screen->max_row) return; ! c = screen->buf[y = 4 * screen->cursor_row][x = screen->cursor_col]; flags = screen->buf[y + 1][x]; #ifdef HANZI if (flags & CHARHANZI) *************** *** 3594,3621 **** xgcv.graphics_exposures = TRUE; /* default */ xgcv.function = GXcopy; ! new_normalGC = XtGetGC((Widget)term, mask, &xgcv); if (!new_normalGC) goto bad; if (nfs == bfs) { /* there is no bold font */ new_normalboldGC = new_normalGC; } else { xgcv.font = bfs->fid; ! new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv); if (!new_normalboldGC) goto bad; } xgcv.font = nfs->fid; xgcv.foreground = term->core.background_pixel; xgcv.background = screen->foreground; ! new_reverseGC = XtGetGC((Widget)term, mask, &xgcv); if (!new_reverseGC) goto bad; if (nfs == bfs) { /* there is no bold font */ new_reverseboldGC = new_reverseGC; } else { xgcv.font = bfs->fid; ! new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv); if (!new_reverseboldGC) goto bad; } --- 3732,3765 ---- xgcv.graphics_exposures = TRUE; /* default */ xgcv.function = GXcopy; ! new_normalGC = XCreateGC(screen->display, ! DefaultRootWindow(screen->display), mask, &xgcv); if (!new_normalGC) goto bad; if (nfs == bfs) { /* there is no bold font */ new_normalboldGC = new_normalGC; } else { xgcv.font = bfs->fid; ! new_normalboldGC = XCreateGC(screen->display, ! DefaultRootWindow(screen->display), ! mask, &xgcv); if (!new_normalboldGC) goto bad; } xgcv.font = nfs->fid; xgcv.foreground = term->core.background_pixel; xgcv.background = screen->foreground; ! new_reverseGC = XCreateGC(screen->display, ! DefaultRootWindow(screen->display), mask, &xgcv); if (!new_reverseGC) goto bad; if (nfs == bfs) { /* there is no bold font */ new_reverseboldGC = new_reverseGC; } else { xgcv.font = bfs->fid; ! new_reverseboldGC = XCreateGC(screen->display, ! DefaultRootWindow(screen->display), ! mask, &xgcv); if (!new_reverseboldGC) goto bad; } diff -c -r -N cxterm-5.0-orig/cxterm/cursor.c cxterm-5.0/cxterm/cursor.c *** cxterm-5.0-orig/cxterm/cursor.c Mon Sep 20 17:42:25 1993 --- cxterm-5.0/cxterm/cursor.c Sat Aug 23 19:56:44 1997 *************** *** 203,208 **** --- 203,213 ---- CarriageReturn(screen) register TScreen *screen; { + /* extern void ScrnSetAttributes(); + + ScrnSetAttributes(screen, screen->cur_row, screen->cur_col, + ENDLINE, ENDLINE, 1); + */ screen->cur_col = 0; screen->do_wrap = 0; _CheckSelection(screen); diff -c -r -N cxterm-5.0-orig/cxterm/gen_text cxterm-5.0/cxterm/gen_text *** cxterm-5.0-orig/cxterm/gen_text Wed Dec 31 19:00:00 1969 --- cxterm-5.0/cxterm/gen_text Sat Aug 23 19:56:44 1997 *************** *** 0 **** --- 1,24 ---- + #!/bin/sh + echo "Color test ....." + for key in 0 1 4 + do + echo "" + case $key in + 0) ;; + 1) echo "BOLD" ;; + 4) echo "UNDERLINE" ;; + 7) echo "REVERSE" ;; + esac + echo ; echo -n "[${key}m" + + for left in 30 31 32 33 34 35 36 37 + do + for right in 40 41 42 43 44 45 46 47 + do + echo -n "[${left};${right}m[$left;$right]" + done + echo "" + done + done + + echo "" ; echo diff -c -r -N cxterm-5.0-orig/cxterm/gen_text2 cxterm-5.0/cxterm/gen_text2 *** cxterm-5.0-orig/cxterm/gen_text2 Wed Dec 31 19:00:00 1969 --- cxterm-5.0/cxterm/gen_text2 Sat Aug 23 19:56:44 1997 *************** *** 0 **** --- 1,11 ---- + #!/bin/sh + echo  + for right in 47 46 45 44 43 42 41 + do + for left in 31 32 33 34 35 36 37 + do + echo -n "[${left};${right}m 〈" + done + echo "" + done + echo  diff -c -r -N cxterm-5.0-orig/cxterm/input.c cxterm-5.0/cxterm/input.c *** cxterm-5.0-orig/cxterm/input.c Tue Jan 17 05:58:02 1995 --- cxterm-5.0/cxterm/input.c Sat Aug 23 19:56:44 1997 *************** *** 177,182 **** --- 177,183 ---- #ifdef ENABLE_PRINT if (keysym == XK_F2) TekPrint(); #endif + RefreshCXtermInput(screen); return; } diff -c -r -N cxterm-5.0-orig/cxterm/main.c cxterm-5.0/cxterm/main.c *** cxterm-5.0-orig/cxterm/main.c Wed Aug 9 00:45:25 1995 --- cxterm-5.0/cxterm/main.c Sat Aug 23 19:56:45 1997 *************** *** 645,650 **** --- 645,652 ---- {"-cr", "*cursorColor", XrmoptionSepArg, (caddr_t) NULL}, {"-cu", "*curses", XrmoptionNoArg, (caddr_t) "on"}, {"+cu", "*curses", XrmoptionNoArg, (caddr_t) "off"}, + {"-dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "off"}, + {"+dc", "*dynamicColors",XrmoptionNoArg, (caddr_t) "on"}, {"-e", NULL, XrmoptionSkipLine, (caddr_t) NULL}, {"-fb", "*boldFont", XrmoptionSepArg, (caddr_t) NULL}, #ifdef HANZI *************** *** 800,805 **** --- 802,808 ---- { "-C", "intercept console messages (not supported)" }, #endif { "-Sxxd", "slave mode on \"ttyxx\", file descriptor \"d\"" }, + { "-/+dc", "turn off/on dynamic color selection" }, { NULL, NULL }}; static char *message[] = { *************** *** 966,972 **** */ d_tio.c_iflag = ICRNL|IXON; d_tio.c_oflag = OPOST|ONLCR|TAB3; ! #if defined(macII) || defined(ATT) || defined(CRAY) /* { */ #ifndef HANZI d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL; #else /* HANZI */ --- 969,975 ---- */ d_tio.c_iflag = ICRNL|IXON; d_tio.c_oflag = OPOST|ONLCR|TAB3; ! #if defined(macII) || defined(ATT) || defined(CRAY) || (defined(sun) && defined(SVR4)) /* { */ #ifndef HANZI d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL; #else /* HANZI */ *************** *** 1931,1936 **** --- 1934,1942 ---- #ifdef TIOCSLTC ltc = d_ltc; #endif /* TIOCSLTC */ + #if defined(sun) && defined(SVR4) + #undef TIOCLSET + #endif #ifdef TIOCLSET lmode = d_lmode; #endif /* TIOCLSET */ *************** *** 2312,2318 **** */ { #ifdef USE_SYSV_TERMIO ! #if defined(umips) || defined(CRAY) || defined(linux) /* If the control tty had its modes screwed around with, eg. by lineedit in the shell, or emacs, etc. then tio will have bad values. Let's just get termio from the --- 2318,2324 ---- */ { #ifdef USE_SYSV_TERMIO ! #if defined(umips) || defined(CRAY) || defined(linux) || (defined(sun) && defined(SVR4)) /* If the control tty had its modes screwed around with, eg. by lineedit in the shell, or emacs, etc. then tio will have bad values. Let's just get termio from the diff -c -r -N cxterm-5.0-orig/cxterm/misc.c cxterm-5.0/cxterm/misc.c *** cxterm-5.0-orig/cxterm/misc.c Tue Jan 17 05:57:48 1995 --- cxterm-5.0/cxterm/misc.c Sat Aug 23 20:00:19 1997 *************** *** 343,349 **** --- 343,353 ---- return; } } + #if defined(sun) + gettimeofday(&curtime, NULL); + #else X_GETTIMEOFDAY(&curtime); + #endif now_msecs = 1000*curtime.tv_sec + curtime.tv_usec/1000; if(lastBellTime != 0 && now_msecs - lastBellTime >= 0 && now_msecs - lastBellTime < screen->bellSuppressTime) { *************** *** 700,705 **** --- 704,718 ---- Changename(buf); Changetitle(buf); break; + case 10: case 11: case 12: + case 13: case 14: case 15: + case 16: + { + extern Boolean ChangeColorsRequest(); + if (term->misc.dynamicColors) + ChangeColorsRequest(term,mode-10,buf); + } + break; case 1: /* new icon name only */ Changename(buf); *************** *** 775,780 **** --- 788,972 ---- { ChangeGroup( XtNtitle, (XtArgVal)name ); } + + /***====================================================================***/ + + ScrnColors *pOldColors= NULL; + + Boolean + GetOldColors(pTerm) + XtermWidget pTerm; + { + int i; + if (pOldColors==NULL) { + pOldColors= (ScrnColors *)XtMalloc(sizeof(ScrnColors)); + if (pOldColors==NULL) { + fprintf(stderr,"allocation failure in GetOldColors\n"); + return(FALSE); + } + pOldColors->which= 0; + for (i=0;icolors[i]= 0; + pOldColors->names[i]= NULL; + } + GetColors(pTerm,pOldColors); + } + return(TRUE); + } + + Boolean + UpdateOldColors(pTerm,pNew) + XtermWidget pTerm; + ScrnColors *pNew; + { + int i; + + /* if we were going to free old colors, this would be the place to + * do it. I've decided not to (for now), because it seems likely + * that we'd have a small set of colors we use over and over, and that + * we could save some overhead this way. The only case in which this + * (clearly) fails is if someone is trying a boatload of colors, in + * which case they can restart xterm + */ + for (i=0;inames[i]!=NULL) { + XtFree(pOldColors->names[i]); + pOldColors->names[i]= NULL; + } + if (pNew->names[i]) { + pOldColors->names[i]= pNew->names[i]; + } + pOldColors->colors[i]= pNew->colors[i]; + } + } + return(TRUE); + } + + void + ReverseOldColors() + { + register ScrnColors *pOld= pOldColors; + Pixel tmpPix; + char *tmpName; + + if (pOld) { + /* change text cursor, if necesary */ + if (pOld->colors[TEXT_CURSOR]==pOld->colors[TEXT_FG]) { + pOld->colors[TEXT_CURSOR]= pOld->colors[TEXT_BG]; + if (pOld->names[TEXT_CURSOR]) { + XtFree(pOldColors->names[TEXT_CURSOR]); + pOld->names[TEXT_CURSOR]= NULL; + } + if (pOld->names[TEXT_BG]) { + tmpName= XtMalloc(strlen(pOld->names[TEXT_BG])+1); + if (tmpName) { + strcpy(tmpName,pOld->names[TEXT_BG]); + pOld->names[TEXT_CURSOR]= tmpName; + } + } + } + + /* swap text FG and BG */ + tmpPix= pOld->colors[TEXT_FG]; + tmpName= pOld->names[TEXT_FG]; + pOld->colors[TEXT_FG]= pOld->colors[TEXT_BG]; + pOld->names[TEXT_FG]= pOld->names[TEXT_BG]; + pOld->colors[TEXT_BG]= tmpPix; + pOld->names[TEXT_BG]= tmpName; + + /* swap mouse FG and BG */ + tmpPix= pOld->colors[MOUSE_FG]; + tmpName= pOld->names[MOUSE_FG]; + pOld->colors[MOUSE_FG]= pOld->colors[MOUSE_BG]; + pOld->names[MOUSE_FG]= pOld->names[MOUSE_BG]; + pOld->colors[MOUSE_BG]= tmpPix; + pOld->names[MOUSE_BG]= tmpName; + + /* swap Tek FG and BG */ + tmpPix= pOld->colors[TEK_FG]; + tmpName= pOld->names[TEK_FG]; + pOld->colors[TEK_FG]= pOld->colors[TEK_BG]; + pOld->names[TEK_FG]= pOld->names[TEK_BG]; + pOld->colors[TEK_BG]= tmpPix; + pOld->names[TEK_BG]= tmpName; + } + return; + } + + Boolean + AllocateColor(pTerm,pNew,ndx,name) + XtermWidget pTerm; + ScrnColors *pNew; + int ndx; + char *name; + { + XColor def; + register TScreen *screen= &pTerm->screen; + Colormap cmap= pTerm->core.colormap; + char *newName; + + if ((XParseColor(screen->display,cmap,name,&def))&& + (XAllocColor(screen->display,cmap,&def))) { + SET_COLOR_VALUE(pNew,ndx,def.pixel); + newName= XtMalloc(strlen(name)+1); + if (newName) { + strcpy(newName,name); + SET_COLOR_NAME(pNew,ndx,newName); + } + return(TRUE); + } + return(FALSE); + } + + Boolean + ChangeColorsRequest(pTerm,start,names) + XtermWidget pTerm; + int start; + register char *names; + { + char *thisName; + ScrnColors newColors; + int i,ndx; + + if ((pOldColors==NULL)&&(!GetOldColors(pTerm))) { + return(FALSE); + } + newColors.which= 0; + for (i=0;imisc.re_verse) ndx= OPPOSITE_COLOR(i); + else ndx= i; + if ((names==NULL)||(names[0]=='\0')) { + newColors.names[ndx]= NULL; + } + else { + if (names[0]==';') + thisName= NULL; + else thisName= names; + names= index(names,';'); + if (names!=NULL) { + *names= '\0'; + names++; + } + if ((!pOldColors->names[ndx])|| + (thisName&&(strcmp(thisName,pOldColors->names[ndx])))) { + AllocateColor(pTerm,&newColors,ndx,thisName); + } + } + } + + if (newColors.which==0) + return(TRUE); + + ChangeColors(pTerm,&newColors); + UpdateOldColors(pTerm,&newColors); + return(TRUE); + } + + /***====================================================================***/ #ifndef DEBUG /* ARGSUSED */ diff -c -r -N cxterm-5.0-orig/cxterm/ptyx.h cxterm-5.0/cxterm/ptyx.h *** cxterm-5.0-orig/cxterm/ptyx.h Tue Jan 17 05:57:50 1995 --- cxterm-5.0/cxterm/ptyx.h Sat Aug 23 19:56:45 1997 *************** *** 199,204 **** --- 199,259 ---- int linetype; } Tmodes; + /***====================================================================***/ + + #define TEXT_FG 0 + #define TEXT_BG 1 + #define TEXT_CURSOR 2 + #define MOUSE_FG 3 + #define MOUSE_BG 4 + #define TEK_FG 5 + #define TEK_BG 6 + #define NCOLORS 7 + + #define COLOR_DEFINED(s,w) ((s)->which&(1<<(w))) + #define COLOR_VALUE(s,w) ((s)->colors[w]) + #define SET_COLOR_VALUE(s,w,v) (((s)->colors[w]=(v)),((s)->which|=(1<<(w)))) + + #define COLOR_NAME(s,w) ((s)->names[w]) + #define SET_COLOR_NAME(s,w,v) (((s)->names[w]=(v)),((s)->which|=(1<<(w)))) + + #define UNDEFINE_COLOR(s,w) ((s)->which&=(~((w)<<1))) + #define OPPOSITE_COLOR(n) (((n)==TEXT_FG?TEXT_BG:\ + ((n)==TEXT_BG?TEXT_FG:\ + ((n)==MOUSE_FG?MOUSE_BG:\ + ((n)==MOUSE_BG?MOUSE_FG:\ + ((n)==TEK_FG?TEK_BG:\ + ((n)==TEXT_BG?TEK_FG:(n)))))))) + + typedef struct { + unsigned which; + Pixel colors[NCOLORS]; + char *names[NCOLORS]; + } ScrnColors; + + /***====================================================================***/ + + #define MAXCOLORS 16 + #define N_FGCOLOR 8 + + #define FCOLOR_0 0 + #define FCOLOR_1 1 + #define FCOLOR_2 2 + #define FCOLOR_3 3 + #define FCOLOR_4 4 + #define FCOLOR_5 5 + #define FCOLOR_6 6 + #define FCOLOR_7 7 + + #define BCOLOR_0 8 + #define BCOLOR_1 9 + #define BCOLOR_2 10 + #define BCOLOR_3 11 + #define BCOLOR_4 12 + #define BCOLOR_5 13 + #define BCOLOR_6 14 + #define BCOLOR_7 15 + typedef struct { int Twidth; int Theight; *************** *** 250,255 **** --- 305,311 ---- Pixel cursorcolor; /* Cursor color */ Pixel mousecolor; /* Mouse color */ Pixel mousecolorback; /* Mouse color background */ + Pixel colors[MAXCOLORS]; /* ANSI color emulation */ int border; /* inner border */ Cursor arrow; /* arrow cursor */ unsigned short send_mouse_pos; /* user wants mouse transition */ *************** *** 471,476 **** --- 527,533 ---- Boolean scrollbar; Boolean titeInhibit; Boolean tekSmall; /* start tek window in small size */ + Boolean dynamicColors; Boolean appcursorDefault; Boolean appkeypadDefault; } Misc; *************** *** 504,509 **** --- 561,568 ---- TKeyboard keyboard; /* terminal keyboard */ TScreen screen; /* terminal screen */ unsigned flags; /* mode flags */ + unsigned cur_foreground; /* current foreground color */ + unsigned cur_background; /* current background color */ unsigned initflags; /* initial mode flags */ Tabs tabs; /* tabstops of the terminal */ Misc misc; /* miscellaneous parameters */ *************** *** 526,532 **** */ #ifdef HANZI ! #define ATTRIBUTES 0x87 /* mask: user-visible attributes */ #else /* HANZI */ #define ATTRIBUTES 0x07 /* mask: user-visible attributes */ #endif /* HANZI */ --- 585,591 ---- */ #ifdef HANZI ! #define ATTRIBUTES 0xFF /* mask: user-visible attributes */ #else /* HANZI */ #define ATTRIBUTES 0x07 /* mask: user-visible attributes */ #endif /* HANZI */ *************** *** 543,554 **** * ended naturally with a CR at column * max_col. */ ! #define CHARDRAWN 0x10 /* a character has been drawn here on the screen. Used to distinguish blanks from empty parts of the screen when selecting */ #ifdef HANZI ! #define FIRSTBYTE 0x40 /* is the first byte in a Hanzi (internal) */ ! #define CHARHANZI 0x80 /* is part of a Hanzi (global & visible) */ #endif /* HANZI */ /* global flags */ #define WRAPAROUND 0x400 /* true if auto wraparound mode */ --- 602,618 ---- * ended naturally with a CR at column * max_col. */ ! #define CHARDRAWN 0x80 /* a character has been drawn here on the screen. Used to distinguish blanks from empty parts of the screen when selecting */ + + #define FG_COLOR 0x10 /* true if background set */ + #define BG_COLOR 0x20 /* true if foreground set */ + #define DIM 0x04 + #ifdef HANZI ! #define FIRSTBYTE 0x80 /* is the first byte in a Hanzi (internal) */ ! #define CHARHANZI 0x40 /* is part of a Hanzi (global & visible) */ #endif /* HANZI */ /* global flags */ #define WRAPAROUND 0x400 /* true if auto wraparound mode */ diff -c -r -N cxterm-5.0-orig/cxterm/screen.c cxterm-5.0/cxterm/screen.c *** cxterm-5.0-orig/cxterm/screen.c Sat Jun 4 03:36:14 1994 --- cxterm-5.0/cxterm/screen.c Sat Aug 23 19:56:45 1997 *************** *** 65,72 **** /* allocates memory for a 2-dimensional array of chars and returns a pointer thereto ! each line is formed from a pair of char arrays. The first (even) one is ! the actual character array and the second (odd) one is the attributes. */ register int nrow, ncol; Char **addr; --- 65,73 ---- /* allocates memory for a 2-dimensional array of chars and returns a pointer thereto ! each line is formed from four char arrays. The first one is the actual ! character array, the second one is the attributes, the third is the ! foreground color, and the fourth is the background color. */ register int nrow, ncol; Char **addr; *************** *** 75,81 **** register Char *tmp; register int i; ! if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 2), sizeof (char *))) == 0) SysError (ERROR_SCALLOC); if ((tmp = calloc ((unsigned) (nrow * ncol), sizeof(char))) == 0) --- 76,82 ---- register Char *tmp; register int i; ! if ((base = (ScrnBuf) calloc ((unsigned)(nrow *= 4), sizeof (char *))) == 0) SysError (ERROR_SCALLOC); if ((tmp = calloc ((unsigned) (nrow * ncol), sizeof(char))) == 0) *************** *** 108,114 **** if (sbuf == NULL || *sbuf == NULL) return 0; ! oldrow *= 2; oldbuf = *sbufaddr; /* --- 109,115 ---- if (sbuf == NULL || *sbuf == NULL) return 0; ! oldrow *= 4; oldbuf = *sbufaddr; /* *************** *** 123,129 **** * If the screen shrinks, remove lines off the top of the buffer * if resizeGravity resource says to do so. */ ! nrow *= 2; if (nrow < oldrow && term->misc.resizeGravity == SouthWestGravity) { /* Remove lines off the top of the buffer if necessary. */ move_up = oldrow-nrow --- 124,130 ---- * If the screen shrinks, remove lines off the top of the buffer * if resizeGravity resource says to do so. */ ! nrow *= 4; if (nrow < oldrow && term->misc.resizeGravity == SouthWestGravity) { /* Remove lines off the top of the buffer if necessary. */ move_up = oldrow-nrow *************** *** 169,175 **** return move_down ? move_down/2 : -move_up/2; /* convert to rows */ } ! ScreenWrite (screen, str, flags, length) /* Writes str into buf at row row and column col. Characters are set to match flags. --- 170,176 ---- return move_down ? move_down/2 : -move_up/2; /* convert to rows */ } ! ScreenWrite (screen, str, flags, cur_fg, cur_bg, length) /* Writes str into buf at row row and column col. Characters are set to match flags. *************** *** 177,185 **** --- 178,188 ---- TScreen *screen; char *str; register unsigned flags; + register unsigned cur_fg, cur_bg; register int length; /* length of string */ { register Char *attrs, *attrs0; + register Char *fgs, *bgs; register int avail = screen->max_col - screen->cur_col + 1; register Char *col; register int wrappedbit; *************** *** 189,196 **** if (length <= 0) return; ! col = screen->buf[avail = 2 * screen->cur_row] + screen->cur_col; attrs = attrs0 = screen->buf[avail + 1] + screen->cur_col; wrappedbit = *attrs0&LINEWRAPPED; flags &= ATTRIBUTES; flags |= CHARDRAWN; --- 192,201 ---- if (length <= 0) return; ! col = screen->buf[avail = 4 * screen->cur_row] + screen->cur_col; attrs = attrs0 = screen->buf[avail + 1] + screen->cur_col; + fgs = screen->buf[avail + 2] + screen->cur_col; + bgs = screen->buf[avail + 3] + screen->cur_col; wrappedbit = *attrs0&LINEWRAPPED; flags &= ATTRIBUTES; flags |= CHARDRAWN; *************** *** 200,213 **** while(length-- > 1) { *attrs = flags; *attrs++ |= FIRSTBYTE; /* 1st byte of HZ */ length--; *attrs = flags; *attrs++ &= ~(FIRSTBYTE); /* 2nd byte of HZ */ } else #endif /* HANZI */ ! while(length-- > 0) *attrs++ = flags; if (wrappedbit) *attrs0 |= LINEWRAPPED; } --- 205,226 ---- while(length-- > 1) { *attrs = flags; *attrs++ |= FIRSTBYTE; /* 1st byte of HZ */ + *fgs++ = cur_fg; + *bgs++ = cur_bg; + length--; *attrs = flags; *attrs++ &= ~(FIRSTBYTE); /* 2nd byte of HZ */ + *fgs++ = cur_fg; + *bgs++ = cur_bg; } else #endif /* HANZI */ ! while(length-- > 0) { *attrs++ = flags; + *fgs++ = cur_fg; + *bgs++ = cur_bg; + } if (wrappedbit) *attrs0 |= LINEWRAPPED; } *************** *** 224,238 **** register int where, n, size; { register int i; ! char *save [2 * MAX_ROWS]; /* save n lines at bottom */ ! memmove( (char *) save, (char *) &sb [2 * (last -= n - 1)], ! 2 * sizeof (char *) * n); /* clear contents of old rows */ ! for (i = 2 * n - 1; i >= 0; i--) bzero ((char *) save [i], size); /* --- 237,251 ---- register int where, n, size; { register int i; ! char *save [4 * MAX_ROWS]; /* save n lines at bottom */ ! memmove( (char *) save, (char *) &sb [4 * (last -= n - 1)], ! 4 * sizeof (char *) * n); /* clear contents of old rows */ ! for (i = 4 * n - 1; i >= 0; i--) bzero ((char *) save [i], size); /* *************** *** 244,254 **** * * +--------|---------|----+ */ ! memmove( (char *) &sb [2 * (where + n)], (char *) &sb [2 * where], ! 2 * sizeof (char *) * (last - where)); /* reuse storage for new lines at where */ ! memmove( (char *) &sb[2 * where], (char *)save, 2 * sizeof(char *) * n); } --- 257,267 ---- * * +--------|---------|----+ */ ! memmove( (char *) &sb [4 * (where + n)], (char *) &sb [4 * where], ! 4 * sizeof (char *) * (last - where)); /* reuse storage for new lines at where */ ! memmove( (char *) &sb[4 * where], (char *)save, 4 * sizeof(char *) * n); } *************** *** 264,285 **** int where; { register int i; ! char *save [2 * MAX_ROWS]; /* save n lines at where */ ! memmove( (char *)save, (char *) &sb[2 * where], 2 * sizeof(char *) * n); /* clear contents of old rows */ ! for (i = 2 * n - 1 ; i >= 0 ; i--) bzero ((char *) save [i], size); /* move up lines */ ! memmove( (char *) &sb[2 * where], (char *) &sb[2 * (where + n)], ! 2 * sizeof (char *) * ((last -= n - 1) - where)); /* reuse storage for new bottom lines */ ! memmove( (char *) &sb[2 * last], (char *)save, ! 2 * sizeof(char *) * n); } --- 277,298 ---- int where; { register int i; ! char *save [4 * MAX_ROWS]; /* save n lines at where */ ! memmove( (char *)save, (char *) &sb[4 * where], 4 * sizeof(char *) * n); /* clear contents of old rows */ ! for (i = 4 * n - 1 ; i >= 0 ; i--) bzero ((char *) save [i], size); /* move up lines */ ! memmove( (char *) &sb[4 * where], (char *) &sb[4 * (where + n)], ! 4 * sizeof (char *) * ((last -= n - 1) - where)); /* reuse storage for new bottom lines */ ! memmove( (char *) &sb[4 * last], (char *)save, ! 4 * sizeof(char *) * n); } *************** *** 292,299 **** register int col, n; { register int i, j; ! register Char *ptr = sb [2 * row]; ! register Char *attrs = sb [2 * row + 1]; int wrappedbit = attrs[0]&LINEWRAPPED; attrs[0] &= ~LINEWRAPPED; /* make sure the bit isn't moved */ --- 305,314 ---- register int col, n; { register int i, j; ! /* register Char *ptr = sb [2 * row]; ! register Char *attrs = sb [2 * row + 1]; */ ! register Char *ptr = sb [4 * row]; ! register Char *attrs = sb [4 * row + 1]; int wrappedbit = attrs[0]&LINEWRAPPED; attrs[0] &= ~LINEWRAPPED; /* make sure the bit isn't moved */ *************** *** 320,327 **** register int row, size; register int n, col; { ! register Char *ptr = sb[2 * row]; ! register Char *attrs = sb[2 * row + 1]; register nbytes = (size - n - col); int wrappedbit = attrs[0]&LINEWRAPPED; --- 335,342 ---- register int row, size; register int n, col; { ! register Char *ptr = sb[4 * row]; ! register Char *attrs = sb[4 * row + 1]; register nbytes = (size - n - col); int wrappedbit = attrs[0]&LINEWRAPPED; *************** *** 364,376 **** for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { register Char *chars; register Char *attrs; register int col = leftcol; int maxcol = leftcol + ncols - 1; int lastind; int flags; int x, n; GC gc; ! Boolean hilite; if (row < screen->top_marg || row > screen->bot_marg) lastind = row; --- 379,395 ---- for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) { register Char *chars; register Char *attrs; + register Char *fgs, *bgs; register int col = leftcol; int maxcol = leftcol + ncols - 1; int lastind; int flags; + int fg, bg; int x, n; GC gc; ! Boolean hilite; ! Pixel fg_pix, bg_pix; ! extern XtermWidget term; if (row < screen->top_marg || row > screen->bot_marg) lastind = row; *************** *** 380,393 **** if (lastind < 0 || lastind > max) continue; ! chars = screen->buf [2 * (lastind + topline)]; ! attrs = screen->buf [2 * (lastind + topline) + 1]; #ifdef HANZI if (Is2ndByteHZ (attrs[col])) col--; /* draw the whole HANZI */ if (Is1stByteHZ (attrs[maxcol])) maxcol++; /* draw the whole HANZI */ #endif /* HANZI */ if (row < screen->startHRow || row > screen->endHRow || (row == screen->startHRow && maxcol < screen->startHCol) || --- 399,416 ---- if (lastind < 0 || lastind > max) continue; ! chars = screen->buf [4 * (lastind + topline)]; ! attrs = screen->buf [4 * (lastind + topline) + 1]; ! fgs = screen->buf [4 * (lastind + topline) + 2]; ! bgs = screen->buf [4 * (lastind + topline) + 3]; #ifdef HANZI + #if 0 if (Is2ndByteHZ (attrs[col])) col--; /* draw the whole HANZI */ if (Is1stByteHZ (attrs[maxcol])) maxcol++; /* draw the whole HANZI */ + #endif #endif /* HANZI */ if (row < screen->startHRow || row > screen->endHRow || (row == screen->startHRow && maxcol < screen->startHCol) || *************** *** 424,454 **** if (col > maxcol) continue; flags = attrs[col]; #ifdef HANZI ! if (flags & CHARHANZI) { if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) ! if (flags & BOLD) gc = screen->hz_reverseboldGC; ! else gc = screen->hz_reverseGC; ! else ! if (flags & BOLD) gc = screen->hz_normalboldGC; ! else gc = screen->hz_normalGC; ! } else #endif /* HANZI */ if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! else if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; x = CursorX(screen, col); lastind = col; for (; col <= maxcol; col++) { ! if (attrs[col] != flags) { #ifdef HANZI if (flags & CHARHANZI) { HZ_XDrawImString16(screen->display, TextWindow(screen), --- 447,497 ---- if (col > maxcol) continue; flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; + + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] + : screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg + N_FGCOLOR] + : term->core.background_pixel; #ifdef HANZI ! if (flags & CHARHANZI) if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { ! if (flags & BOLD) gc = screen->hz_reverseboldGC; ! else gc = screen->hz_reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { ! if (flags & BOLD) gc = screen->hz_normalboldGC; ! else gc = screen->hz_normalGC; ! XSetForeground(screen->display, gc, fg_pix); ! XSetBackground(screen->display, gc, bg_pix); ! } ! else #endif /* HANZI */ if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } x = CursorX(screen, col); lastind = col; for (; col <= maxcol; col++) { ! if (attrs[col] != flags || ! (flags & FG_COLOR && fgs[col] != fg) || ! (flags & BG_COLOR && bgs[col] != bg)) { ! #ifdef HANZI if (flags & CHARHANZI) { HZ_XDrawImString16(screen->display, TextWindow(screen), *************** *** 457,464 **** (n = col - lastind) /2 ); } else #endif /* HANZI */ ! XDrawImageString(screen->display, TextWindow(screen), ! gc, x, y, (char *) &chars[lastind], n = col - lastind); #ifdef HANZI if (flags & CHARHANZI) { if((flags & BOLD) && screen->hz_enbolden) --- 500,509 ---- (n = col - lastind) /2 ); } else #endif /* HANZI */ ! XDrawImageString(screen->display, TextWindow(screen), ! gc, x, y, (char *) &chars[lastind], ! n = col - lastind); ! #ifdef HANZI if (flags & CHARHANZI) { if((flags & BOLD) && screen->hz_enbolden) *************** *** 479,503 **** lastind = col; flags = attrs[col]; #ifdef HANZI if (flags & CHARHANZI) { if ((!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) if (flags & BOLD) gc = screen->hz_reverseboldGC; else gc = screen->hz_reverseGC; ! else ! if (flags & BOLD) gc = screen->hz_normalboldGC; ! else gc = screen->hz_normalGC; ! } else #endif /* HANZI */ if ((!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! else ! if (flags & BOLD) gc = screen->normalboldGC; ! else gc = screen->normalGC; } #ifdef HANZI --- 524,565 ---- lastind = col; flags = attrs[col]; + fg = fgs[col]; + bg = bgs[col]; + + fg_pix = (flags & FG_COLOR) ? screen->colors[fg] + : screen->foreground; + bg_pix = (flags & BG_COLOR) ? screen->colors[bg + N_FGCOLOR] + : term->core.background_pixel; #ifdef HANZI if (flags & CHARHANZI) { if ((!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->hz_reverseboldGC; else gc = screen->hz_reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { ! if (flags & BOLD) gc = screen->hz_normalboldGC; ! else gc = screen->hz_normalGC; ! XSetForeground(screen->display, gc, fg_pix); ! XSetBackground(screen->display, gc, bg_pix); ! } ! } else #endif /* HANZI */ if ((!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { ! if (flags & BOLD) gc = screen->normalboldGC; ! else gc = screen->normalGC; ! XSetForeground(screen->display, gc, fg_pix); ! XSetBackground(screen->display, gc, bg_pix); ! } } #ifdef HANZI *************** *** 513,535 **** #ifdef HANZI ! if (flags & CHARHANZI) { if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) if (flags & BOLD) gc = screen->hz_reverseboldGC; else gc = screen->hz_reverseGC; ! else if (flags & BOLD) gc = screen->hz_normalboldGC; else gc = screen->hz_normalGC; ! } else #endif /* HANZI */ if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! else if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; #ifdef HANZI if (flags & CHARHANZI) { HZ_XDrawImString16(screen->display, TextWindow(screen), gc, --- 575,607 ---- #ifdef HANZI ! if (flags & CHARHANZI) if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->hz_reverseboldGC; else gc = screen->hz_reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { if (flags & BOLD) gc = screen->hz_normalboldGC; else gc = screen->hz_normalGC; ! XSetForeground(screen->display, gc, fg_pix); ! XSetBackground(screen->display, gc, bg_pix); ! } ! else #endif /* HANZI */ if ( (!hilite && (flags & INVERSE) != 0) || ! (hilite && (flags & INVERSE) == 0) ) { if (flags & BOLD) gc = screen->reverseboldGC; else gc = screen->reverseGC; ! XSetForeground(screen->display, gc, bg_pix); ! XSetBackground(screen->display, gc, fg_pix); ! } else { if (flags & BOLD) gc = screen->normalboldGC; else gc = screen->normalGC; + XSetForeground(screen->display, gc, fg_pix); + XSetBackground(screen->display, gc, bg_pix); + } #ifdef HANZI if (flags & CHARHANZI) { HZ_XDrawImString16(screen->display, TextWindow(screen), gc, *************** *** 564,571 **** register TScreen *screen; register int first, last; { ! first *= 2; ! last = 2 * last + 1; while (first <= last) bzero (screen->buf [first++], (screen->max_col + 1)); } --- 636,643 ---- register TScreen *screen; register int first, last; { ! first *= 4; ! last = 4 * last + 3; while (first <= last) bzero (screen->buf [first++], (screen->max_col + 1)); } *************** *** 660,666 **** rows + savelines, cols, screen->max_row + 1 + savelines, screen->max_col + 1); ! screen->buf = &screen->allbuf[2 * savelines]; screen->max_row += delta_rows; screen->max_col = cols - 1; --- 732,738 ---- rows + savelines, cols, screen->max_row + 1 + savelines, screen->max_col + 1); ! screen->buf = &screen->allbuf[4 * savelines]; screen->max_row += delta_rows; screen->max_col = cols - 1; *************** *** 766,772 **** length = avail; if (length <= 0) return; ! attrs = screen->buf[2 * row + 1] + col; value &= mask; /* make sure we only change the bits allowed by mask*/ while(length-- > 0) { *attrs &= ~mask; /* clear the bits */ --- 838,844 ---- length = avail; if (length <= 0) return; ! attrs = screen->buf[4 * row + 1] + col; value &= mask; /* make sure we only change the bits allowed by mask*/ while(length-- > 0) { *attrs &= ~mask; /* clear the bits */ *************** *** 797,803 **** if (length <= 0) return 0; ret = length; ! attrs = screen->buf[2 * row + 1] + col; while(length-- > 0) { *str++ = *attrs++; } --- 869,875 ---- if (length <= 0) return 0; ret = length; ! attrs = screen->buf[4 * row + 1] + col; while(length-- > 0) { *str++ = *attrs++; } *************** *** 809,815 **** register int row, col, len; { register int i; ! register Char *ptr = sb [2 * row]; for (i = col; i < len; i++) { if (ptr[i]) --- 881,887 ---- register int row, col, len; { register int i; ! register Char *ptr = sb [4 * row]; for (i = col; i < len; i++) { if (ptr[i]) diff -c -r -N cxterm-5.0-orig/cxterm/scrollbar.c cxterm-5.0/cxterm/scrollbar.c *** cxterm-5.0-orig/cxterm/scrollbar.c Sat Jun 4 03:36:16 1994 --- cxterm-5.0/cxterm/scrollbar.c Sat Aug 23 19:56:45 1997 *************** *** 351,365 **** if (doalloc && screen->allbuf) { if((screen->allbuf = (ScrnBuf) realloc((char *) screen->buf, ! (unsigned) 2*(screen->max_row + 2 + screen->savelines) * sizeof(char *))) == NULL) Error (ERROR_SBRALLOC); ! screen->buf = &screen->allbuf[2 * screen->savelines]; memmove( (char *)screen->buf, (char *)screen->allbuf, ! 2 * (screen->max_row + 2) * sizeof (char *)); ! for(i = 2 * screen->savelines - 1 ; i >= 0 ; i--) if((screen->allbuf[i] = calloc((unsigned) screen->max_col + 1, sizeof(char))) == NULL) --- 351,365 ---- if (doalloc && screen->allbuf) { if((screen->allbuf = (ScrnBuf) realloc((char *) screen->buf, ! (unsigned) 4*(screen->max_row + 2 + screen->savelines) * sizeof(char *))) == NULL) Error (ERROR_SBRALLOC); ! screen->buf = &screen->allbuf[4 * screen->savelines]; memmove( (char *)screen->buf, (char *)screen->allbuf, ! 4 * (screen->max_row + 2) * sizeof (char *)); ! for(i = 4 * screen->savelines - 1 ; i >= 0 ; i--) if((screen->allbuf[i] = calloc((unsigned) screen->max_col + 1, sizeof(char))) == NULL) diff -c -r -N cxterm-5.0-orig/cxterm/util.c cxterm-5.0/cxterm/util.c *** cxterm-5.0-orig/cxterm/util.c Sat Aug 22 17:20:29 1992 --- cxterm-5.0/cxterm/util.c Sat Aug 23 19:56:45 1997 *************** *** 648,659 **** FontHeight(screen)); } } ! bzero(screen->buf [2 * screen->cur_row] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); ! bzero(screen->buf [2 * screen->cur_row + 1] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); /* with the right part cleared, we can't be wrapping */ ! screen->buf [2 * screen->cur_row + 1] [0] &= ~LINEWRAPPED; } /* --- 648,663 ---- FontHeight(screen)); } } ! bzero(screen->buf [4 * screen->cur_row] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); ! bzero(screen->buf [4 * screen->cur_row + 1] + screen->cur_col, (screen->max_col - screen->cur_col + 1)); + bzero(screen->buf [4 * screen->cur_row + 2] + screen->cur_col, + (screen->max_col - screen->cur_col + 1)); + bzero(screen->buf [4 * screen->cur_row + 3] + screen->cur_col, + (screen->max_col - screen->cur_col + 1)); /* with the right part cleared, we can't be wrapping */ ! screen->buf [4 * screen->cur_row + 1] [0] &= ~LINEWRAPPED; } /* *************** *** 681,691 **** } } ! for ( i=0, cp=screen->buf[2 * screen->cur_row]; i < screen->cur_col + 1; i++, cp++) *cp = ' '; ! for ( i=0, cp=screen->buf[2 * screen->cur_row + 1]; i < screen->cur_col + 1; i++, cp++) *cp = CHARDRAWN; --- 685,697 ---- } } ! /* for ( i=0, cp=screen->buf[2 * screen->cur_row]; */ ! for ( i=0, cp=screen->buf[4 * screen->cur_row]; i < screen->cur_col + 1; i++, cp++) *cp = ' '; ! /* for ( i=0, cp=screen->buf[2 * screen->cur_row + 1]; */ ! for ( i=0, cp=screen->buf[4 * screen->cur_row + 1]; i < screen->cur_col + 1; i++, cp++) *cp = CHARDRAWN; *************** *** 711,718 **** Width(screen), FontHeight(screen)); } } ! bzero (screen->buf [2 * screen->cur_row], (screen->max_col + 1)); ! bzero (screen->buf [2 * screen->cur_row + 1], (screen->max_col + 1)); } ClearScreen(screen) --- 717,726 ---- Width(screen), FontHeight(screen)); } } ! bzero (screen->buf [4 * screen->cur_row], (screen->max_col + 1)); ! bzero (screen->buf [4 * screen->cur_row + 1], (screen->max_col + 1)); ! bzero (screen->buf [4 * screen->cur_row + 2], (screen->max_col + 1)); ! bzero (screen->buf [4 * screen->cur_row + 3], (screen->max_col + 1)); } ClearScreen(screen) *************** *** 957,962 **** --- 965,1071 ---- return (0); } + /***====================================================================***/ + + void + GetColors(term,pColors) + XtermWidget term; + ScrnColors *pColors; + { + register TScreen *screen = &term->screen; + GC tmpGC; + Window tek = TWindow(screen); + unsigned long tmp; + + + pColors->which= 0; + SET_COLOR_VALUE(pColors,TEXT_FG, screen->foreground); + SET_COLOR_VALUE(pColors,TEXT_BG, term->core.background_pixel); + SET_COLOR_VALUE(pColors,TEXT_CURSOR, screen->cursorcolor); + SET_COLOR_VALUE(pColors,MOUSE_FG, screen->mousecolor); + SET_COLOR_VALUE(pColors,MOUSE_BG, screen->mousecolorback); + + + SET_COLOR_VALUE(pColors,TEK_FG, screen->Tforeground); + SET_COLOR_VALUE(pColors,TEK_BG, screen->Tbackground); + } + + + ChangeColors(term,pNew) + XtermWidget term; + ScrnColors *pNew; + { + register TScreen *screen = &term->screen; + GC tmpGC; + Window tek = TWindow(screen); + unsigned long tmp; + Bool newCursor= TRUE; + + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + term->core.background_pixel= COLOR_VALUE(pNew,TEXT_BG); + } + + if (COLOR_DEFINED(pNew,TEXT_CURSOR)) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_CURSOR); + } + else if ((screen->cursorcolor == screen->foreground)&& + (COLOR_DEFINED(pNew,TEXT_FG))) { + screen->cursorcolor= COLOR_VALUE(pNew,TEXT_FG); + } + else newCursor= FALSE; + + if (COLOR_DEFINED(pNew,TEXT_FG)) { + Pixel fg= COLOR_VALUE(pNew,TEXT_FG); + screen->foreground= fg; + XSetForeground(screen->display,screen->normalGC,fg); + XSetBackground(screen->display,screen->reverseGC,fg); + XSetForeground(screen->display,screen->normalboldGC,fg); + XSetBackground(screen->display,screen->reverseboldGC,fg); + } + + if (COLOR_DEFINED(pNew,TEXT_BG)) { + Pixel bg= COLOR_VALUE(pNew,TEXT_BG); + term->core.background_pixel= bg; + XSetBackground(screen->display,screen->normalGC,bg); + XSetForeground(screen->display,screen->reverseGC,bg); + XSetBackground(screen->display,screen->normalboldGC,bg); + XSetForeground(screen->display,screen->reverseboldGC,bg); + XSetWindowBackground(screen->display, TextWindow(screen), + term->core.background_pixel); + } + + if (COLOR_DEFINED(pNew,MOUSE_FG)||(COLOR_DEFINED(pNew,MOUSE_BG))) { + if (COLOR_DEFINED(pNew,MOUSE_FG)) + screen->mousecolor= COLOR_VALUE(pNew,MOUSE_FG); + if (COLOR_DEFINED(pNew,MOUSE_BG)) + screen->mousecolorback= COLOR_VALUE(pNew,MOUSE_BG); + + recolor_cursor (screen->pointer_cursor, + screen->mousecolor, screen->mousecolorback); + recolor_cursor (screen->arrow, + screen->mousecolor, screen->mousecolorback); + XDefineCursor(screen->display, TextWindow(screen), + screen->pointer_cursor); + if(tek) + XDefineCursor(screen->display, tek, screen->arrow); + } + + if ((tek)&&(COLOR_DEFINED(pNew,TEK_FG)||COLOR_DEFINED(pNew,TEK_BG))) { + ChangeTekColors(screen,pNew); + } + set_cursor_gcs(screen); + XClearWindow(screen->display, TextWindow(screen)); + ScrnRefresh (screen, 0, 0, screen->max_row + 1, + screen->max_col + 1, False); + if(screen->Tshow) { + XClearWindow(screen->display, tek); + TekExpose((XExposeEvent *) NULL); + } + } + + /***====================================================================***/ + ReverseVideo (termw) XtermWidget termw; { *************** *** 1022,1027 **** --- 1131,1137 ---- XClearWindow(screen->display, tek); TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL); } + ReverseOldColors(); update_reversevideo(); }