[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs TODO qe.c qe.h shell.c tty.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs TODO qe.c qe.h shell.c tty.c |
Date: |
Mon, 24 Dec 2007 09:31:36 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 07/12/24 09:31:36
Modified files:
. : TODO qe.c qe.h shell.c tty.c
Log message:
use bold flag for high intensity tty colors
use default PuTTY colors
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO?cvsroot=qemacs&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.30&r2=1.31
Patches:
Index: TODO
===================================================================
RCS file: /cvsroot/qemacs/qemacs/TODO,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- TODO 12 Dec 2007 02:51:05 -0000 1.11
+++ TODO 24 Dec 2007 09:31:36 -0000 1.12
@@ -132,7 +132,7 @@
- fix 32 bit assumptions:
qe.c:3133: call_func(): sizeof(int) == sizeof(void*) == sizeof(char*)
-support for high intensity colors in terminal mode (selected as bold)
+DONE support for high intensity colors in terminal mode (selected as bold)
add colorized buffers using shell buffer method
make shell buffer a colorized UCS2 buffer
use colorized buffer for *trace* buffer to flag tty input, shell output,
Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- qe.c 21 Dec 2007 22:34:31 -0000 1.51
+++ qe.c 24 Dec 2007 09:31:36 -0000 1.52
@@ -1988,10 +1988,11 @@
static void apply_style(QEStyleDef *style, int style_index)
{
QEStyleDef *s;
+
#ifndef WIN32
if (style_index & QE_STYLE_TTY) {
- style->fg_color = tty_colors[TTY_GET_FG(style_index)];
- style->bg_color = tty_colors[TTY_GET_BG(style_index)];
+ style->fg_color = tty_fg_colors[TTY_GET_XFG(style_index)];
+ style->bg_color = tty_bg_colors[TTY_GET_BG(style_index)];
} else
#endif
{
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- qe.h 21 Dec 2007 22:34:32 -0000 1.46
+++ qe.h 24 Dec 2007 09:31:36 -0000 1.47
@@ -1023,11 +1023,16 @@
/* special bit to indicate tty styles (for shell mode) */
#define QE_STYLE_TTY 0x800
+#define TTY_BOLD (1 << 6)
+#define TTY_FG_COLOR(fg) ((fg) << 3)
+#define TTY_BG_COLOR(bg) (bg)
#define TTY_GET_COLOR(fg, bg) (((fg) << 3) | (bg))
+#define TTY_GET_XFG(color) (((color) >> 3) & 15)
#define TTY_GET_FG(color) (((color) >> 3) & 7)
#define TTY_GET_BG(color) ((color) & 7)
-extern unsigned int tty_colors[]; /* from tty.c */
+extern unsigned int const tty_bg_colors[]; /* from tty.c */
+extern unsigned int const tty_fg_colors[];
/* special selection style (cumulative with another style) */
#define QE_STYLE_SEL 0x400
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- shell.c 21 Dec 2007 12:30:56 -0000 1.32
+++ shell.c 24 Dec 2007 09:31:36 -0000 1.33
@@ -440,26 +440,35 @@
s->color = s->def_color;
break;
case 1: /* enter_bold_mode */
- /* CG: should use high intensity colors */
+ s->color |= TTY_BOLD;
+ break;
+ case 22: /* exit_bold_mode */
+ s->color &= ~TTY_BOLD;
break;
case 4: /* enter_underline_mode */
case 5: /* enter_blink_mode */
case 7: /* enter_reverse_mode, enter_standout_mode */
case 8: /* enter_secure_mode */
case 24: /* exit_underline_mode */
- case 27: /* exit_standout_mode */
+ case 25: /* exit_blink_mode */
+ case 27: /* exit_reverse_mode, exit_standout_mode */
+ case 28: /* exit_secure_mode */
+ case 38: /* set extended foreground color ? */
case 39: /* orig_pair(1) */
+ case 48: /* set extended background color ? */
case 49: /* orig_pair(2) */
break;
default:
/* 0:black 1:red 2:green 3:yellow 4:blue 5:magenta 6:cyan 7:white */
if (c >= 30 && c <= 37) {
/* set foreground color */
- s->color = TTY_GET_COLOR(c - 30, TTY_GET_BG(s->color));
+ s->color &= ~(TTY_BOLD | TTY_BG_COLOR(7));
+ s->color |= TTY_FG_COLOR(c - 30);
} else
if (c >= 40 && c <= 47) {
/* set background color */
- s->color = TTY_GET_COLOR(TTY_GET_FG(s->color), c - 40);
+ s->color &= ~(TTY_BOLD | TTY_FG_COLOR(7));
+ s->color |= TTY_BG_COLOR(c - 40);
}
break;
}
Index: tty.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/tty.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- tty.c 21 Dec 2007 12:30:56 -0000 1.30
+++ tty.c 24 Dec 2007 09:31:36 -0000 1.31
@@ -503,9 +503,7 @@
abs( ((c1 >> 16) & 0xff) - ((c2 >> 16) & 0xff)));
}
-#define NB_COLORS 8
-
-unsigned int tty_colors[NB_COLORS] = {
+unsigned int const tty_bg_colors[8] = {
QERGB(0x00, 0x00, 0x00),
QERGB(0xff, 0x00, 0x00),
QERGB(0x00, 0xff, 0x00),
@@ -516,14 +514,34 @@
QERGB(0xff, 0xff, 0xff),
};
-static int get_tty_color(QEColor color)
+unsigned int const tty_fg_colors[16] = {
+ QERGB(0x00, 0x00, 0x00),
+ QERGB(0xbb, 0x00, 0x00),
+ QERGB(0x00, 0xbb, 0x00),
+ QERGB(0xbb, 0xbb, 0x00),
+ QERGB(0x00, 0x00, 0xbb),
+ QERGB(0xbb, 0x00, 0xbb),
+ QERGB(0x00, 0xbb, 0xbb),
+ QERGB(0xbb, 0xbb, 0xbb),
+
+ QERGB(0x55, 0x55, 0x55),
+ QERGB(0xff, 0x55, 0x55),
+ QERGB(0x55, 0xff, 0x55),
+ QERGB(0xff, 0xff, 0x55),
+ QERGB(0x55, 0x55, 0xff),
+ QERGB(0xff, 0x55, 0xff),
+ QERGB(0x55, 0xff, 0xff),
+ QERGB(0xff, 0xff, 0xff),
+};
+
+static int get_tty_color(QEColor color, unsigned int const *colors, int count)
{
int i, cmin, dmin, d;
dmin = INT_MAX;
cmin = 0;
- for (i = 0; i < NB_COLORS; i++) {
- d = color_dist(color, tty_colors[i]);
+ for (i = 0; i < count; i++) {
+ d = color_dist(color, colors[i]);
if (d < dmin) {
cmin = i;
dmin = d;
@@ -554,7 +572,7 @@
ptr += wrap;
}
} else {
- bgcolor = get_tty_color(color);
+ bgcolor = get_tty_color(color, tty_bg_colors, countof(tty_bg_colors));
for (y = y1; y < y2; y++) {
ts->line_updated[y] = 1;
for (x = x1; x < x2; x++) {
@@ -639,7 +657,7 @@
return;
ts->line_updated[y] = 1;
- fgcolor = get_tty_color(color);
+ fgcolor = get_tty_color(color, tty_fg_colors, countof(tty_fg_colors));
ptr = ts->screen + y * s->width;
if (x < s->clip_x1) {
@@ -747,11 +765,9 @@
|| (bgcolor != (int)TTYCHAR_GETBG(cc))) {
fgcolor = TTYCHAR_GETFG(cc);
bgcolor = TTYCHAR_GETBG(cc);
- /* CG: should deal with bold for high intensity
- * foreground colors
- */
- FPRINTF(s->STDOUT, "\033[%d;%dm",
- 30 + fgcolor, 40 + bgcolor);
+ FPRINTF(s->STDOUT, "\033[%d;%d;%dm",
+ (fgcolor > 7) ? 1 : 22,
+ 30 + (fgcolor & 7), 40 + bgcolor);
}
/* do not display escape codes or invalid codes */
if (ch < 32 || ch == 127) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs TODO qe.c qe.h shell.c tty.c,
Charlie Gordon <=