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 91217be..2ad9a76 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 a6b3275..87a1789 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 f6b38e4..59788a2 100644 (file)
@@ -93,6 +93,9 @@ const char *cmdline_vt100_commands[] = {
        vt100_word_right,
        "?",
        "\027",
+       "\020",
+       "\016",
+       "\033\144",
 };
 
 void
index 74090b5..4d64bfc 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[];