Added ^U functionality, clears input line (patch form cras).
authorPekka Riikonen <priikone@silcnet.org>
Tue, 18 Jul 2000 12:20:39 +0000 (12:20 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 18 Jul 2000 12:20:39 +0000 (12:20 +0000)
apps/silc/client.c

index f6555185d9c0328846587f637e83041563be1c12..9099d7ad50e96e8a6a8abcf6c1d824aea527f9d9 100644 (file)
@@ -20,6 +20,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.11  2000/07/18 12:20:39  priikone
+ *     Added ^U functionality, clears input line (patch form cras).
+ *
  * Revision 1.10  2000/07/18 06:53:15  priikone
  *     Allow partial command strings in comparison.
  *
@@ -64,6 +67,7 @@
 
 /* Static function prototypes */
 static int silc_client_bad_keys(unsigned char key);
+static void silc_client_clear_input(SilcClient client);
 static void silc_client_process_message(SilcClient client);
 static char *silc_client_parse_command(unsigned char *buffer);
 
@@ -393,7 +397,6 @@ SILC_TASK_CALLBACK(silc_client_process_key_press)
     /* Enter, Return. User pressed enter we are ready to
        process the message. */
     silc_client_process_message(client);
-    silc_screen_input_reset(client->screen);
     break;
   case CTRL('l'):
     /* Refresh screen, Ctrl^l */
@@ -420,6 +423,7 @@ SILC_TASK_CALLBACK(silc_client_process_key_press)
   case KEY_DL:
   case CTRL('u'):
     /* Delete line */
+    silc_client_clear_input(client);
     break;
   default:
     /* 
@@ -465,6 +469,16 @@ static int silc_client_bad_keys(unsigned char key)
   }
 }
 
+/* Clears input buffer */
+
+static void silc_client_clear_input(SilcClient client)
+{
+  silc_buffer_clear(client->input_buffer);
+  silc_buffer_pull_tail(client->input_buffer,
+                       SILC_BUFFER_END(client->input_buffer));
+  silc_screen_input_reset(client->screen);
+}
+
 /* Processes messages user has typed on the screen. This either sends
    a packet out to network or if command were written executes it. */
 
@@ -535,9 +549,7 @@ static void silc_client_process_message(SilcClient client)
 
  out:
   /* Clear the input buffer */
-  silc_buffer_clear(client->input_buffer);
-  silc_buffer_pull_tail(client->input_buffer, 
-                       SILC_BUFFER_END(client->input_buffer));
+  silc_client_clear_input(client);
 }
 
 /* Returns the command fetched from user typed command line */