lchat

A line oriented chat front end for ii.
git clone git://git.suckless.org/lchat
Log | Files | Refs | README

commit 320279ad1931fc570906ef39c4c5a2412a6bf8b7
parent 39db12aeca439ddb465b127e0b19a8e451cf101b
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Sun, 10 Jul 2016 02:15:11 +0200

add delete handling

Diffstat:
Mslackline.c | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/slackline.c b/slackline.c @@ -143,6 +143,20 @@ sl_keystroke(struct slackline *sl, int key) sl->bcur = sl_postobyte(sl, sl->rcur); sl->ptr = sl->buf + sl->bcur; break; + case 'P': /* delete */ + if (sl->rcur == sl->rlen) + break; + + char *ncur = sl_postoptr(sl, sl->rcur + 1); + + memmove(sl->ptr, ncur, sl->last - ncur); + + sl->rlen--; + sl->blen = sl_postobyte(sl, sl->rlen); + + sl->last -= ncur - sl->ptr; + *sl->last = '\0'; + break; } sl->esc = ESC_NONE; return 0;