1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 11:13:12 +02:00

Add syntax "*N" for /buffer (where N is a buffer number): jump to buffer number or previous buffer

This will switch to buffer #N or previously displayed buffer if current buffer is #N
(it uses option weechat.look.jump_current_to_previous_buffer).
Default keys alt-1 to alt-0 are now /buffer *N
This commit is contained in:
Sebastien Helleu
2009-05-12 18:16:32 +02:00
parent b860043646
commit 2ab1626fa9
21 changed files with 183 additions and 80 deletions
+30 -3
View File
@@ -713,7 +713,31 @@ command_buffer (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
/* smart jump (jump to previous buffer for current number) */
if (argv[1][0] == '*')
{
error = NULL;
number = strtol (argv[1] + 1, &error, 10);
if (error && !error[0])
{
/* buffer is currently displayed ? then jump to previous buffer */
if ((number == gui_current_window->buffer->number)
&& (CONFIG_BOOLEAN(config_look_jump_current_to_previous_buffer))
&& gui_previous_buffer)
{
number = gui_previous_buffer->number;
}
if (number != gui_current_window->buffer->number)
{
gui_buffer_switch_by_number (gui_current_window,
(int) number);
}
}
return WEECHAT_RC_OK;
}
/* jump to buffer by number or name */
error = NULL;
number = strtol (argv[1], &error, 10);
@@ -3688,8 +3712,11 @@ command_init ()
" reset: reset to default value (all)\n"
"localvar: display local variables for current buffer\n"
" set: set a property for current buffer\n"
" number: jump to buffer by number\n"
"server,\n"
" number: jump to buffer by number, possible prefix:\n"
" '+': relative jump, add number to current\n"
" '-': relative jump, sub number to current\n"
" '*': jump to number, using option "
"\"weechat.look.jump_current_to_previous_buffer\"\n"
" name: jump to buffer by (partial) name\n\n"
"Examples:\n"
"clear current buffer: /buffer clear\n"
+2 -2
View File
@@ -1301,8 +1301,8 @@ config_weechat_init_options ()
weechat_config_file, ptr_section,
"jump_current_to_previous_buffer", "boolean",
N_("jump to previous buffer displayed when jumping to current buffer "
"number (to easily switch to another buffer, then come back to "
"current buffer)"),
"number with /buffer *N (where N is a buffer number), to easily "
"switch to another buffer, then come back to current buffer"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_nickmode = config_file_new_option (
weechat_config_file, ptr_section,