From 3fd3a03402c41f9e31bff05120e9c668cf3c2dc2 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 9 Jun 2000 16:58:52 +0000 Subject: [PATCH] Beeps should work(?). ANSI colors had some bugs, bolds weren't working and blinking crashed irssi. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@305 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/printtext.c | 7 ++++--- src/fe-text/gui-printtext.c | 10 +++++----- src/fe-text/gui-textwidget.c | 2 -- src/fe-text/gui-windows.h | 1 - 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 7ddc33b4..7e525202 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -144,14 +144,15 @@ static char *convert_ansi(char *str, int *fgcolor, int *bgcolor, int *flags) /* reset colors back to default */ fg = current_theme->default_color; bg = -1; + fl &= ~(PRINTFLAG_BEEP|PRINTFLAG_INDENT); break; case 1: /* hilight */ - fg |= 8; + fl |= PRINTFLAG_BOLD; break; case 5: /* blink */ - bg = bg == -1 ? 8 : bg | 8; + fl |= PRINTFLAG_BLINK; break; case 7: /* reverse */ @@ -171,7 +172,7 @@ static char *convert_ansi(char *str, int *fgcolor, int *bgcolor, int *flags) if (*str == 'm') { if (!hide_text_style) { *fgcolor = fg; - *bgcolor = bg == -1 ? -1 : bg; + *bgcolor = bg; *flags = fl; } str++; diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index c53e4674..2f1d5be8 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -210,7 +210,9 @@ static void line_add_colors(GUI_WINDOW_REC *gui, int fg, int bg, int flags) unsigned char buffer[12]; int color, pos; - color = (fg & 0x0f) | (bg << 4); + /* color should never have last bit on or it would be treated as a + command! */ + color = (fg & 0x0f) | ((bg & 0x0f) << 4); pos = 0; if (((fg & ATTR_COLOR8) == 0 && (fg|(bg << 4)) != gui->last_color) || @@ -227,14 +229,12 @@ static void line_add_colors(GUI_WINDOW_REC *gui, int fg, int bg, int flags) buffer[pos++] = 0; buffer[pos++] = LINE_CMD_COLOR8; } - if (flags & PRINTFLAG_BEEP) { - buffer[pos++] = 0; - buffer[pos++] = LINE_CMD_BEEP; - } if (flags & PRINTFLAG_INDENT) { buffer[pos++] = 0; buffer[pos++] = LINE_CMD_INDENT; } + if (flags & PRINTFLAG_BEEP) + beep(); linebuf_add(gui, (char *) buffer, pos); diff --git a/src/fe-text/gui-textwidget.c b/src/fe-text/gui-textwidget.c index 49841479..27767fd7 100644 --- a/src/fe-text/gui-textwidget.c +++ b/src/fe-text/gui-textwidget.c @@ -76,8 +76,6 @@ static gchar *gui_window_line2text(LINE_REC *line) color &= 0xfff0; color |= 8|ATTR_COLOR8; break; - case LINE_CMD_BEEP: - break; case LINE_CMD_INDENT: break; } diff --git a/src/fe-text/gui-windows.h b/src/fe-text/gui-windows.h index 622b5f4a..2d1a9a96 100644 --- a/src/fe-text/gui-windows.h +++ b/src/fe-text/gui-windows.h @@ -18,7 +18,6 @@ enum { LINE_CMD_OVERFLOW, /* buffer overflow! */ LINE_CMD_COLOR8, /* change to dark grey, normally 8 = bold black */ LINE_CMD_UNDERLINE, /* enable/disable underlining */ - LINE_CMD_BEEP, /* beep */ LINE_CMD_INDENT /* if line is split, indent it at this position */ };