circo

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

commit c780048a9579191b563888eeea100eeb7ba20cda
parent d76a14d0c4c173e30709f24cc6f38fef0d7da155
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Sun, 23 Jul 2017 19:27:25 +0200

Fix cmdln_chrdel(): now works like vi x command.

Diffstat:
Mcirco.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/circo.c b/circo.c @@ -74,6 +74,7 @@ typedef struct { const Arg arg; } Key; +/* function declarations */ void attach(Buffer *b); int bufl2o(char *buf, int len, int line); int bufnl(char *buf, int len); @@ -286,13 +287,18 @@ cmdln_chldel(const Arg *arg) { void cmdln_chrdel(const Arg *arg) { - if(!sel->cmdoff) + if(!sel->cmdlen) return; - if(sel->cmdoff >= sel->cmdlen) + if(sel->cmdoff == sel->cmdlen) { + --sel->cmdoff; + drawcmdln(); return; + } memmove(&sel->cmd[sel->cmdoff], &sel->cmd[sel->cmdoff + 1], sel->cmdlen - sel->cmdoff - 1); sel->cmd[--sel->cmdlen] = '\0'; + if(sel->cmdoff && sel->cmdoff == sel->cmdlen) + --sel->cmdoff; drawcmdln(); }