From 96a292d40e7f6fe505c4a0f686d35132ffac8208 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Thu, 9 Jan 2014 15:20:29 +0100 Subject: Finish 256 colour support for Irssi 256 colour patch is cleaned up and the remaining cases are made work, this includes especially Theme support, which was not implemented before. Changes not related to colours were reverted again, making a review of the two patches against master easier to follow. As a byproduct of the Hex-colour code parser, the 24bit colours are also implemented. Actually using them in the terminal is guarded by a compile time switch (as well as a run time switch), as it breaks the existing colour protocol and requires additional storage. To make a seamless usage, down-conversion is provided for 8 and 16 colours. Diverging from Tom's approach, the colour protocol is reverted back to the original one. Unfortunately, the changes required in the Theme engine will break the API. For more details, please refer to the patch documentation at either http://irssi-docs.wikispaces.com/Notes-256-Colour or https://github.com/shabble/irssi-docs/wiki/Notes-256-Colour --- src/fe-text/textbuffer.h | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'src/fe-text/textbuffer.h') diff --git a/src/fe-text/textbuffer.h b/src/fe-text/textbuffer.h index a94a06af..6123ba7a 100644 --- a/src/fe-text/textbuffer.h +++ b/src/fe-text/textbuffer.h @@ -8,20 +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 - + LINE_COLOR_EXT, /* extended color */ + LINE_COLOR_EXT_BG, /* extended bg */ +#ifdef TERM_TRUECOLOR + LINE_COLOR_24, /* 24bit color */ +#endif }; typedef struct { @@ -29,7 +29,6 @@ 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. @@ -44,28 +43,6 @@ 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