From 2d4edc51877719c49d712271967313310f4796fb Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Tue, 3 May 2011 15:40:34 +0100 Subject: Initial implementation of 256 colour support for Irssi This patch implements some 256 colour support for Irssi up from the previous 16 colours. Initial parsing of the %x/%X format codes is implemented and the parser accounts in advances the char* for that. The colour attributes are widened from 4 to 8 bit. The colour protocol is changed to a new format. Some pointers to remaining work are written in the comment in textbuffer.h. Note that Irssi already does support requesting 256 colours from the terminal in the original source code, so this part did not have to be touched. --- src/fe-text/textbuffer.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/fe-text/textbuffer.h') diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h index e5d78487..a94a06af 100644 --- a/src/fe-text/textbuffer.h +++ b/src/fe-text/textbuffer.h @@ -8,15 +8,20 @@ #define LINE_COLOR_BG 0x20 #define LINE_COLOR_DEFAULT 0x10 +/* command values (see _LINE_REC protocol) */ enum { LINE_CMD_EOL=0x80, /* line ends here */ LINE_CMD_CONTINUE, /* line continues in next block */ + /* TODO: no longer needed */ LINE_CMD_COLOR0, /* change to black, would be same as \0\0 but it breaks things.. */ 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, /* enable/disable blink */ LINE_CMD_BOLD, /* enable/disable bold */ + LINE_CMD_SELECT_FG, + LINE_CMD_SELECT_BG + }; typedef struct { @@ -24,6 +29,7 @@ typedef struct { time_t time; } LINE_INFO_REC; +/* TODO: fixme. */ typedef struct _LINE_REC { /* Text in the line. \0 means that the next char will be a color or command. @@ -38,6 +44,28 @@ typedef struct _LINE_REC { DO NOT ADD BLACK WITH \0\0 - this will break things. Use LINE_CMD_COLOR0 instead. */ + + + /* NEW COLOUR PROTOCOL: + + 0x00 - indicates command or colour. + 0x01 - command follows (1 byte) + -- following may be omitted if LINE_CMD_USE_DEFAULT_[FB}G is set. + 0x02 - BG colour follows (1 byte) + 0x04 - FG colour follows (1 byte) + + + Things that will need to be fixed: + + * textbuffer-view.c:update_cmd_color() + * textbuffer-view.c:view_line_draw() + * textbuffer-view.c:view_update_line_cache() + + * textbuffer.c:textbuffer_line2text() + * textbuffer.c:mark_temp_eol macro + + * gui-printtext.c ? + */ struct _LINE_REC *prev, *next; unsigned char *text; -- cgit v1.2.3