summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/gui-printtext.c6
-rw-r--r--src/fe-text/screen.h2
-rw-r--r--src/fe-text/textbuffer-view.c14
-rw-r--r--src/fe-text/textbuffer.c3
-rw-r--r--src/fe-text/textbuffer.h1
5 files changed, 21 insertions, 5 deletions
diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c
index 3a70ef23..364d68c3 100644
--- a/src/fe-text/gui-printtext.c
+++ b/src/fe-text/gui-printtext.c
@@ -112,7 +112,7 @@ static void get_colors(int flags, int *fg, int *bg)
static void line_add_colors(TEXT_BUFFER_REC *buffer, LINE_REC **line,
int fg, int bg, int flags)
{
- unsigned char data[12];
+ unsigned char data[20];
int color, pos;
/* color should never have last bit on or it would be treated as a
@@ -130,6 +130,10 @@ static void line_add_colors(TEXT_BUFFER_REC *buffer, LINE_REC **line,
data[pos++] = 0;
data[pos++] = LINE_CMD_UNDERLINE;
}
+ if ((flags & GUI_PRINT_FLAG_REVERSE) != (last_flags & GUI_PRINT_FLAG_REVERSE)) {
+ data[pos++] = 0;
+ data[pos++] = LINE_CMD_REVERSE;
+ }
if (fg & ATTR_COLOR8) {
data[pos++] = 0;
data[pos++] = LINE_CMD_COLOR8;
diff --git a/src/fe-text/screen.h b/src/fe-text/screen.h
index b00c7330..92dc94f4 100644
--- a/src/fe-text/screen.h
+++ b/src/fe-text/screen.h
@@ -7,6 +7,8 @@ typedef struct _SCREEN_WINDOW SCREEN_WINDOW;
#define ATTR_COLOR8 0x200
#define ATTR_REVERSE 0x400
+#define ATTR_NOCOLORS (ATTR_UNDERLINE|ATTR_REVERSE)
+
/* XXX I hope this could be integrated into BX.
* XXX Well, this should be done via libc,
* but FreeBSD libc support is quite LAME.
diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c
index c7959774..1ae85fbf 100644
--- a/src/fe-text/textbuffer-view.c
+++ b/src/fe-text/textbuffer-view.c
@@ -139,13 +139,16 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
if ((cmd & 0x80) == 0) {
/* set color */
- color = (color & ATTR_UNDERLINE) | cmd;
+ color = (color & ATTR_NOCOLORS) | cmd;
} else switch (cmd) {
case LINE_CMD_UNDERLINE:
color ^= ATTR_UNDERLINE;
break;
+ case LINE_CMD_REVERSE:
+ color ^= ATTR_REVERSE;
+ break;
case LINE_CMD_COLOR0:
- color = color & ATTR_UNDERLINE;
+ color = color & ATTR_NOCOLORS;
break;
case LINE_CMD_COLOR8:
color &= 0xfff0;
@@ -277,7 +280,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
if ((*text & 0x80) == 0) {
/* set color */
- color = (color & ATTR_UNDERLINE) | *text;
+ color = (color & ATTR_NOCOLORS) | *text;
} else if (*text == LINE_CMD_CONTINUE) {
/* jump to next block */
memcpy(&tmp, text+1, sizeof(unsigned char *));
@@ -287,8 +290,11 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
case LINE_CMD_UNDERLINE:
color ^= ATTR_UNDERLINE;
break;
+ case LINE_CMD_REVERSE:
+ color ^= ATTR_REVERSE;
+ break;
case LINE_CMD_COLOR0:
- color = color & ATTR_UNDERLINE;
+ color = color & ATTR_NOCOLORS;
break;
case LINE_CMD_COLOR8:
color &= 0xfff0;
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 8b0c9469..1016905c 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -387,6 +387,9 @@ void textbuffer_line2text(LINE_REC *line, int coloring, GString *str)
case LINE_CMD_UNDERLINE:
g_string_append_c(str, 31);
break;
+ case LINE_CMD_REVERSE:
+ g_string_append_c(str, 22);
+ break;
case LINE_CMD_COLOR0:
g_string_sprintfa(str, "\004%c%c",
'0', FORMAT_COLOR_NOCHANGE);
diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h
index ddbfd72c..cc01667b 100644
--- a/src/fe-text/textbuffer.h
+++ b/src/fe-text/textbuffer.h
@@ -9,6 +9,7 @@ enum {
LINE_CMD_COLOR0, /* change to black, would be same as \0\0 but it breaks things.. */
LINE_CMD_COLOR8, /* change to dark grey, normally 8 = bold black */
LINE_CMD_UNDERLINE, /* enable/disable underlining */
+ LINE_CMD_REVERSE, /* enable/disable reversed text */
LINE_CMD_INDENT, /* if line is split, indent it at this position */
LINE_CMD_BLINK, /* blinking background */
LINE_CMD_FORMAT, /* end of line, but next will come the format that was used to create the