From 9e328d3fef0d87135d7c4aa5d22f35a5703208cd Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 30 Jul 2005 18:41:48 +0000 Subject: [PATCH] ctrl-up/ctrl-down keys added to call previous/next command in global history (common to all buffers) --- ChangeLog | 4 ++ po/es.po | 62 +++++++++++++++------------ po/fr.po | 62 +++++++++++++++------------ po/weechat.pot | 54 +++++++++++++---------- src/common/history.c | 64 ++++++++++++++-------------- src/common/history.h | 6 ++- src/gui/curses/gui-display.c | 4 +- src/gui/curses/gui-input.c | 2 + src/gui/gui-common.c | 60 ++++++++++++++++++++++++++ src/gui/gui-keyboard.c | 4 ++ src/gui/gui.h | 2 + weechat/ChangeLog | 4 ++ weechat/po/es.po | 62 +++++++++++++++------------ weechat/po/fr.po | 62 +++++++++++++++------------ weechat/po/weechat.pot | 54 +++++++++++++---------- weechat/src/common/history.c | 64 ++++++++++++++-------------- weechat/src/common/history.h | 6 ++- weechat/src/gui/curses/gui-display.c | 4 +- weechat/src/gui/curses/gui-input.c | 2 + weechat/src/gui/gui-common.c | 60 ++++++++++++++++++++++++++ weechat/src/gui/gui-keyboard.c | 4 ++ weechat/src/gui/gui.h | 2 + 22 files changed, 420 insertions(+), 228 deletions(-) diff --git a/ChangeLog b/ChangeLog index 736df2e50..3da48182c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,10 @@ WeeChat - Wee Enhanced Environment for Chat ChangeLog - 2005-07-30 +Version 0.1.5 (under dev!): + * ctrl-up/ctrl-down keys added to call previous/next command in global + history (common to all buffers) + Version 0.1.4 (2005-07-30): * join and part/quit prefixes (arrows) now displayed with different colors * added "irc_highlight" setting, to get highlight with any word diff --git a/po/es.po b/po/es.po index f8b6db87c..73bfd8af8 100644 --- a/po/es.po +++ b/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" -"PO-Revision-Date: 2005-07-30 10:59+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" +"PO-Revision-Date: 2005-07-30 20:39+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2140,7 +2140,7 @@ msgstr "" "%s no ha sido posible añadir el manejador para el mensaje \"%s\" (memoria " "insuficiente)\n" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "%s el lag (retraso) es alto, desconectando del servidor...\n" @@ -2206,15 +2206,15 @@ msgstr " [Q] Cerrar la vista DCC" msgid "server" msgstr "servidor" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "No hay suficiente memoria para el mensaje de la barra de información\n" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "No hay suficiente memoria para una nueva línea\n" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "No hay suficiente memoria para el mensaje de la barra de información\n" @@ -2291,82 +2291,90 @@ msgid "call previous command in history" msgstr "llamar al comando anterior en el historial" #: src/gui/gui-keyboard.c:81 +msgid "call previous command in global history" +msgstr "" + +#: src/gui/gui-keyboard.c:83 msgid "call next command in history" msgstr "llamar al comando siguiente en el historial" -#: src/gui/gui-keyboard.c:83 +#: src/gui/gui-keyboard.c:85 +msgid "call next command in global history" +msgstr "" + +#: src/gui/gui-keyboard.c:87 msgid "scroll one page up" msgstr "desplazarse una página hacia arriba" -#: src/gui/gui-keyboard.c:85 +#: src/gui/gui-keyboard.c:89 msgid "scroll one page down" msgstr "desplazarse una página hacia abajo" -#: src/gui/gui-keyboard.c:87 +#: src/gui/gui-keyboard.c:91 msgid "clear infobar" msgstr "limpiar barra de información" -#: src/gui/gui-keyboard.c:89 +#: src/gui/gui-keyboard.c:93 msgid "scroll nicklist one page up" msgstr "desplazar la lista de nicks una página hacia arriba" -#: src/gui/gui-keyboard.c:91 +#: src/gui/gui-keyboard.c:95 msgid "scroll nicklist one page down" msgstr "desplazar la lista de nicks una página hacia abajo" -#: src/gui/gui-keyboard.c:93 +#: src/gui/gui-keyboard.c:97 msgid "display beginning of nicklist" msgstr "mostrar el principio de la lista de nicks" -#: src/gui/gui-keyboard.c:95 +#: src/gui/gui-keyboard.c:99 msgid "display end of nicklist" msgstr "mostrar el final de la lista de nicks" -#: src/gui/gui-keyboard.c:97 +#: src/gui/gui-keyboard.c:101 msgid "refresh screen" msgstr "recargar la pantalla" -#: src/gui/gui-keyboard.c:99 +#: src/gui/gui-keyboard.c:103 msgid "jump to buffer with activity" msgstr "saltar al búfer con actividad" -#: src/gui/gui-keyboard.c:101 +#: src/gui/gui-keyboard.c:105 msgid "jump to DCC buffer" msgstr "saltar al búfer DCC" -#: src/gui/gui-keyboard.c:103 +#: src/gui/gui-keyboard.c:107 msgid "jump to last buffer" msgstr "" -#: src/gui/gui-keyboard.c:105 +#: src/gui/gui-keyboard.c:109 msgid "jump to server buffer" msgstr "saltar al búfer servidor" -#: src/gui/gui-keyboard.c:107 +#: src/gui/gui-keyboard.c:111 msgid "jump to next server" msgstr "saltar al servidor siguiente" -#: src/gui/gui-keyboard.c:109 +#: src/gui/gui-keyboard.c:113 msgid "clear hotlist" msgstr "limpiar hotlist" -#: src/gui/gui-keyboard.c:111 +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "%s No ha sido posible atar la clave \"%s\"\n" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" "%s No ha sido posible atar la clave \"%s\" (nombre de función inválido: \"%s" "\")\n" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "%s no hay suficiente memoria para atar la clave\n" @@ -3452,14 +3460,12 @@ msgid "color for middle char of prefix" msgstr "color para el carácter de en medio del prefijo" #: src/common/weeconfig.c:273 src/common/weeconfig.c:274 -#, fuzzy msgid "color for join arrow (prefix)" -msgstr "color para el carácter de en medio del prefijo" +msgstr "" #: src/common/weeconfig.c:277 src/common/weeconfig.c:278 -#, fuzzy msgid "color for part/quit arrow (prefix)" -msgstr "color para el carácter de en medio del prefijo" +msgstr "" #: src/common/weeconfig.c:281 msgid "color for nicks in actions" diff --git a/po/fr.po b/po/fr.po index 45d8f892a..5c152d138 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" -"PO-Revision-Date: 2005-07-30 10:59+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" +"PO-Revision-Date: 2005-07-30 20:38+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2143,7 +2143,7 @@ msgstr "" "%s impossible d'ajouter la fonction pour le message \"%s\" (mémoire " "insuffisante)\n" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "%s le lag est élevé, déconnexion du serveur...\n" @@ -2209,15 +2209,15 @@ msgstr " [Q] Fermer la vue DCC" msgid "server" msgstr "serveur" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "Pas assez de mémoire pour un message de la barre d'infos\n" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "Pas assez de mémoire pour une nouvelle ligne !\n" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "Pas assez de mémoire pour un message de la barre d'infos\n" @@ -2294,81 +2294,89 @@ msgid "call previous command in history" msgstr "appeler la commande précédente dans l'historique" #: src/gui/gui-keyboard.c:81 +msgid "call previous command in global history" +msgstr "appeler la commande précédente dans l'historique global" + +#: src/gui/gui-keyboard.c:83 msgid "call next command in history" msgstr "appeler la commande suivante dans l'historique" -#: src/gui/gui-keyboard.c:83 +#: src/gui/gui-keyboard.c:85 +msgid "call next command in global history" +msgstr "appeler la commande suivante dans l'historique global" + +#: src/gui/gui-keyboard.c:87 msgid "scroll one page up" msgstr "faire défiler d'une page vers le haut" -#: src/gui/gui-keyboard.c:85 +#: src/gui/gui-keyboard.c:89 msgid "scroll one page down" msgstr "faire défiler d'une page vers le bas" -#: src/gui/gui-keyboard.c:87 +#: src/gui/gui-keyboard.c:91 msgid "clear infobar" msgstr "effacer la barre d'infos" -#: src/gui/gui-keyboard.c:89 +#: src/gui/gui-keyboard.c:93 msgid "scroll nicklist one page up" msgstr "faire défiler la liste des pseudos d'une page vers le haut" -#: src/gui/gui-keyboard.c:91 +#: src/gui/gui-keyboard.c:95 msgid "scroll nicklist one page down" msgstr "faire défiler la liste des pseudos d'une page vers le bas" -#: src/gui/gui-keyboard.c:93 +#: src/gui/gui-keyboard.c:97 msgid "display beginning of nicklist" msgstr "afficher le début de la liste des pseudos" -#: src/gui/gui-keyboard.c:95 +#: src/gui/gui-keyboard.c:99 msgid "display end of nicklist" msgstr "afficher la fin de la liste des pseudos" -#: src/gui/gui-keyboard.c:97 +#: src/gui/gui-keyboard.c:101 msgid "refresh screen" msgstr "rafraichir l'écran" -#: src/gui/gui-keyboard.c:99 +#: src/gui/gui-keyboard.c:103 msgid "jump to buffer with activity" msgstr "sauter au tampon avec de l'activité" -#: src/gui/gui-keyboard.c:101 +#: src/gui/gui-keyboard.c:105 msgid "jump to DCC buffer" msgstr "sauter au tampon DCC" -#: src/gui/gui-keyboard.c:103 +#: src/gui/gui-keyboard.c:107 msgid "jump to last buffer" msgstr "sauter au dernier tampon" -#: src/gui/gui-keyboard.c:105 +#: src/gui/gui-keyboard.c:109 msgid "jump to server buffer" msgstr "sauter au tampon du serveur" -#: src/gui/gui-keyboard.c:107 +#: src/gui/gui-keyboard.c:111 msgid "jump to next server" msgstr "sauter au prochain serveur" -#: src/gui/gui-keyboard.c:109 +#: src/gui/gui-keyboard.c:113 msgid "clear hotlist" msgstr "effacer la liste d'activité" -#: src/gui/gui-keyboard.c:111 +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "capturer une touche" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "%s impossible de créer la touche \"%s\"\n" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" "%s impossible de créer la touche \"%s\" (nom fonction incorrect: \"%s\")\n" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "%s pas assez de mémoire pour la touche\n" @@ -3448,14 +3456,12 @@ msgid "color for middle char of prefix" msgstr "couleur pour le caractère du milieu du préfixe" #: src/common/weeconfig.c:273 src/common/weeconfig.c:274 -#, fuzzy msgid "color for join arrow (prefix)" -msgstr "couleur pour le caractère du milieu du préfixe" +msgstr "couleur pour la flèche du join (préfixe)" #: src/common/weeconfig.c:277 src/common/weeconfig.c:278 -#, fuzzy msgid "color for part/quit arrow (prefix)" -msgstr "couleur pour le caractère du milieu du préfixe" +msgstr "couleur pour la flèche du part/quit (préfixe)" #: src/common/weeconfig.c:281 msgid "color for nicks in actions" diff --git a/po/weechat.pot b/po/weechat.pot index 13cfa8a39..147d9035a 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2007,7 +2007,7 @@ msgstr "" msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "" @@ -2073,15 +2073,15 @@ msgstr "" msgid "server" msgstr "" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "" @@ -2158,80 +2158,88 @@ msgid "call previous command in history" msgstr "" #: src/gui/gui-keyboard.c:81 -msgid "call next command in history" +msgid "call previous command in global history" msgstr "" #: src/gui/gui-keyboard.c:83 -msgid "scroll one page up" +msgid "call next command in history" msgstr "" #: src/gui/gui-keyboard.c:85 -msgid "scroll one page down" +msgid "call next command in global history" msgstr "" #: src/gui/gui-keyboard.c:87 -msgid "clear infobar" +msgid "scroll one page up" msgstr "" #: src/gui/gui-keyboard.c:89 -msgid "scroll nicklist one page up" +msgid "scroll one page down" msgstr "" #: src/gui/gui-keyboard.c:91 -msgid "scroll nicklist one page down" +msgid "clear infobar" msgstr "" #: src/gui/gui-keyboard.c:93 -msgid "display beginning of nicklist" +msgid "scroll nicklist one page up" msgstr "" #: src/gui/gui-keyboard.c:95 -msgid "display end of nicklist" +msgid "scroll nicklist one page down" msgstr "" #: src/gui/gui-keyboard.c:97 -msgid "refresh screen" +msgid "display beginning of nicklist" msgstr "" #: src/gui/gui-keyboard.c:99 -msgid "jump to buffer with activity" +msgid "display end of nicklist" msgstr "" #: src/gui/gui-keyboard.c:101 -msgid "jump to DCC buffer" +msgid "refresh screen" msgstr "" #: src/gui/gui-keyboard.c:103 -msgid "jump to last buffer" +msgid "jump to buffer with activity" msgstr "" #: src/gui/gui-keyboard.c:105 -msgid "jump to server buffer" +msgid "jump to DCC buffer" msgstr "" #: src/gui/gui-keyboard.c:107 -msgid "jump to next server" +msgid "jump to last buffer" msgstr "" #: src/gui/gui-keyboard.c:109 -msgid "clear hotlist" +msgid "jump to server buffer" msgstr "" #: src/gui/gui-keyboard.c:111 +msgid "jump to next server" +msgstr "" + +#: src/gui/gui-keyboard.c:113 +msgid "clear hotlist" +msgstr "" + +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "" diff --git a/src/common/history.c b/src/common/history.c index ece23fdd7..980b0d1e5 100644 --- a/src/common/history.c +++ b/src/common/history.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* history.c: memorize and call again commands or text */ +/* history.c: memorize commands or text */ #ifdef HAVE_CONFIG_H @@ -33,10 +33,10 @@ #include "../gui/gui.h" -t_history *history_general = NULL; -t_history *history_general_last = NULL; -t_history *history_general_ptr = NULL; -int num_history_general = 0; +t_history *history_global = NULL; +t_history *history_global_last = NULL; +t_history *history_global_ptr = NULL; +int num_history_global = 0; /* @@ -74,7 +74,7 @@ history_add (void *buffer, char *string) { t_history *new_history, *ptr_history; - /* add history to general history */ + /* add history to global history */ new_history = (t_history *)malloc (sizeof (t_history)); if (new_history) { @@ -82,26 +82,26 @@ history_add (void *buffer, char *string) if (cfg_log_hide_nickserv_pwd) history_hide_password (new_history->text); - if (history_general) - history_general->prev_history = new_history; + if (history_global) + history_global->prev_history = new_history; else - history_general_last = new_history; - new_history->next_history = history_general; + history_global_last = new_history; + new_history->next_history = history_global; new_history->prev_history = NULL; - history_general = new_history; - num_history_general++; + history_global = new_history; + num_history_global++; /* remove one command if necessary */ if ((cfg_history_max_commands > 0) - && (num_history_general > cfg_history_max_commands)) + && (num_history_global > cfg_history_max_commands)) { - ptr_history = history_general_last->prev_history; - history_general_last->prev_history->next_history = NULL; - if (history_general_last->text) - free (history_general_last->text); - free (history_general_last); - history_general_last = ptr_history; - num_history_general--; + ptr_history = history_global_last->prev_history; + history_global_last->prev_history->next_history = NULL; + if (history_global_last->text) + free (history_global_last->text); + free (history_global_last); + history_global_last = ptr_history; + num_history_global--; } } @@ -138,26 +138,26 @@ history_add (void *buffer, char *string) } /* - * history_general_free: free general history + * history_global_free: free global history */ void -history_general_free () +history_global_free () { t_history *ptr_history; - while (history_general) + while (history_global) { - ptr_history = history_general->next_history; - if (history_general->text) - free (history_general->text); - free (history_general); - history_general = ptr_history; + ptr_history = history_global->next_history; + if (history_global->text) + free (history_global->text); + free (history_global); + history_global = ptr_history; } - history_general = NULL; - history_general_last = NULL; - history_general_ptr = NULL; - num_history_general = 0; + history_global = NULL; + history_global_last = NULL; + history_global_ptr = NULL; + num_history_global = 0; } diff --git a/src/common/history.h b/src/common/history.h index 9be1b40e8..9928e0787 100644 --- a/src/common/history.h +++ b/src/common/history.h @@ -30,8 +30,12 @@ struct t_history t_history *prev_history; /* link to previous text/command */ }; +extern t_history *history_global; +extern t_history *history_global_last; +extern t_history *history_global_ptr; + extern void history_add (void *, char *); -extern void history_general_free (); +extern void history_global_free (); extern void history_buffer_free (void *); #endif /* history.h */ 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" @@ -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) */ 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 (); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 736df2e50..3da48182c 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -4,6 +4,10 @@ WeeChat - Wee Enhanced Environment for Chat ChangeLog - 2005-07-30 +Version 0.1.5 (under dev!): + * ctrl-up/ctrl-down keys added to call previous/next command in global + history (common to all buffers) + Version 0.1.4 (2005-07-30): * join and part/quit prefixes (arrows) now displayed with different colors * added "irc_highlight" setting, to get highlight with any word diff --git a/weechat/po/es.po b/weechat/po/es.po index f8b6db87c..73bfd8af8 100644 --- a/weechat/po/es.po +++ b/weechat/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" -"PO-Revision-Date: 2005-07-30 10:59+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" +"PO-Revision-Date: 2005-07-30 20:39+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2140,7 +2140,7 @@ msgstr "" "%s no ha sido posible añadir el manejador para el mensaje \"%s\" (memoria " "insuficiente)\n" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "%s el lag (retraso) es alto, desconectando del servidor...\n" @@ -2206,15 +2206,15 @@ msgstr " [Q] Cerrar la vista DCC" msgid "server" msgstr "servidor" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "No hay suficiente memoria para el mensaje de la barra de información\n" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "No hay suficiente memoria para una nueva línea\n" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "No hay suficiente memoria para el mensaje de la barra de información\n" @@ -2291,82 +2291,90 @@ msgid "call previous command in history" msgstr "llamar al comando anterior en el historial" #: src/gui/gui-keyboard.c:81 +msgid "call previous command in global history" +msgstr "" + +#: src/gui/gui-keyboard.c:83 msgid "call next command in history" msgstr "llamar al comando siguiente en el historial" -#: src/gui/gui-keyboard.c:83 +#: src/gui/gui-keyboard.c:85 +msgid "call next command in global history" +msgstr "" + +#: src/gui/gui-keyboard.c:87 msgid "scroll one page up" msgstr "desplazarse una página hacia arriba" -#: src/gui/gui-keyboard.c:85 +#: src/gui/gui-keyboard.c:89 msgid "scroll one page down" msgstr "desplazarse una página hacia abajo" -#: src/gui/gui-keyboard.c:87 +#: src/gui/gui-keyboard.c:91 msgid "clear infobar" msgstr "limpiar barra de información" -#: src/gui/gui-keyboard.c:89 +#: src/gui/gui-keyboard.c:93 msgid "scroll nicklist one page up" msgstr "desplazar la lista de nicks una página hacia arriba" -#: src/gui/gui-keyboard.c:91 +#: src/gui/gui-keyboard.c:95 msgid "scroll nicklist one page down" msgstr "desplazar la lista de nicks una página hacia abajo" -#: src/gui/gui-keyboard.c:93 +#: src/gui/gui-keyboard.c:97 msgid "display beginning of nicklist" msgstr "mostrar el principio de la lista de nicks" -#: src/gui/gui-keyboard.c:95 +#: src/gui/gui-keyboard.c:99 msgid "display end of nicklist" msgstr "mostrar el final de la lista de nicks" -#: src/gui/gui-keyboard.c:97 +#: src/gui/gui-keyboard.c:101 msgid "refresh screen" msgstr "recargar la pantalla" -#: src/gui/gui-keyboard.c:99 +#: src/gui/gui-keyboard.c:103 msgid "jump to buffer with activity" msgstr "saltar al búfer con actividad" -#: src/gui/gui-keyboard.c:101 +#: src/gui/gui-keyboard.c:105 msgid "jump to DCC buffer" msgstr "saltar al búfer DCC" -#: src/gui/gui-keyboard.c:103 +#: src/gui/gui-keyboard.c:107 msgid "jump to last buffer" msgstr "" -#: src/gui/gui-keyboard.c:105 +#: src/gui/gui-keyboard.c:109 msgid "jump to server buffer" msgstr "saltar al búfer servidor" -#: src/gui/gui-keyboard.c:107 +#: src/gui/gui-keyboard.c:111 msgid "jump to next server" msgstr "saltar al servidor siguiente" -#: src/gui/gui-keyboard.c:109 +#: src/gui/gui-keyboard.c:113 msgid "clear hotlist" msgstr "limpiar hotlist" -#: src/gui/gui-keyboard.c:111 +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "%s No ha sido posible atar la clave \"%s\"\n" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" "%s No ha sido posible atar la clave \"%s\" (nombre de función inválido: \"%s" "\")\n" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "%s no hay suficiente memoria para atar la clave\n" @@ -3452,14 +3460,12 @@ msgid "color for middle char of prefix" msgstr "color para el carácter de en medio del prefijo" #: src/common/weeconfig.c:273 src/common/weeconfig.c:274 -#, fuzzy msgid "color for join arrow (prefix)" -msgstr "color para el carácter de en medio del prefijo" +msgstr "" #: src/common/weeconfig.c:277 src/common/weeconfig.c:278 -#, fuzzy msgid "color for part/quit arrow (prefix)" -msgstr "color para el carácter de en medio del prefijo" +msgstr "" #: src/common/weeconfig.c:281 msgid "color for nicks in actions" diff --git a/weechat/po/fr.po b/weechat/po/fr.po index 45d8f892a..5c152d138 100644 --- a/weechat/po/fr.po +++ b/weechat/po/fr.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.1.5-cvs\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" -"PO-Revision-Date: 2005-07-30 10:59+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" +"PO-Revision-Date: 2005-07-30 20:38+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -2143,7 +2143,7 @@ msgstr "" "%s impossible d'ajouter la fonction pour le message \"%s\" (mémoire " "insuffisante)\n" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "%s le lag est élevé, déconnexion du serveur...\n" @@ -2209,15 +2209,15 @@ msgstr " [Q] Fermer la vue DCC" msgid "server" msgstr "serveur" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "Pas assez de mémoire pour un message de la barre d'infos\n" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "Pas assez de mémoire pour une nouvelle ligne !\n" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "Pas assez de mémoire pour un message de la barre d'infos\n" @@ -2294,81 +2294,89 @@ msgid "call previous command in history" msgstr "appeler la commande précédente dans l'historique" #: src/gui/gui-keyboard.c:81 +msgid "call previous command in global history" +msgstr "appeler la commande précédente dans l'historique global" + +#: src/gui/gui-keyboard.c:83 msgid "call next command in history" msgstr "appeler la commande suivante dans l'historique" -#: src/gui/gui-keyboard.c:83 +#: src/gui/gui-keyboard.c:85 +msgid "call next command in global history" +msgstr "appeler la commande suivante dans l'historique global" + +#: src/gui/gui-keyboard.c:87 msgid "scroll one page up" msgstr "faire défiler d'une page vers le haut" -#: src/gui/gui-keyboard.c:85 +#: src/gui/gui-keyboard.c:89 msgid "scroll one page down" msgstr "faire défiler d'une page vers le bas" -#: src/gui/gui-keyboard.c:87 +#: src/gui/gui-keyboard.c:91 msgid "clear infobar" msgstr "effacer la barre d'infos" -#: src/gui/gui-keyboard.c:89 +#: src/gui/gui-keyboard.c:93 msgid "scroll nicklist one page up" msgstr "faire défiler la liste des pseudos d'une page vers le haut" -#: src/gui/gui-keyboard.c:91 +#: src/gui/gui-keyboard.c:95 msgid "scroll nicklist one page down" msgstr "faire défiler la liste des pseudos d'une page vers le bas" -#: src/gui/gui-keyboard.c:93 +#: src/gui/gui-keyboard.c:97 msgid "display beginning of nicklist" msgstr "afficher le début de la liste des pseudos" -#: src/gui/gui-keyboard.c:95 +#: src/gui/gui-keyboard.c:99 msgid "display end of nicklist" msgstr "afficher la fin de la liste des pseudos" -#: src/gui/gui-keyboard.c:97 +#: src/gui/gui-keyboard.c:101 msgid "refresh screen" msgstr "rafraichir l'écran" -#: src/gui/gui-keyboard.c:99 +#: src/gui/gui-keyboard.c:103 msgid "jump to buffer with activity" msgstr "sauter au tampon avec de l'activité" -#: src/gui/gui-keyboard.c:101 +#: src/gui/gui-keyboard.c:105 msgid "jump to DCC buffer" msgstr "sauter au tampon DCC" -#: src/gui/gui-keyboard.c:103 +#: src/gui/gui-keyboard.c:107 msgid "jump to last buffer" msgstr "sauter au dernier tampon" -#: src/gui/gui-keyboard.c:105 +#: src/gui/gui-keyboard.c:109 msgid "jump to server buffer" msgstr "sauter au tampon du serveur" -#: src/gui/gui-keyboard.c:107 +#: src/gui/gui-keyboard.c:111 msgid "jump to next server" msgstr "sauter au prochain serveur" -#: src/gui/gui-keyboard.c:109 +#: src/gui/gui-keyboard.c:113 msgid "clear hotlist" msgstr "effacer la liste d'activité" -#: src/gui/gui-keyboard.c:111 +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "capturer une touche" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "%s impossible de créer la touche \"%s\"\n" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" "%s impossible de créer la touche \"%s\" (nom fonction incorrect: \"%s\")\n" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "%s pas assez de mémoire pour la touche\n" @@ -3448,14 +3456,12 @@ msgid "color for middle char of prefix" msgstr "couleur pour le caractère du milieu du préfixe" #: src/common/weeconfig.c:273 src/common/weeconfig.c:274 -#, fuzzy msgid "color for join arrow (prefix)" -msgstr "couleur pour le caractère du milieu du préfixe" +msgstr "couleur pour la flèche du join (préfixe)" #: src/common/weeconfig.c:277 src/common/weeconfig.c:278 -#, fuzzy msgid "color for part/quit arrow (prefix)" -msgstr "couleur pour le caractère du milieu du préfixe" +msgstr "couleur pour la flèche du part/quit (préfixe)" #: src/common/weeconfig.c:281 msgid "color for nicks in actions" diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot index 13cfa8a39..147d9035a 100644 --- a/weechat/po/weechat.pot +++ b/weechat/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2005-07-30 09:47+0200\n" +"POT-Creation-Date: 2005-07-30 20:35+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2007,7 +2007,7 @@ msgstr "" msgid "%s unable to add handler for \"%s\" message (not enough memory)\n" msgstr "" -#: src/gui/curses/gui-input.c:338 +#: src/gui/curses/gui-input.c:340 #, c-format msgid "%s lag is high, disconnecting from server...\n" msgstr "" @@ -2073,15 +2073,15 @@ msgstr "" msgid "server" msgstr "" -#: src/gui/gui-common.c:340 +#: src/gui/gui-common.c:341 msgid "Not enough memory for infobar message\n" msgstr "" -#: src/gui/gui-common.c:515 +#: src/gui/gui-common.c:516 msgid "Not enough memory for new line\n" msgstr "" -#: src/gui/gui-common.c:558 +#: src/gui/gui-common.c:559 msgid "Not enough memory for new message\n" msgstr "" @@ -2158,80 +2158,88 @@ msgid "call previous command in history" msgstr "" #: src/gui/gui-keyboard.c:81 -msgid "call next command in history" +msgid "call previous command in global history" msgstr "" #: src/gui/gui-keyboard.c:83 -msgid "scroll one page up" +msgid "call next command in history" msgstr "" #: src/gui/gui-keyboard.c:85 -msgid "scroll one page down" +msgid "call next command in global history" msgstr "" #: src/gui/gui-keyboard.c:87 -msgid "clear infobar" +msgid "scroll one page up" msgstr "" #: src/gui/gui-keyboard.c:89 -msgid "scroll nicklist one page up" +msgid "scroll one page down" msgstr "" #: src/gui/gui-keyboard.c:91 -msgid "scroll nicklist one page down" +msgid "clear infobar" msgstr "" #: src/gui/gui-keyboard.c:93 -msgid "display beginning of nicklist" +msgid "scroll nicklist one page up" msgstr "" #: src/gui/gui-keyboard.c:95 -msgid "display end of nicklist" +msgid "scroll nicklist one page down" msgstr "" #: src/gui/gui-keyboard.c:97 -msgid "refresh screen" +msgid "display beginning of nicklist" msgstr "" #: src/gui/gui-keyboard.c:99 -msgid "jump to buffer with activity" +msgid "display end of nicklist" msgstr "" #: src/gui/gui-keyboard.c:101 -msgid "jump to DCC buffer" +msgid "refresh screen" msgstr "" #: src/gui/gui-keyboard.c:103 -msgid "jump to last buffer" +msgid "jump to buffer with activity" msgstr "" #: src/gui/gui-keyboard.c:105 -msgid "jump to server buffer" +msgid "jump to DCC buffer" msgstr "" #: src/gui/gui-keyboard.c:107 -msgid "jump to next server" +msgid "jump to last buffer" msgstr "" #: src/gui/gui-keyboard.c:109 -msgid "clear hotlist" +msgid "jump to server buffer" msgstr "" #: src/gui/gui-keyboard.c:111 +msgid "jump to next server" +msgstr "" + +#: src/gui/gui-keyboard.c:113 +msgid "clear hotlist" +msgstr "" + +#: src/gui/gui-keyboard.c:115 msgid "grab a key" msgstr "" -#: src/gui/gui-keyboard.c:422 src/common/command.c:1473 +#: src/gui/gui-keyboard.c:426 src/common/command.c:1473 #, c-format msgid "%s unable to bind key \"%s\"\n" msgstr "" -#: src/gui/gui-keyboard.c:433 +#: src/gui/gui-keyboard.c:437 #, c-format msgid "%s unable to bind key \"%s\" (invalid function name: \"%s\")\n" msgstr "" -#: src/gui/gui-keyboard.c:446 +#: src/gui/gui-keyboard.c:450 #, c-format msgid "%s not enough memory for key binding\n" msgstr "" diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c index ece23fdd7..980b0d1e5 100644 --- a/weechat/src/common/history.c +++ b/weechat/src/common/history.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* history.c: memorize and call again commands or text */ +/* history.c: memorize commands or text */ #ifdef HAVE_CONFIG_H @@ -33,10 +33,10 @@ #include "../gui/gui.h" -t_history *history_general = NULL; -t_history *history_general_last = NULL; -t_history *history_general_ptr = NULL; -int num_history_general = 0; +t_history *history_global = NULL; +t_history *history_global_last = NULL; +t_history *history_global_ptr = NULL; +int num_history_global = 0; /* @@ -74,7 +74,7 @@ history_add (void *buffer, char *string) { t_history *new_history, *ptr_history; - /* add history to general history */ + /* add history to global history */ new_history = (t_history *)malloc (sizeof (t_history)); if (new_history) { @@ -82,26 +82,26 @@ history_add (void *buffer, char *string) if (cfg_log_hide_nickserv_pwd) history_hide_password (new_history->text); - if (history_general) - history_general->prev_history = new_history; + if (history_global) + history_global->prev_history = new_history; else - history_general_last = new_history; - new_history->next_history = history_general; + history_global_last = new_history; + new_history->next_history = history_global; new_history->prev_history = NULL; - history_general = new_history; - num_history_general++; + history_global = new_history; + num_history_global++; /* remove one command if necessary */ if ((cfg_history_max_commands > 0) - && (num_history_general > cfg_history_max_commands)) + && (num_history_global > cfg_history_max_commands)) { - ptr_history = history_general_last->prev_history; - history_general_last->prev_history->next_history = NULL; - if (history_general_last->text) - free (history_general_last->text); - free (history_general_last); - history_general_last = ptr_history; - num_history_general--; + ptr_history = history_global_last->prev_history; + history_global_last->prev_history->next_history = NULL; + if (history_global_last->text) + free (history_global_last->text); + free (history_global_last); + history_global_last = ptr_history; + num_history_global--; } } @@ -138,26 +138,26 @@ history_add (void *buffer, char *string) } /* - * history_general_free: free general history + * history_global_free: free global history */ void -history_general_free () +history_global_free () { t_history *ptr_history; - while (history_general) + while (history_global) { - ptr_history = history_general->next_history; - if (history_general->text) - free (history_general->text); - free (history_general); - history_general = ptr_history; + ptr_history = history_global->next_history; + if (history_global->text) + free (history_global->text); + free (history_global); + history_global = ptr_history; } - history_general = NULL; - history_general_last = NULL; - history_general_ptr = NULL; - num_history_general = 0; + history_global = NULL; + history_global_last = NULL; + history_global_ptr = NULL; + num_history_global = 0; } diff --git a/weechat/src/common/history.h b/weechat/src/common/history.h index 9be1b40e8..9928e0787 100644 --- a/weechat/src/common/history.h +++ b/weechat/src/common/history.h @@ -30,8 +30,12 @@ struct t_history t_history *prev_history; /* link to previous text/command */ }; +extern t_history *history_global; +extern t_history *history_global_last; +extern t_history *history_global_ptr; + extern void history_add (void *, char *); -extern void history_general_free (); +extern void history_global_free (); extern void history_buffer_free (void *); #endif /* history.h */ diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 6f77de572..e1816a40c 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/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/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c index e290f9f42..ec5fe0551 100644 --- a/weechat/src/gui/curses/gui-input.c +++ b/weechat/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/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c index ec694a5b7..47711121e 100644 --- a/weechat/src/gui/gui-common.c +++ b/weechat/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" @@ -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) */ diff --git a/weechat/src/gui/gui-keyboard.c b/weechat/src/gui/gui-keyboard.c index 8d73476cf..2443975fd 100644 --- a/weechat/src/gui/gui-keyboard.c +++ b/weechat/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/weechat/src/gui/gui.h b/weechat/src/gui/gui.h index 96760a38a..532937510 100644 --- a/weechat/src/gui/gui.h +++ b/weechat/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 ();