mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 12:56:37 +02:00
core: add options weechat.look.hotlist_update_on_buffer_switch and weechat.look.read_marker_update_on_buffer_switch
Both default to "on" (no change to previous behavior). If hotlist_update_on_buffer_switch is "off", then when switching away from a buffer, the hotlist is not cleared. If read_marker_update_on_buffer_switch is "off", then when switching away from a buffer, the read marker is not set to the end of the buffer. This allows users to choose to have fully manual control over when hotlist counts and buffer read markers are reset. Fixes #992.
This commit is contained in:
committed by
Sébastien Helleu
parent
84d4be1bee
commit
df12f8de34
@@ -135,6 +135,7 @@ struct t_config_option *config_look_hotlist_short_names;
|
||||
struct t_config_option *config_look_hotlist_sort;
|
||||
struct t_config_option *config_look_hotlist_suffix;
|
||||
struct t_config_option *config_look_hotlist_unique_numbers;
|
||||
struct t_config_option *config_look_hotlist_update_on_buffer_switch;
|
||||
struct t_config_option *config_look_input_cursor_scroll;
|
||||
struct t_config_option *config_look_input_share;
|
||||
struct t_config_option *config_look_input_share_overwrite;
|
||||
@@ -180,6 +181,7 @@ struct t_config_option *config_look_quote_time_format;
|
||||
struct t_config_option *config_look_read_marker;
|
||||
struct t_config_option *config_look_read_marker_always_show;
|
||||
struct t_config_option *config_look_read_marker_string;
|
||||
struct t_config_option *config_look_read_marker_update_on_buffer_switch;
|
||||
struct t_config_option *config_look_save_config_on_exit;
|
||||
struct t_config_option *config_look_save_config_with_fsync;
|
||||
struct t_config_option *config_look_save_layout_on_exit;
|
||||
@@ -3099,6 +3101,12 @@ config_weechat_init_options ()
|
||||
NULL, NULL, NULL,
|
||||
&config_change_buffer_content, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
config_look_hotlist_update_on_buffer_switch = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_update_on_buffer_switch", "boolean",
|
||||
N_("update the hotlist when switching buffers"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_input_cursor_scroll = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"input_cursor_scroll", "integer",
|
||||
@@ -3524,6 +3532,12 @@ config_weechat_init_options ()
|
||||
NULL, NULL, NULL,
|
||||
&config_change_read_marker, NULL, NULL,
|
||||
NULL, NULL, NULL);
|
||||
config_look_read_marker_update_on_buffer_switch = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"read_marker_update_on_buffer_switch", "boolean",
|
||||
N_("update the read marker when switching buffers"),
|
||||
NULL, 0, 0, "on", NULL, 0,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_save_config_on_exit = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"save_config_on_exit", "boolean",
|
||||
|
||||
@@ -188,6 +188,7 @@ extern struct t_config_option *config_look_hotlist_short_names;
|
||||
extern struct t_config_option *config_look_hotlist_sort;
|
||||
extern struct t_config_option *config_look_hotlist_suffix;
|
||||
extern struct t_config_option *config_look_hotlist_unique_numbers;
|
||||
extern struct t_config_option *config_look_hotlist_update_on_buffer_switch;
|
||||
extern struct t_config_option *config_look_input_cursor_scroll;
|
||||
extern struct t_config_option *config_look_input_share;
|
||||
extern struct t_config_option *config_look_input_share_overwrite;
|
||||
@@ -233,6 +234,7 @@ extern struct t_config_option *config_look_quote_time_format;
|
||||
extern struct t_config_option *config_look_read_marker;
|
||||
extern struct t_config_option *config_look_read_marker_always_show;
|
||||
extern struct t_config_option *config_look_read_marker_string;
|
||||
extern struct t_config_option *config_look_read_marker_update_on_buffer_switch;
|
||||
extern struct t_config_option *config_look_save_config_on_exit;
|
||||
extern struct t_config_option *config_look_save_config_with_fsync;
|
||||
extern struct t_config_option *config_look_save_layout_on_exit;
|
||||
|
||||
@@ -1235,13 +1235,17 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
gui_buffer_visited_add (window->buffer);
|
||||
gui_buffer_visited_add (buffer);
|
||||
}
|
||||
if (set_last_read)
|
||||
if (set_last_read
|
||||
&& CONFIG_BOOLEAN(config_look_read_marker_update_on_buffer_switch))
|
||||
{
|
||||
if (window->buffer->num_displayed == 0)
|
||||
{
|
||||
window->buffer->lines->last_read_line = window->buffer->lines->last_line;
|
||||
window->buffer->lines->first_line_not_read = 0;
|
||||
}
|
||||
}
|
||||
if (set_last_read)
|
||||
{
|
||||
/*
|
||||
* if there is no line displayed after last read line,
|
||||
* then remove the read marker
|
||||
@@ -1260,8 +1264,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
|
||||
gui_buffer_set_active_buffer (buffer);
|
||||
gui_buffer_compute_num_displayed ();
|
||||
|
||||
if (!weechat_upgrading && (old_buffer != buffer))
|
||||
if (!weechat_upgrading
|
||||
&& (old_buffer != buffer)
|
||||
&& CONFIG_BOOLEAN(config_look_hotlist_update_on_buffer_switch))
|
||||
{
|
||||
gui_hotlist_remove_buffer (buffer, 0);
|
||||
}
|
||||
|
||||
/* remove unused bars and add missing bars in window */
|
||||
gui_bar_window_remove_unused_bars (window);
|
||||
|
||||
Reference in New Issue
Block a user