diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-07-12 15:00:45 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-07-12 15:00:45 +0000 |
commit | 241f70f869c9d04ad13fdaa8b53ba57067426e8b (patch) | |
tree | 84c615ab66fb2b90eeabefcf7360fe9eb3db63ee /src/gui/curses/gui-curses-input.c | |
parent | 9d5ef17bd66a91b8023e428e316d039e31f5f858 (diff) | |
download | weechat-241f70f869c9d04ad13fdaa8b53ba57067426e8b.zip |
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)
Diffstat (limited to 'src/gui/curses/gui-curses-input.c')
-rw-r--r-- | src/gui/curses/gui-curses-input.c | 34 |
1 files changed, 27 insertions, 7 deletions
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; |