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

ctrl-up/ctrl-down keys added to call previous/next command in global history (common to all buffers)

This commit is contained in:
Sebastien Helleu
2005-07-30 18:41:48 +00:00
parent 312d8015f5
commit 9e328d3fef
22 changed files with 420 additions and 228 deletions
+2 -2
View File
@@ -2465,8 +2465,8 @@ gui_end ()
while (gui_windows)
gui_window_free (gui_windows);
/* delete general history */
history_general_free ();
/* delete global history */
history_global_free ();
/* delete infobar messages */
while (gui_infobar)
+2
View File
@@ -75,7 +75,9 @@ gui_input_default_key_bindings ()
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
+60
View File
@@ -36,6 +36,7 @@
#include "gui.h"
#include "../common/command.h"
#include "../common/weeconfig.h"
#include "../common/history.h"
#include "../common/hotlist.h"
#include "../common/log.h"
#include "../irc/irc.h"
@@ -1327,6 +1328,37 @@ gui_input_up ()
}
}
/*
* gui_input_up_global: recall last command in global history
*/
void
gui_input_up_global ()
{
if (gui_current_window->buffer->has_input)
{
if (history_global_ptr)
{
history_global_ptr = history_global_ptr->next_history;
if (!history_global_ptr)
history_global_ptr = history_global;
}
else
history_global_ptr = history_global;
if (history_global_ptr)
{
gui_current_window->buffer->input_buffer_size =
strlen (history_global_ptr->text);
gui_input_optimize_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
}
/*
* gui_input_down: recall next command or move to next DCC in list
*/
@@ -1385,6 +1417,34 @@ gui_input_down ()
}
}
/*
* gui_input_down_global: recall next command in global history
*/
void
gui_input_down_global ()
{
if (gui_current_window->buffer->has_input)
{
if (history_global_ptr)
{
history_global_ptr = history_global_ptr->prev_history;
if (history_global_ptr)
gui_current_window->buffer->input_buffer_size =
strlen (history_global_ptr->text);
else
gui_current_window->buffer->input_buffer_size = 0;
gui_input_optimize_buffer_size (gui_current_window->buffer);
gui_current_window->buffer->input_buffer_pos =
gui_current_window->buffer->input_buffer_size;
if (history_global_ptr)
strcpy (gui_current_window->buffer->input_buffer,
history_global_ptr->text);
gui_draw_buffer_input (gui_current_window->buffer, 0);
}
}
}
/*
* gui_input_jump_smart: jump to buffer with activity (alt-A by default)
*/
+4
View File
@@ -77,8 +77,12 @@ t_gui_key_function gui_key_functions[] =
N_("move to next word") },
{ "up", gui_input_up,
N_("call previous command in history") },
{ "up_global", gui_input_up_global,
N_("call previous command in global history") },
{ "down", gui_input_down,
N_("call next command in history") },
{ "down_global", gui_input_down_global,
N_("call next command in global history") },
{ "page_up", gui_input_page_up,
N_("scroll one page up") },
{ "page_down", gui_input_page_down,
+2
View File
@@ -336,7 +336,9 @@ extern void gui_input_previous_word ();
extern void gui_input_right ();
extern void gui_input_next_word ();
extern void gui_input_up ();
extern void gui_input_up_global ();
extern void gui_input_down ();
extern void gui_input_down_global ();
extern void gui_input_jump_smart ();
extern void gui_input_jump_dcc ();
extern void gui_input_jump_last_buffer ();