diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 2 | ||||
-rw-r--r-- | src/core/wee-command.c | 7 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 28 | ||||
-rw-r--r-- | src/gui/gui-buffer.h | 1 | ||||
-rw-r--r-- | src/gui/gui-input.c | 23 | ||||
-rw-r--r-- | src/gui/gui-input.h | 1 |
9 files changed, 61 insertions, 7 deletions
@@ -9,6 +9,8 @@ Version 0.3.2 (under dev!) * core: add signal "day_changed" * core: remove unneeded space after time on each line if option weechat.look.buffer_time_format is set to empty value (bug #28751) +* core: add option "switch_active_buffer_previous" for command /input + (task #10141) * gui: fix bug with global history, reset pointer to last entry after each user input (bug #28754) * api: add missing infos in functions buffer_get_integer / buffer_get_string diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 90109fdad..6e7301524 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -155,7 +155,7 @@ value: number of history entries to show ........................................ -• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | insert [args]`:: +• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | switch_active_buffer_previous | insert [args]`:: ........................................ functions for command line diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index 178a337b5..039209304 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -155,7 +155,7 @@ valeur: nombre d'entrées dans l'historique à afficher ........................................ -• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | insert [args]`:: +• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | switch_active_buffer_previous | insert [args]`:: ........................................ fonctions pour la ligne de commande diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index 154421196..5e9a0db20 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -155,7 +155,7 @@ valore: numero delle voci nella cronologia da mostrare ........................................ -• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | insert [args]`:: +• *`/input`* `return | complete_next | complete_previous | search_next | delete_previous_char | delete_next_char | delete_previous_word | delete_next_word | delete_beginning_of_line | delete_end_of_line | delete_line | clipboard_paste | transpose_chars | move_beginning_of_line | move_end_of_line | move_previous_char | move_next_char | move_previous_word | move_next_word | history_previous | history_next | history_global_previous | history_global_next | jump_smart | jump_last_buffer | jump_previously_visited_buffer | jump_next_visited_buffer | hotlist_clear | grab_key | grab_key_command | scroll_unread | set_unread | set_unread_current_buffer | switch_active_buffer | switch_active_buffer_previous | insert [args]`:: ........................................ funzioni per la riga di comando diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 9e687fcf4..445d97a43 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1879,6 +1879,8 @@ command_input (void *data, struct t_gui_buffer *buffer, gui_input_set_unread_buffer (gui_current_window->buffer); else if (string_strcasecmp (argv[1], "switch_active_buffer") == 0) gui_input_switch_active_buffer (gui_current_window); + else if (string_strcasecmp (argv[1], "switch_active_buffer_previous") == 0) + gui_input_switch_active_buffer_previous (gui_current_window); else if (string_strcasecmp (argv[1], "insert") == 0) { if (argc > 2) @@ -4160,7 +4162,7 @@ command_init () "jump_next_visited_buffer | hotlist_clear | grab_key | " "grab_key_command | scroll_unread | set_unread | " "set_unread_current_buffer | switch_active_buffer | " - "insert [args]", + "switch_active_buffer_previous | insert [args]", N_("This command is used by key bindings or plugins."), "return|complete_next|complete_previous|search_next|" "delete_previous_char|delete_next_char|" @@ -4174,7 +4176,8 @@ command_init () "jump_smart|jump_last_buffer|jump_previously_visited_buffer|" "jump_next_visited_buffer|hotlist_clear|grab_key|" "grab_key_command|scroll_unread|set_unread|" - "set_unread_current_buffer|switch_active_buffer|insert", + "set_unread_current_buffer|switch_active_buffer|" + "switch_active_buffer_previous|insert", &command_input, NULL); hook_command (NULL, "key", N_("bind/unbind keys"), diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 1d1acf5c2..f2df9dbf2 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1732,6 +1732,34 @@ gui_buffer_get_next_active_buffer (struct t_gui_buffer *buffer) } /* + * gui_buffer_get_previous_active_buffer: get previous active buffer (when many + * buffers are merged) + */ + +struct t_gui_buffer * +gui_buffer_get_previous_active_buffer (struct t_gui_buffer *buffer) +{ + struct t_gui_buffer *ptr_buffer; + + if (buffer->prev_buffer + && (buffer->prev_buffer->number == buffer->number)) + return buffer->prev_buffer; + else + { + for (ptr_buffer = last_gui_buffer; ptr_buffer; + ptr_buffer = ptr_buffer->prev_buffer) + { + if ((ptr_buffer != buffer) + && (ptr_buffer->number == buffer->number)) + { + return ptr_buffer; + } + } + } + return buffer; +} + +/* * gui_buffer_move_to_number: move a buffer to another number */ diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index fd0ed41ba..77ded8b52 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -233,6 +233,7 @@ extern void gui_buffer_switch_by_number (struct t_gui_window *window, int number); extern void gui_buffer_set_active_buffer (struct t_gui_buffer *buffer); extern struct t_gui_buffer *gui_buffer_get_next_active_buffer (struct t_gui_buffer *buffer); +extern struct t_gui_buffer *gui_buffer_get_previous_active_buffer (struct t_gui_buffer *buffer); extern void gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number); extern void gui_buffer_merge (struct t_gui_buffer *buffer, struct t_gui_buffer *target_buffer); diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index 3dd4d431f..dce6be51b 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -1288,8 +1288,8 @@ gui_input_set_unread_buffer (struct t_gui_buffer *buffer) } /* - * gui_input_switch_active_buffer: switch active buffer (when many buffers are - * merged) + * gui_input_switch_active_buffer: switch active buffer to next buffer + * (when many buffers are merged) */ void @@ -1306,6 +1306,25 @@ gui_input_switch_active_buffer (struct t_gui_window *window) } /* + * gui_input_switch_active_buffer_previous: switch active buffer to previous + * buffer (when many buffers are + * merged) + */ + +void +gui_input_switch_active_buffer_previous (struct t_gui_window *window) +{ + struct t_gui_buffer *ptr_buffer; + + ptr_buffer = gui_buffer_get_previous_active_buffer (window->buffer); + if (ptr_buffer) + { + gui_buffer_set_active_buffer (ptr_buffer); + gui_window_switch_to_buffer (window, ptr_buffer, 1); + } +} + +/* * gui_input_insert: insert a string in command line * (many default keys are bound to this function) */ diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h index 9586b04ee..a03a6ec44 100644 --- a/src/gui/gui-input.h +++ b/src/gui/gui-input.h @@ -70,6 +70,7 @@ extern void gui_input_scroll_unread (struct t_gui_window *window); extern void gui_input_set_unread (); extern void gui_input_set_unread_buffer (struct t_gui_buffer *buffer); extern void gui_input_switch_active_buffer (struct t_gui_window *window); +extern void gui_input_switch_active_buffer_previous (struct t_gui_window *window); extern void gui_input_insert (struct t_gui_buffer *buffer, const char *args); #endif /* gui-input.h */ |