From 241f70f869c9d04ad13fdaa8b53ba57067426e8b Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 12 Jul 2007 15:00:45 +0000 Subject: Fixed bugs with IRC color in messages, now color codes are inserted in command line with ^Cc,^Cb,.. instead of %C,%B,.. (bug #20222, task #7060) --- src/gui/curses/gui-curses-input.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/gui/curses/gui-curses-input.c') diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c index 922b1e748..8b25c7a51 100644 --- a/src/gui/curses/gui-curses-input.c +++ b/src/gui/curses/gui-curses-input.c @@ -273,7 +273,7 @@ gui_input_draw_prompt (t_gui_window *window, char *nick) int gui_input_draw_text (t_gui_window *window, int input_width) { - char *ptr_start, *ptr_next, saved_char, *output; + char *ptr_start, *ptr_next, saved_char, *output, *ptr_string; int pos_mask, size, last_color, color, count_cursor, offset_cursor; ptr_start = utf8_add_offset (window->buffer->input_buffer, @@ -316,14 +316,34 @@ gui_input_draw_text (t_gui_window *window, int input_width) last_color = color; } output = weechat_iconv_from_internal (NULL, ptr_start); - wprintw (GUI_CURSES(window)->win_input, "%s", (output) ? output : ptr_start); - if (output) - free (output); - if (count_cursor > 0) + + ptr_string = (output) ? output : ptr_start; + + if ((((unsigned char)ptr_string[0]) < 32) && (!ptr_string[1])) + { + wattron (GUI_CURSES(window)->win_input, A_REVERSE); + wprintw (GUI_CURSES(window)->win_input, "%c", + 'A' + ((unsigned char)ptr_string[0]) - 1); + wattroff (GUI_CURSES(window)->win_input, A_REVERSE); + if (count_cursor > 0) + { + offset_cursor++; + count_cursor--; + } + } + else { - offset_cursor += utf8_width_screen (ptr_start); - count_cursor--; + wprintw (GUI_CURSES(window)->win_input, "%s", ptr_string); + if (count_cursor > 0) + { + offset_cursor += utf8_width_screen (ptr_start); + count_cursor--; + } } + + if (output) + free (output); + ptr_next[0] = saved_char; ptr_start = ptr_next; pos_mask += size; -- cgit v1.2.3