diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-08-17 11:51:50 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-08-17 11:51:50 +0200 |
commit | 600ee3ddf37c070cab373346661d55718d2130b9 (patch) | |
tree | ff8c99c98ed7c4371eb4a6641a056d9b28ac6c71 /src/gui/gui-window.c | |
parent | c6249603368de12acfac60868d4bddd18d29abba (diff) | |
download | weechat-600ee3ddf37c070cab373346661d55718d2130b9.zip |
core: add search of regular expression in buffer, don't reset search type on a new search, select where to search (messages/prefixes)
Key changed in search context:
- ctrl+"r": switch search type: string/regex
New keys in search context:
- alt+"c": case (in)sensitive search
- tab: search in messages/prefixes/both
Diffstat (limited to 'src/gui/gui-window.c')
-rw-r--r-- | src/gui/gui-window.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 1b4caf8cf..7e1fc4fb4 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -1502,9 +1502,7 @@ gui_window_search_text (struct t_gui_window *window) gui_line_get_last_displayed (window->buffer); while (ptr_line) { - if (gui_line_search_text (ptr_line, - window->buffer->input_buffer, - window->buffer->text_search_exact)) + if (gui_line_search_text (window->buffer, ptr_line)) { window->scroll->start_line = ptr_line; window->scroll->start_line_pos = 0; @@ -1527,9 +1525,7 @@ gui_window_search_text (struct t_gui_window *window) gui_line_get_first_displayed (window->buffer); while (ptr_line) { - if (gui_line_search_text (ptr_line, - window->buffer->input_buffer, - window->buffer->text_search_exact)) + if (gui_line_search_text (window->buffer, ptr_line)) { window->scroll->start_line = ptr_line; window->scroll->start_line_pos = 0; @@ -1553,8 +1549,10 @@ void gui_window_search_start (struct t_gui_window *window) { window->buffer->text_search = GUI_TEXT_SEARCH_BACKWARD; - window->buffer->text_search_exact = 0; + if (window->buffer->text_search_where == 0) + window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_MESSAGE; window->buffer->text_search_found = 0; + gui_input_search_compile_regex (window->buffer); if (window->buffer->text_search_input) { free (window->buffer->text_search_input); @@ -1577,6 +1575,7 @@ gui_window_search_restart (struct t_gui_window *window) window->scroll->start_line_pos = 0; window->buffer->text_search = GUI_TEXT_SEARCH_BACKWARD; window->buffer->text_search_found = 0; + gui_input_search_compile_regex (window->buffer); if (gui_window_search_text (window)) window->buffer->text_search_found = 1; else @@ -1599,6 +1598,12 @@ gui_window_search_stop (struct t_gui_window *window) { window->buffer->text_search = GUI_TEXT_SEARCH_DISABLED; window->buffer->text_search = 0; + if (window->buffer->text_search_regex_compiled) + { + regfree (window->buffer->text_search_regex_compiled); + free (window->buffer->text_search_regex_compiled); + window->buffer->text_search_regex_compiled = NULL; + } gui_input_delete_line (window->buffer); if (window->buffer->text_search_input) { |