mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 16:53:14 +02:00
core: add key ctrl+o to send command found and insert next one in input (issue #2040)
This commit is contained in:
@@ -124,6 +124,7 @@ gui_key_default_bindings (int context, int create_option)
|
||||
BIND("down", "/input history_next");
|
||||
BIND("ctrl-up", "/input history_global_previous");
|
||||
BIND("ctrl-down", "/input history_global_next");
|
||||
BIND("ctrl-o", "/input history_use_get_next");
|
||||
BIND("shift-up", "/input move_previous_line");
|
||||
BIND("shift-down", "/input move_next_line");
|
||||
BIND("meta-a", "/buffer jump smart");
|
||||
@@ -219,6 +220,10 @@ gui_key_default_bindings (int context, int create_option)
|
||||
BIND("up", "/input search_previous");
|
||||
BIND("ctrl-s", "/input search_next");
|
||||
BIND("down", "/input search_next");
|
||||
if (context == GUI_KEY_CONTEXT_HISTSEARCH)
|
||||
{
|
||||
BIND("ctrl-o", "/input history_use_get_next");
|
||||
}
|
||||
}
|
||||
else if (context == GUI_KEY_CONTEXT_CURSOR)
|
||||
{
|
||||
|
||||
@@ -1803,6 +1803,54 @@ gui_input_history_global_next (struct t_gui_buffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Sends the current history entry (found with search or recalled with
|
||||
* "up" key) and inserts the next one in the command line without sending it
|
||||
* (default key: ctrl-o, in contexts "default" and "histsearch").
|
||||
*/
|
||||
|
||||
void
|
||||
gui_input_history_use_get_next (struct t_gui_buffer *buffer)
|
||||
{
|
||||
struct t_gui_window *window;
|
||||
struct t_gui_history *ptr_history, **ptr_ptr_history;;
|
||||
|
||||
window = gui_window_search_with_buffer (buffer);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
ptr_history = NULL;
|
||||
ptr_ptr_history = NULL;
|
||||
if (window->buffer->text_search == GUI_BUFFER_SEARCH_HISTORY)
|
||||
{
|
||||
ptr_history = window->buffer->text_search_ptr_history;
|
||||
if (!ptr_history)
|
||||
return;
|
||||
ptr_ptr_history = (window->buffer->text_search_history == GUI_BUFFER_SEARCH_HISTORY_LOCAL) ?
|
||||
&(window->buffer->ptr_history) : &gui_history_ptr;
|
||||
gui_window_search_stop (window, 1);
|
||||
}
|
||||
else if (window->buffer->ptr_history)
|
||||
{
|
||||
ptr_history = window->buffer->ptr_history;
|
||||
ptr_ptr_history = &(window->buffer->ptr_history);
|
||||
}
|
||||
else if (gui_history_ptr)
|
||||
{
|
||||
ptr_history = gui_history_ptr;
|
||||
ptr_ptr_history = &gui_history_ptr;
|
||||
}
|
||||
|
||||
gui_input_return (buffer);
|
||||
|
||||
if (ptr_history && ptr_history->prev_history)
|
||||
{
|
||||
gui_input_insert_string (buffer, ptr_history->prev_history->text);
|
||||
if (ptr_ptr_history)
|
||||
*ptr_ptr_history = ptr_history->prev_history;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes "grab key mode" (next key will be inserted into input buffer)
|
||||
* (default key: alt-k).
|
||||
|
||||
@@ -80,6 +80,7 @@ extern void gui_input_history_local_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_local_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_previous (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_global_next (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_history_use_get_next (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);
|
||||
|
||||
Reference in New Issue
Block a user