1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

core: add options to customize default text search in buffers

New options:
- weechat.look.buffer_search_case_sensitive (boolean, off by default)
- weechat.look.buffer_search_force_default (boolean, off by default)
- weechat.look.buffer_search_regex (boolean, off by default)
- weechat.look.buffer_search_where (prefix, message (by default), prefix_message)
This commit is contained in:
Sebastien Helleu
2013-10-06 11:59:42 +02:00
parent 7364853c9d
commit 07115ef3d0
21 changed files with 377 additions and 15 deletions
+27
View File
@@ -85,6 +85,10 @@ struct t_config_option *config_look_bar_more_right;
struct t_config_option *config_look_bar_more_up;
struct t_config_option *config_look_bar_more_down;
struct t_config_option *config_look_buffer_notify_default;
struct t_config_option *config_look_buffer_search_case_sensitive;
struct t_config_option *config_look_buffer_search_force_default;
struct t_config_option *config_look_buffer_search_regex;
struct t_config_option *config_look_buffer_search_where;
struct t_config_option *config_look_buffer_time_format;
struct t_config_option *config_look_color_basic_force_bold;
struct t_config_option *config_look_color_inactive_window;
@@ -1975,6 +1979,29 @@ config_weechat_init_options ()
"none=never display in hotlist"),
"none|highlight|message|all", 0, 0, "all", NULL, 0,
NULL, NULL, &config_change_buffer_notify_default, NULL, NULL, NULL);
config_look_buffer_search_case_sensitive = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_search_case_sensitive", "boolean",
N_("default text search in buffer: case sensitive or not"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_buffer_search_force_default = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_search_force_default", "boolean",
N_("force default values for text search in buffer (instead of using "
"values from last search in buffer)"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_buffer_search_regex = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_search_regex", "boolean",
N_("default text search in buffer: if enabled, search regular expression, "
"otherwise search simple string"),
NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_buffer_search_where = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_search_where", "integer",
N_("default text search in buffer: in message, prefix, prefix and "
"message"),
"prefix|message|prefix_message", 0, 0, "message", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_buffer_time_format = config_file_new_option (
weechat_config_file, ptr_section,
"buffer_time_format", "string",
+11
View File
@@ -37,6 +37,13 @@ enum t_config_look_align_end_of_lines
CONFIG_LOOK_ALIGN_END_OF_LINES_MESSAGE,
};
enum t_config_look_buffer_search_where
{
CONFIG_LOOK_BUFFER_SEARCH_PREFIX = 0,
CONFIG_LOOK_BUFFER_SEARCH_MESSAGE,
CONFIG_LOOK_BUFFER_SEARCH_PREFIX_MESSAGE,
};
enum t_config_look_prefix_align
{
CONFIG_LOOK_PREFIX_ALIGN_NONE = 0,
@@ -102,6 +109,10 @@ extern struct t_config_option *config_look_bar_more_right;
extern struct t_config_option *config_look_bar_more_up;
extern struct t_config_option *config_look_bar_more_down;
extern struct t_config_option *config_look_buffer_notify_default;
extern struct t_config_option *config_look_buffer_search_case_sensitive;
extern struct t_config_option *config_look_buffer_search_force_default;
extern struct t_config_option *config_look_buffer_search_regex;
extern struct t_config_option *config_look_buffer_search_where;
extern struct t_config_option *config_look_buffer_time_format;
extern struct t_config_option *config_look_color_basic_force_bold;
extern struct t_config_option *config_look_color_inactive_window;
+22 -2
View File
@@ -1549,8 +1549,28 @@ void
gui_window_search_start (struct t_gui_window *window)
{
window->buffer->text_search = GUI_TEXT_SEARCH_BACKWARD;
if (window->buffer->text_search_where == 0)
window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_MESSAGE;
if ((window->buffer->text_search_where == 0)
|| CONFIG_BOOLEAN(config_look_buffer_search_force_default))
{
/* set default search values */
window->buffer->text_search_exact = CONFIG_BOOLEAN(config_look_buffer_search_case_sensitive);
window->buffer->text_search_regex = CONFIG_BOOLEAN(config_look_buffer_search_regex);
switch (CONFIG_INTEGER(config_look_buffer_search_where))
{
case CONFIG_LOOK_BUFFER_SEARCH_PREFIX:
window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_PREFIX;
break;
case CONFIG_LOOK_BUFFER_SEARCH_MESSAGE:
window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_MESSAGE;
break;
case CONFIG_LOOK_BUFFER_SEARCH_PREFIX_MESSAGE:
window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_PREFIX | GUI_TEXT_SEARCH_IN_MESSAGE;
break;
default:
window->buffer->text_search_where = GUI_TEXT_SEARCH_IN_MESSAGE;
break;
}
}
window->buffer->text_search_found = 0;
gui_input_search_compile_regex (window->buffer);
if (window->buffer->text_search_input)