move the ctrl+l handling from slackline to lchat - lchat - A line oriented chat… | |
git clone git://git.suckless.org/lchat | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 2222d76e1a740862f8ba5da876910876abb0a50a | |
parent aa7afafc6710c68811bbc33d8b781edfa8c17109 | |
Author: Tom Schwindl <[email protected]> | |
Date: Tue, 20 Sep 2022 13:56:38 +0200 | |
move the ctrl+l handling from slackline to lchat | |
As Jan kindly pointed out to me, slackline is meant to just handle key presses. | |
Any printing should be done by the calling program. | |
Diffstat: | |
M lchat.c | 3 +++ | |
M slackline.c | 3 --- | |
2 files changed, 3 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/lchat.c b/lchat.c | |
@@ -355,6 +355,9 @@ main(int argc, char *argv[]) | |
} | |
sl_reset(sl); | |
break; | |
+ case 12: /* ctrl+l -- clear screen, same as clear(1) */ | |
+ fputs("\x1b[2J\x1b[H", stdout); | |
+ break; | |
default: | |
if (sl_keystroke(sl, c) == -1) | |
die("sl_keystroke"); | |
diff --git a/slackline.c b/slackline.c | |
@@ -231,9 +231,6 @@ sl_keystroke(struct slackline *sl, int key) | |
case 21: /* ctrl+u -- clearline */ | |
sl_reset(sl); | |
return 0; | |
- case 12: /* ctrl+l -- clear screen, same as clear(1) */ | |
- printf("\x1b[2J\x1b[H"); | |
- return 0; | |
case 23: /* ctrl+w -- erase previous word */ | |
while (sl->rcur != 0 && isspace((unsigned char) *(sl->ptr-1))) | |
sl_backspace(sl); |