mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
core: add key ctrl+o to send command found and insert next one in input (issue #2040)
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ For a list of important changes that require manual actions, please look at rele
|
||||
|
||||
New features::
|
||||
|
||||
* core: move key kbd:[Ctrl+r] to kbd:[Ctrl+s], add key kbd:[Ctrl+r] to search in commands history, add option `search_history` in command `/input`, add key context "histsearch", add option weechat.look.buffer_search_history, add buffer variables "text_search_direction", "text_search_history" and "text_search_ptr_history" (issue #2040)
|
||||
* core: move key kbd:[Ctrl+r] to kbd:[Ctrl+s], add key kbd:[Ctrl+r] to search in commands history, add option `search_history` in command `/input`, add key context "histsearch", add option weechat.look.buffer_search_history, add buffer variables "text_search_direction", "text_search_history" and "text_search_ptr_history", add key kbd:[Ctrl+o] to send command found and insert next one in input (issue #2040)
|
||||
* core: display only version with command `/version`, add options `-o` and `-ol` in command `/upgrade`
|
||||
* core: add number of processes in command `/sys waitpid`
|
||||
* core, alias, trigger: allow wildcard in commands `/bar`, `/item`, `/proxy`, `/alias` and `/trigger` (issue #1956)
|
||||
|
||||
@@ -1808,6 +1808,8 @@ search text in commands history).
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1583,6 +1583,7 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
|
||||
| kbd:[Enter] +
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Execute command or send message (in search mode: stop search). | `+/input return+`
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
| kbd:[Alt+Enter] | Insert a newline. | `+/input insert \n+`
|
||||
| kbd:[Alt+d] | Delete next word in command line (deleted string is copied to the internal clipboard). | `+/input delete_next_word+`
|
||||
| kbd:[Alt+k] | Grab a key and insert its code (and command bound if key exists) in command line. | `+/input grab_key_command+`
|
||||
@@ -1774,6 +1775,7 @@ search text in commands history).
|
||||
| kbd:[Enter] +
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1810,6 +1810,7 @@ est pressé pour chercher du texte dans l'historique des commandes).
|
||||
| kbd:[Enter] +
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Arrêter la recherche et utiliser la commande trouvée. | `+/input search_stop_here+`
|
||||
| kbd:[Ctrl+o] | Exécuter la commande trouvée dans l'historique et insérer la suivante sur la ligne de commande. | `+/input history_use_get_next+`
|
||||
| kbd:[Ctrl+q] | Arrêter la recherche et restaurer la ligne de commande à sa valeur initiale. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1965,6 +1965,8 @@ search text in commands history).
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1917,6 +1917,8 @@ search text in commands history).
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1811,6 +1811,8 @@ search text in commands history).
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -1716,6 +1716,8 @@ search text in commands history).
|
||||
kbd:[Ctrl+j] +
|
||||
kbd:[Ctrl+m] | Stop search and use matching input. | `+/input search_stop_here+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+o] | Execute the command found in history and insert the next one in the command line. | `+/input history_use_get_next+`
|
||||
// TRANSLATION MISSING
|
||||
| kbd:[Ctrl+q] | Stop search and restore input to its initial value. | `+/input search_stop+`
|
||||
|===
|
||||
|
||||
|
||||
@@ -3593,6 +3593,8 @@ COMMAND_CALLBACK(input)
|
||||
gui_input_history_global_previous (buffer);
|
||||
else if (string_strcmp (argv[1], "history_global_next") == 0)
|
||||
gui_input_history_global_next (buffer);
|
||||
else if (string_strcmp (argv[1], "history_use_get_next") == 0)
|
||||
gui_input_history_use_get_next (buffer);
|
||||
else if (string_strcmp (argv[1], "grab_key") == 0)
|
||||
{
|
||||
gui_input_grab_key (buffer,
|
||||
@@ -8524,6 +8526,9 @@ command_init ()
|
||||
N_("> raw[history_next]: recall next command in current buffer history"),
|
||||
N_("> raw[history_global_previous]: recall previous command in global history"),
|
||||
N_("> raw[history_global_next]: recall next command in global history"),
|
||||
N_("> raw[history_use_get_next]: send the current history entry "
|
||||
"(found with search or recalled with \"up\"key) and insert the "
|
||||
"next history entry in the command line without sending it"),
|
||||
N_("> raw[grab_key]: grab a key (optional argument: delay for end of grab, "
|
||||
"default is 500 milliseconds)"),
|
||||
N_("> raw[grab_key_command]: grab a key with its associated command (optional "
|
||||
@@ -8554,7 +8559,7 @@ command_init ()
|
||||
"move_previous_char || move_next_char || move_previous_word || "
|
||||
"move_next_word || move_previous_line || move_next_line || "
|
||||
"history_previous || history_next || history_global_previous || "
|
||||
"history_global_next || "
|
||||
"history_global_next || history_use_get_next || "
|
||||
"grab_key || grab_key_command || "
|
||||
"grab_mouse || grab_mouse_area || "
|
||||
"insert || send",
|
||||
|
||||
@@ -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