changeset 1985:0870005f7efc

Add command /iline clear_history
author Mikael Berthe <mikael@lilotux.net>
date Sun, 27 Mar 2011 13:35:08 +0200
parents b0470ef8669b
children ad77110343d6
files mcabber/doc/help/cs/hlp_iline.txt mcabber/doc/help/de/hlp_iline.txt mcabber/doc/help/en/hlp_iline.txt mcabber/doc/help/fr/hlp_iline.txt mcabber/doc/help/it/hlp_iline.txt mcabber/doc/help/nl/hlp_iline.txt mcabber/doc/help/pl/hlp_iline.txt mcabber/doc/help/ru/hlp_iline.txt mcabber/doc/help/uk/hlp_iline.txt mcabber/mcabber/commands.c mcabber/mcabber/screen.c mcabber/mcabber/screen.h
diffstat 12 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/doc/help/cs/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/cs/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Akceptuje řádek a vloží následující řádek z historie příkazů na vstupní řádek.
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Doplní aktuální slovo na příkazovém řádku.
 /iline compl_cancel
--- a/mcabber/doc/help/de/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/de/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -61,6 +62,8 @@
  Zeile akzeptieren und die nächste Zeile aus der History in die Eingabezeile schreiben
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Das derzeitig ausgewählte Wort vervollständigen
 /iline compl_cancel
--- a/mcabber/doc/help/en/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/en/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Accept line and put the next history line in the input line
 /iline iline_insert text
  Insert some text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Complete current word, in the input line
 /iline compl_cancel
--- a/mcabber/doc/help/fr/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/fr/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Accepter/valider la ligne de commande et charger la ligne suivante de l'historique ligne de commande
 /iline iline_insert texte
  Insérer le texte dans la ligne de commande, à la position du curseur. Notez que les guillemets doivent être protégés (\"), et que l'écran n'est pas rafraîchi (cf. /screen_refresh).
+/iline clear_history
+ Efface l'historique de la ligne de commande
 /iline compl_do
  Compléter le mot actuel dans la ligne de commande
 /iline compl_cancel
--- a/mcabber/doc/help/it/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/it/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Accetta la linea ad inserisci la prossima linea della history nella riga di input
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Completa la parola corrente nella riga di input
 /iline compl_cancel
--- a/mcabber/doc/help/nl/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/nl/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Accepteer regel en plaats de volgende regel uit de geschiedenis op de invoerregel
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Completeer het huidige woord op de invoerregel
 /iline compl_cancel
--- a/mcabber/doc/help/pl/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/pl/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Akceptuje linie i wstawia następną z historii do linii komend
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Dopełnia aktualne słowo w linii komend
 /iline compl_cancel
--- a/mcabber/doc/help/ru/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/ru/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Закончить ввод, отправить строку текущему пользователю, поместить следующую строку истории в строку ввода
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Завершить текущее слово в строке ввода
 /iline compl_cancel
--- a/mcabber/doc/help/uk/hlp_iline.txt	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/doc/help/uk/hlp_iline.txt	Sun Mar 27 13:35:08 2011 +0200
@@ -7,6 +7,7 @@
  /ILINE iline_start|iline_end|iline_fdel|iline_bdel
  /ILINE iline_accept|iline_accept_down_hist
  /ILINE iline_insert
+ /ILINE clear_history
  /ILINE compl_do|compl_cancel
  /ILINE send_multiline
 
@@ -58,6 +59,8 @@
  Перейти до наступного рядка в історії, затвердивши поточний.
 /iline iline_insert text
  Insert text in the input line, at the current position.  Please note that quotes have to be escaped, and that the screen is not refreshed (use /screen_refresh).
+/iline clear_history
+ Clear the command line history
 /iline compl_do
  Доповнити поточне слово.
 /iline compl_cancel
--- a/mcabber/mcabber/commands.c	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/mcabber/commands.c	Sun Mar 27 13:35:08 2011 +0200
@@ -3877,6 +3877,8 @@
     readline_cancel_completion();
   } else if (!strcasecmp(arg, "compl_do")) {
     readline_do_completion();
+  } else if (!strcasecmp(arg, "clear_history")) {
+    readline_clear_history();
   } else {
     char **paramlst;
     char *subcmd;
--- a/mcabber/mcabber/screen.c	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/mcabber/screen.c	Sun Mar 27 13:35:08 2011 +0200
@@ -3206,7 +3206,7 @@
 
 //  scr_cmdhisto_addline()
 // Add a line to the inputLine history
-static inline void scr_cmdhisto_addline(char *line)
+static void scr_cmdhisto_addline(char *line)
 {
   int max_histo_lines;
 
@@ -3231,6 +3231,19 @@
   cmdhisto_nblines++;
 }
 
+//  scr_cmdhisto_reset()
+// Reset the inputLine history
+static void scr_cmdhisto_reset(void)
+{
+  while (cmdhisto_nblines) {
+    g_free(cmdhisto->data);
+    cmdhisto = g_list_delete_link(cmdhisto, cmdhisto);
+    cmdhisto_nblines--;
+  }
+  cmdhisto_backup[0] = 0;
+  cmdhisto_cur = NULL;
+}
+
 //  scr_cmdhisto_prev()
 // Look for previous line beginning w/ the given mask in the inputLine history
 // Returns NULL if none found
@@ -3496,6 +3509,13 @@
   return 0;
 }
 
+//  readline_clear_history()
+// Clear command line history.
+void readline_clear_history(void)
+{
+  scr_cmdhisto_reset();
+}
+
 void readline_cancel_completion(void)
 {
   scr_cancel_current_completion();
--- a/mcabber/mcabber/screen.h	Sun Mar 27 12:45:41 2011 +0200
+++ b/mcabber/mcabber/screen.h	Sun Mar 27 13:35:08 2011 +0200
@@ -175,6 +175,7 @@
 void readline_backward_char(void);
 void readline_forward_char(void);
 int  readline_accept_line(int down_history);
+void readline_clear_history(void);
 void readline_cancel_completion(void);
 void readline_do_completion(void);
 void readline_refresh_screen(void);