Introduction
Introduction Statistics Contact Development Disclaimer Help
slackline: ctrl+w: stop deleting when certain characters occur - lchat - A line…
git clone git://git.suckless.org/lchat
Log
Files
Refs
README
---
commit 9778b6b675462220fa133aa7a13fe8e5d45be6d1
parent e413932d58bda64d7e9e34ca1e455d13bad17a3e
Author: Tom Schwindl <[email protected]>
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(-)
---
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)) !=…
sl_backspace(sl);
- while (sl->rcur != 0 && !isspace((unsigned char) *(sl->ptr-1)))
+ while (sl->rcur != 0 && strchr(IS_WORD_BREAK, *(sl->ptr-1)) ==…
sl_backspace(sl);
break;
case BACKSPACE:
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.