diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-04-04 14:04:42 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-04-04 14:04:42 +0000 |
commit | 0e785fe106a578c5c7cf8ac09f6ac4727e4e00d5 (patch) | |
tree | 0158d707118b8c885c3122741ad02d04b1070eab /src/gui | |
parent | 3e6e347d13108544a19d97ee02d3494d89542acf (diff) | |
download | weechat-0e785fe106a578c5c7cf8ac09f6ac4727e4e00d5.zip |
Added color for input text not found in buffer history
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 1 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-input.c | 30 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 8 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 | ||||
-rw-r--r-- | src/gui/gui-color.h | 1 |
5 files changed, 31 insertions, 10 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index a8fc76fc0..8bf8b2b12 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -535,6 +535,7 @@ gui_color_init_weechat () gui_color[COLOR_WIN_INPUT_CHANNEL] = gui_color_build (COLOR_WIN_INPUT_CHANNEL, cfg_col_input_channel, cfg_col_input_bg); gui_color[COLOR_WIN_INPUT_NICK] = gui_color_build (COLOR_WIN_INPUT_NICK, cfg_col_input_nick, cfg_col_input_bg); gui_color[COLOR_WIN_INPUT_DELIMITERS] = gui_color_build (COLOR_WIN_INPUT_DELIMITERS, cfg_col_input_delimiters, cfg_col_input_bg); + gui_color[COLOR_WIN_INPUT_TEXT_NOT_FOUND] = gui_color_build (COLOR_WIN_INPUT_TEXT_NOT_FOUND, cfg_col_input_text_not_found, cfg_col_input_bg); gui_color[COLOR_WIN_NICK] = gui_color_build (COLOR_WIN_NICK, cfg_col_nick, cfg_col_nick_bg); gui_color[COLOR_WIN_NICK_AWAY] = gui_color_build (COLOR_WIN_NICK_AWAY, cfg_col_nick_away, cfg_col_nick_bg); gui_color[COLOR_WIN_NICK_CHANOWNER] = gui_color_build (COLOR_WIN_NICK_CHANOWNER, cfg_col_nick_chanowner, cfg_col_nick_bg); diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c index 2c10a0d14..c7fd79734 100644 --- a/src/gui/curses/gui-curses-input.c +++ b/src/gui/curses/gui-curses-input.c @@ -284,6 +284,15 @@ gui_input_draw_text (t_gui_window *window, int input_width) count_cursor = window->buffer->input_buffer_pos - window->buffer->input_buffer_1st_display; offset_cursor = 0; + if (window->buffer->text_search != TEXT_SEARCH_DISABLED) + { + if (window->buffer->text_search_found) + gui_window_set_weechat_color (GUI_CURSES(window)->win_input, + COLOR_WIN_INPUT); + else + gui_window_set_weechat_color (GUI_CURSES(window)->win_input, + COLOR_WIN_INPUT_TEXT_NOT_FOUND); + } while ((input_width > 0) && ptr_start && ptr_start[0]) { ptr_next = utf8_next_char (ptr_start); @@ -292,18 +301,21 @@ gui_input_draw_text (t_gui_window *window, int input_width) saved_char = ptr_next[0]; ptr_next[0] = '\0'; size = ptr_next - ptr_start; - if (window->buffer->input_buffer_color_mask[pos_mask] != ' ') - color = window->buffer->input_buffer_color_mask[pos_mask] - '0'; - else - color = -1; - if (color != last_color) + if (window->buffer->text_search == TEXT_SEARCH_DISABLED) { - if (color == -1) - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT); + if (window->buffer->input_buffer_color_mask[pos_mask] != ' ') + color = window->buffer->input_buffer_color_mask[pos_mask] - '0'; else - gui_input_set_color (window, color); + color = -1; + if (color != last_color) + { + if (color == -1) + gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT); + else + gui_input_set_color (window, color); + } + last_color = color; } - last_color = color; output = weechat_iconv_from_internal (NULL, ptr_start); wprintw (GUI_CURSES(window)->win_input, "%s", (output) ? output : ptr_start); if (output) diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 4b78ab2bb..759ed4e29 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -210,6 +210,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type, /* text search */ new_buffer->text_search = TEXT_SEARCH_DISABLED; new_buffer->text_search_exact = 0; + new_buffer->text_search_found = 0; new_buffer->text_search_input = NULL; /* add buffer to buffers queue */ @@ -1082,6 +1083,7 @@ gui_buffer_search_start (t_gui_window *window) { window->buffer->text_search = TEXT_SEARCH_BACKWARD; window->buffer->text_search_exact = 0; + window->buffer->text_search_found = 0; if (window->buffer->text_search_input) { free (window->buffer->text_search_input); @@ -1106,11 +1108,15 @@ gui_buffer_search_restart (t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; window->buffer->text_search = TEXT_SEARCH_BACKWARD; - if (!gui_buffer_search_text (window)) + window->buffer->text_search_found = 0; + if (gui_buffer_search_text (window)) + window->buffer->text_search_found = 1; + else { gui_chat_draw (window->buffer, 1); gui_status_draw (window->buffer, 1); } + gui_input_draw (window->buffer, 0); } /* diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index cd0a1cb26..f72468120 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -129,6 +129,7 @@ struct t_gui_buffer /* text search */ int text_search; /* text search type */ int text_search_exact; /* exact search (case sensitive) ? */ + int text_search_found; /* 1 if text found, otherwise 0 */ char *text_search_input; /* input saved before text search */ /* link to previous/next buffer */ diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index ed25dbeb0..e7629a9fa 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -90,6 +90,7 @@ enum t_weechat_color COLOR_DCC_ABORTED, COLOR_WIN_INPUT_SERVER, COLOR_WIN_TITLE_MORE, + COLOR_WIN_INPUT_TEXT_NOT_FOUND, GUI_NUM_COLORS }; |