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.
This commit is contained in:
Tom Feist 2011-05-03 15:40:34 +01:00 committed by Ailin Nemui
commit 2d4edc5187
15 changed files with 437 additions and 105 deletions

View file

@ -206,6 +206,7 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str,
{
GString *out;
char *ret;
int adv;
out = g_string_new(NULL);
for (; *str != '\0'; str++) {
@ -255,9 +256,12 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str,
break;
}
default:
if (!format_expand_styles(out, &str, &dest->flags)) {
adv = format_expand_styles(out, &str, &dest->flags);
if (!adv) {
g_string_append_c(out, '%');
g_string_append_c(out, *str);
} else {
str += adv -1;
}
break;
}
@ -272,7 +276,7 @@ static char *printtext_expand_formats(const char *str, int *flags)
{
GString *out;
char *ret;
int adv;
out = g_string_new(NULL);
for (; *str != '\0'; str++) {
if (*str != '%') {
@ -283,9 +287,12 @@ static char *printtext_expand_formats(const char *str, int *flags)
if (*++str == '\0')
break;
if (!format_expand_styles(out, &str, flags)) {
adv = format_expand_styles(out, &str, flags);
if (!adv) {
g_string_append_c(out, '%');
g_string_append_c(out, *str);
} else {
str += adv -1;
}
}