From: Olivier Matz Date: Fri, 24 Dec 2010 12:56:21 +0000 (+0100) Subject: cmdline (merge-intel): add new bindings; ctrl-p, ctrl-n, alt-d X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b7a1444866081c692a5d999e76ccec3a57277708;p=libcmdline.git cmdline (merge-intel): add new bindings; ctrl-p, ctrl-n, alt-d Signed-off-by: Olivier Matz --- diff --git a/src/lib/cmdline_rdline.c b/src/lib/cmdline_rdline.c index 91217be..2ad9a76 100644 --- a/src/lib/cmdline_rdline.c +++ b/src/lib/cmdline_rdline.c @@ -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; diff --git a/src/lib/cmdline_rdline.h b/src/lib/cmdline_rdline.h index a6b3275..87a1789 100644 --- a/src/lib/cmdline_rdline.h +++ b/src/lib/cmdline_rdline.h @@ -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, diff --git a/src/lib/cmdline_vt100.c b/src/lib/cmdline_vt100.c index f6b38e4..59788a2 100644 --- a/src/lib/cmdline_vt100.c +++ b/src/lib/cmdline_vt100.c @@ -93,6 +93,9 @@ const char *cmdline_vt100_commands[] = { vt100_word_right, "?", "\027", + "\020", + "\016", + "\033\144", }; void diff --git a/src/lib/cmdline_vt100.h b/src/lib/cmdline_vt100.h index 74090b5..4d64bfc 100644 --- a/src/lib/cmdline_vt100.h +++ b/src/lib/cmdline_vt100.h @@ -109,6 +109,9 @@ #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[];