cmdline (merge-intel): add new bindings; ctrl-p, ctrl-n, alt-d
authorOlivier Matz <zer0@droids-corp.org>
Fri, 24 Dec 2010 12:56:21 +0000 (13:56 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 2 Jan 2011 20:53:15 +0000 (21:53 +0100)
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
src/lib/cmdline_rdline.c
src/lib/cmdline_rdline.h
src/lib/cmdline_vt100.c
src/lib/cmdline_vt100.h

index 91217bea19aa5b5e6ae1be3b72ebca04f0ad2610..2ad9a76c7aec72cfe0952511db584f27d33207bc 100644 (file)
@@ -291,6 +291,14 @@ rdline_char_in(struct rdline *rdl, char c)
                        display_right_buffer(rdl, 1);
                        break;
 
+               case CMDLINE_KEY_META_D:
+                       while (! CIRBUF_IS_EMPTY(&rdl->right) && isblank2(cirbuf_get_head(&rdl->right)))
+                               cirbuf_del_head(&rdl->right);
+                       while (! CIRBUF_IS_EMPTY(&rdl->right) && !isblank2(cirbuf_get_head(&rdl->right)))
+                               cirbuf_del_head(&rdl->right);
+                       display_right_buffer(rdl, 1);
+                       break;
+
                case CMDLINE_KEY_SUPPR:
                case CMDLINE_KEY_CTRL_D:
                        if (cmd == CMDLINE_KEY_CTRL_D &&
@@ -431,6 +439,7 @@ rdline_char_in(struct rdline *rdl, char c)
 
 #ifndef NO_RDLINE_HISTORY
                case CMDLINE_KEY_UP_ARR:
+               case CMDLINE_KEY_CTRL_P:
                        if (rdl->history_cur_line == 0) {
                                rdline_remove_first_history_item(rdl);
                        }
@@ -452,6 +461,7 @@ rdline_char_in(struct rdline *rdl, char c)
                        break;
 
                case CMDLINE_KEY_DOWN_ARR:
+               case CMDLINE_KEY_CTRL_N:
                        if (rdl->history_cur_line - 1 < 0)
                                break;
 
index a6b32752f9c308c31d4cdf3216766b95c17adfea..87a17890b1679a5480d7ebdf26bb8e8e48b1acb8 100644 (file)
@@ -103,7 +103,7 @@ enum rdline_status {
 
 struct rdline;
 
-typedef void (rdline_write_char_t)(struct rdline *rdl, char);
+typedef int (rdline_write_char_t)(struct rdline *rdl, char);
 typedef void (rdline_validate_t)(struct rdline *rdl,
                                 const char *buf, unsigned int size);
 typedef int (rdline_complete_t)(struct rdline *rdl, const char *buf,
index f6b38e4411df3a7772d11a116c6fd1ddf53be884..59788a2a18a39d38388455a0579d78cd4664011a 100644 (file)
@@ -93,6 +93,9 @@ const char *cmdline_vt100_commands[] = {
        vt100_word_right,
        "?",
        "\027",
+       "\020",
+       "\016",
+       "\033\144",
 };
 
 void
index 74090b56920f6b12909951758c33cf9d2068f74a..4d64bfc73daee5e780f09e150352e519288dc949 100644 (file)
 #define CMDLINE_KEY_WRIGHT 20
 #define CMDLINE_KEY_HELP 21
 #define CMDLINE_KEY_CTRL_W 22
+#define CMDLINE_KEY_CTRL_P 23
+#define CMDLINE_KEY_CTRL_N 24
+#define CMDLINE_KEY_META_D 25
 
 extern const char *cmdline_vt100_commands[];