mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Reversed text (^V) works again.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1828 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
b716b29cb7
commit
85749b70bd
@ -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;
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user