circo

claudio's IRC oasis
git clone git://git.bitsmanent.org/circo
Log | Files | Refs | README | LICENSE

commit 892d80298b59d998cddbd5c0ced8d964ae5d6cba
parent c2706198e6962487be8b185ba1bf4be0538a15d9
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sat, 22 Jul 2017 23:07:28 +0200

Add word deletion in command line.

Diffstat:
Mcirco.c | 21+++++++++++++++++++++
Mconfig.def.h | 1+
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/circo.c b/circo.c @@ -85,6 +85,7 @@ void cmd_server(char *cmd, char *s); void cmdln_chdel(const Arg *arg); void cmdln_clear(const Arg *arg); void cmdln_cursor(const Arg *arg); +void cmdln_wdel(const Arg *arg); void detach(Buffer *b); int dial(char *host, char *port); void die(const char *errstr, ...); @@ -284,6 +285,26 @@ cmdln_cursor(const Arg *arg) { drawcmdln(); } +void +cmdln_wdel(const Arg *arg) { + int i; + + if(!sel->cmdoff) + return; + i = sel->cmdoff; + while(i && sel->cmd[i] != ' ') + --i; + while(i && sel->cmd[i] == ' ') + --i; + if(i) + ++i; + drawbuf(); + memmove(&sel->cmd[i], &sel->cmd[sel->cmdoff], sel->cmdlen - sel->cmdoff); + sel->cmdlen -= sel->cmdoff - i; + sel->cmd[sel->cmdlen] = '\0'; + sel->cmdoff = i; + drawcmdln(); +} void detach(Buffer *b) { diff --git a/config.def.h b/config.def.h @@ -13,6 +13,7 @@ static Key keys[] = { /* key function argument */ { CTRL('u'), cmdln_clear, {0} }, { KeyBackspace, cmdln_chdel, {.i = -1} }, + { CTRL('w'), cmdln_wdel, {0} }, { CTRL('a'), cmdln_cursor, {.i = 0}}, { CTRL('e'), cmdln_cursor, {.i = 999}}, { CTRL('h'), cmdln_cursor, {.i = -1}},