mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 01:33:12 +02:00
core: move option "scroll_unread" from command /input to /window
This commit is contained in:
+10
-4
@@ -2376,8 +2376,6 @@ COMMAND_CALLBACK(input)
|
||||
gui_input_grab_mouse (buffer, 0);
|
||||
else if (string_strcasecmp (argv[1], "grab_mouse_area") == 0)
|
||||
gui_input_grab_mouse (buffer, 1);
|
||||
else if (string_strcasecmp (argv[1], "scroll_unread") == 0)
|
||||
gui_input_scroll_unread (buffer);
|
||||
else if (string_strcasecmp (argv[1], "set_unread") == 0)
|
||||
gui_input_set_unread ();
|
||||
else if (string_strcasecmp (argv[1], "set_unread_current_buffer") == 0)
|
||||
@@ -5143,6 +5141,13 @@ COMMAND_CALLBACK(window)
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/* scroll to unread marker */
|
||||
if (string_strcasecmp (argv[1], "scroll_unread") == 0)
|
||||
{
|
||||
gui_window_scroll_unread (ptr_win);
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/* split window horizontally */
|
||||
if (string_strcasecmp (argv[1], "splith") == 0)
|
||||
{
|
||||
@@ -5751,7 +5756,6 @@ command_init ()
|
||||
"default is 500 milliseconds)\n"
|
||||
" grab_mouse: grab mouse event code\n"
|
||||
" grab_mouse_area: grab mouse event code with area\n"
|
||||
" scroll_unread: scroll to unread marker\n"
|
||||
" set_unread: set unread marker for all buffers\n"
|
||||
" set_unread_current_buffer: set unread marker for "
|
||||
"current buffer\n"
|
||||
@@ -6127,7 +6131,7 @@ command_init ()
|
||||
" || scroll_horiz [-window <number>] [+/-]<value>[%]"
|
||||
" || scroll_up|scroll_down|scroll_top|"
|
||||
"scroll_bottom|scroll_previous_highlight|"
|
||||
"scroll_next_highlight [-window <number>]"
|
||||
"scroll_next_highlight|scroll_unread [-window <number>]"
|
||||
" || swap [-window <number>] [up|down|left|right]"
|
||||
" || zoom[-window <number>]"),
|
||||
N_(" list: list opened windows (without argument, "
|
||||
@@ -6161,6 +6165,7 @@ command_init ()
|
||||
"scroll_bottom: scroll to bottom of buffer\n"
|
||||
"scroll_previous_highlight: scroll to previous highlight\n"
|
||||
"scroll_next_highlight: scroll to next highlight\n"
|
||||
"scroll_unread: scroll to unread marker\n"
|
||||
" swap: swap buffers of two windows (with optional "
|
||||
"direction for target window)\n"
|
||||
" zoom: zoom on window\n\n"
|
||||
@@ -6201,6 +6206,7 @@ command_init ()
|
||||
" || scroll_bottom -window %(windows_numbers)"
|
||||
" || scroll_previous_highlight -window %(windows_numbers)"
|
||||
" || scroll_next_highlight -window %(windows_numbers)"
|
||||
" || scroll_unread -window %(windows_numbers)"
|
||||
" || swap up|down|left|right|-window %(windows_numbers)"
|
||||
" || zoom -window %(windows_numbers)"
|
||||
" || merge all|-window %(windows_numbers)",
|
||||
|
||||
@@ -138,7 +138,7 @@ gui_key_default_bindings (int context)
|
||||
BIND(/* m-j,m-s */ "meta-jmeta-s", "/server jump");
|
||||
BIND(/* m-h */ "meta-h", "/input hotlist_clear");
|
||||
BIND(/* m-k */ "meta-k", "/input grab_key_command");
|
||||
BIND(/* m-u */ "meta-u", "/input scroll_unread");
|
||||
BIND(/* m-u */ "meta-u", "/window scroll_unread");
|
||||
BIND(/* ^S^U */ "ctrl-Sctrl-U", "/input set_unread");
|
||||
BIND(/* ^Cb */ "ctrl-Cb", "/input insert \\x02");
|
||||
BIND(/* ^Cc */ "ctrl-Cc", "/input insert \\x03");
|
||||
|
||||
@@ -1418,44 +1418,6 @@ gui_input_grab_mouse (struct t_gui_buffer *buffer, int area)
|
||||
gui_mouse_grab_init (area);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_scroll_unread: scroll to first unread line of buffer
|
||||
* (default key: meta-u)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_scroll_unread (struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_window *window;
|
||||
|
||||
window = gui_window_search_with_buffer (buffer);
|
||||
if (window
|
||||
&& (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED))
|
||||
{
|
||||
if (CONFIG_STRING(config_look_read_marker) &&
|
||||
CONFIG_STRING(config_look_read_marker)[0] &&
|
||||
(window->buffer->type == GUI_BUFFER_TYPE_FORMATTED) &&
|
||||
(window->buffer->lines->first_line_not_read ||
|
||||
(window->buffer->lines->last_read_line &&
|
||||
window->buffer->lines->last_read_line != window->buffer->lines->last_line)))
|
||||
{
|
||||
if (window->buffer->lines->first_line_not_read)
|
||||
window->scroll->start_line = window->buffer->lines->first_line;
|
||||
else
|
||||
window->scroll->start_line = window->buffer->lines->last_read_line->next_line;
|
||||
if (window->scroll->start_line)
|
||||
{
|
||||
if (!gui_line_is_displayed (window->scroll->start_line))
|
||||
window->scroll->start_line = gui_line_get_next_displayed (window->scroll->start_line);
|
||||
}
|
||||
window->scroll->start_line_pos = 0;
|
||||
window->scroll->first_line_displayed =
|
||||
(window->scroll->start_line == gui_line_get_first_displayed (window->buffer));
|
||||
gui_buffer_ask_chat_refresh (window->buffer, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_set_unread: set unread marker for all buffers
|
||||
* (default key: ctrl-s, ctrl-u)
|
||||
|
||||
@@ -74,7 +74,6 @@ extern void gui_input_hotlist_clear (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_grab_key (struct t_gui_buffer *buffer, int command,
|
||||
const char *delay);
|
||||
extern void gui_input_grab_mouse (struct t_gui_buffer *buffer, int area);
|
||||
extern void gui_input_scroll_unread (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_set_unread ();
|
||||
extern void gui_input_set_unread_current (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_switch_active_buffer (struct t_gui_buffer *buffer);
|
||||
|
||||
@@ -1385,6 +1385,39 @@ gui_window_scroll_next_highlight (struct t_gui_window *window)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_scroll_unread: scroll to first unread line of buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_scroll_unread (struct t_gui_window *window)
|
||||
{
|
||||
if (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
if (CONFIG_STRING(config_look_read_marker) &&
|
||||
CONFIG_STRING(config_look_read_marker)[0] &&
|
||||
(window->buffer->type == GUI_BUFFER_TYPE_FORMATTED) &&
|
||||
(window->buffer->lines->first_line_not_read ||
|
||||
(window->buffer->lines->last_read_line &&
|
||||
window->buffer->lines->last_read_line != window->buffer->lines->last_line)))
|
||||
{
|
||||
if (window->buffer->lines->first_line_not_read)
|
||||
window->scroll->start_line = window->buffer->lines->first_line;
|
||||
else
|
||||
window->scroll->start_line = window->buffer->lines->last_read_line->next_line;
|
||||
if (window->scroll->start_line)
|
||||
{
|
||||
if (!gui_line_is_displayed (window->scroll->start_line))
|
||||
window->scroll->start_line = gui_line_get_next_displayed (window->scroll->start_line);
|
||||
}
|
||||
window->scroll->start_line_pos = 0;
|
||||
window->scroll->first_line_displayed =
|
||||
(window->scroll->start_line == gui_line_get_first_displayed (window->buffer));
|
||||
gui_buffer_ask_chat_refresh (window->buffer, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_search_text: search text in a buffer
|
||||
* return 1 if line has been found with text, otherwise 0
|
||||
|
||||
@@ -185,6 +185,7 @@ extern void gui_window_scroll (struct t_gui_window *window, char *scroll);
|
||||
extern void gui_window_scroll_horiz (struct t_gui_window *window, char *scroll);
|
||||
extern void gui_window_scroll_previous_highlight (struct t_gui_window *window);
|
||||
extern void gui_window_scroll_next_highlight (struct t_gui_window *window);
|
||||
extern void gui_window_scroll_unread (struct t_gui_window *window);
|
||||
extern void gui_window_search_start (struct t_gui_window *window);
|
||||
extern void gui_window_search_restart (struct t_gui_window *window);
|
||||
extern void gui_window_search_stop (struct t_gui_window *window);
|
||||
|
||||
Reference in New Issue
Block a user