diff mcabber/src/commands.c @ 1171:03a38b7ad2e0

Add a collection of commands for key bindings (Lego12239) This patch gives more flexibility to customize the key bindings, by adding a /iline command.
author Mikael Berthe <mikael@lilotux.net>
date Wed, 14 Mar 2007 21:33:17 +0100
parents d5b26a0a9771
children 334ae9f498f1
line wrap: on
line diff
--- a/mcabber/src/commands.c	Mon Feb 26 21:13:54 2007 +0100
+++ b/mcabber/src/commands.c	Wed Mar 14 21:33:17 2007 +0100
@@ -70,6 +70,7 @@
 static void do_event(char *arg);
 static void do_help(char *arg);
 static void do_pgp(char *arg);
+static void do_iline(char *arg);
 
 // Global variable for the commands list
 static GSList *Commands;
@@ -132,6 +133,7 @@
   cmd_add("status_to", "Show or set your status for one recipient",
           COMPL_JID, COMPL_STATUS, &do_status_to);
   cmd_add("version", "Show mcabber version", 0, 0, &do_version);
+  cmd_add("iline", "Manipulate input buffer", 0, 0, &do_iline);
 
   // Status category
   compl_add_category_word(COMPL_STATUS, "online");
@@ -2715,6 +2717,43 @@
   free_arg_lst(paramlst);
 }
 
+static void do_iline(char *arg)
+{
+  if (!strcasecmp(arg, "fword")) {
+    readline_forward_word();
+  } else if (!strcasecmp(arg, "bword")) {
+    readline_backward_word();
+  } else if (!strcasecmp(arg, "word_fdel")) {
+    readline_forward_kill_word();
+  } else if (!strcasecmp(arg, "word_bdel")) {
+    readline_backward_kill_word();
+  } else if (!strcasecmp(arg, "fchar")) {
+    readline_forward_char();
+  } else if (!strcasecmp(arg, "bchar")) {
+    readline_backward_char();
+  } else if (!strcasecmp(arg, "char_fdel")) {
+    readline_forward_kill_char();
+  } else if (!strcasecmp(arg, "char_bdel")) {
+    readline_backward_kill_char();
+  } else if (!strcasecmp(arg, "char_swp")) {
+    readline_transpose_chars();
+  } else if (!strcasecmp(arg, "hist_prev")) {
+    readline_hist_prev();
+  } else if (!strcasecmp(arg, "hist_next")) {
+    readline_hist_next();
+  } else if (!strcasecmp(arg, "iline_start")) {
+    readline_iline_start();
+  } else if (!strcasecmp(arg, "iline_end")) {
+    readline_iline_end();
+  } else if (!strcasecmp(arg, "iline_fdel")) {
+    readline_forward_kill_iline();
+  } else if (!strcasecmp(arg, "iline_bdel")) {
+    readline_backward_kill_iline();
+  } else if (!strcasecmp(arg, "send_multiline")) {
+    readline_send_multiline();
+  }
+}
+
 static void do_connect(char *arg)
 {
   mcabber_connect();