slackline: ctrl+w: stop deleting when certain characters occur - lchat - A line oriented chat front end for ii.
 (HTM) git clone git://git.suckless.org/lchat
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
       ---
 (DIR) commit 9778b6b675462220fa133aa7a13fe8e5d45be6d1
 (DIR) parent e413932d58bda64d7e9e34ca1e455d13bad17a3e
 (HTM) Author: Tom Schwindl <schwindl@posteo.de>
       Date:   Mon,  6 Feb 2023 15:42:58 +0100
       
       slackline: ctrl+w: stop deleting when certain characters occur
       
       Diffstat:
         M slackline.c                         |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/slackline.c b/slackline.c
       @@ -26,6 +26,9 @@
        #include "slackline.h"
        #include "util.h"
        
       +/* CTRL+W: stop erasing if certain characters are reached. */
       +#define IS_WORD_BREAK "\f\n\r\t\v (){}[]\\/#,.=-+|%$!@^&*"
       +
        struct slackline *
        sl_init(void)
        {
       @@ -165,9 +168,9 @@ sl_default(struct slackline *sl, int key)
                        sl_reset(sl);
                        break;
                case CTRL_W: /* erase previous word */
       -                while (sl->rcur != 0 && isspace((unsigned char) *(sl->ptr-1)))
       +                while (sl->rcur != 0 && strchr(IS_WORD_BREAK, *(sl->ptr-1)) != NULL)
                                sl_backspace(sl);
       -                while (sl->rcur != 0 && !isspace((unsigned char) *(sl->ptr-1)))
       +                while (sl->rcur != 0 && strchr(IS_WORD_BREAK, *(sl->ptr-1)) == NULL)
                                sl_backspace(sl);
                        break;
                case BACKSPACE: