summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-07-30 18:41:48 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-07-30 18:41:48 +0000
commit9e328d3fef0d87135d7c4aa5d22f35a5703208cd (patch)
tree0f86190a7424fd0118c58ab66b4b90c39d7a069b /src/gui
parent312d8015f5d52ee28bcbdf6d543a7e1c3a0b4063 (diff)
downloadweechat-9e328d3fef0d87135d7c4aa5d22f35a5703208cd.zip
ctrl-up/ctrl-down keys added to call previous/next command in global history (common to all buffers)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-display.c4
-rw-r--r--src/gui/curses/gui-input.c2
-rw-r--r--src/gui/gui-common.c60
-rw-r--r--src/gui/gui-keyboard.c4
-rw-r--r--src/gui/gui.h2
5 files changed, 70 insertions, 2 deletions
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 6f77de572..e1816a40c 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -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)
diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c
index e290f9f42..ec5fe0551 100644
--- a/src/gui/curses/gui-input.c
+++ b/src/gui/curses/gui-input.c
@@ -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");
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index ec694a5b7..47711121e 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -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"
@@ -1328,6 +1329,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
*/
@@ -1386,6 +1418,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)
*/
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index 8d73476cf..2443975fd 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -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,
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 96760a38a..532937510 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -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 ();