[hackers] [lchat] move the ctrl+l handling from slackline to lchat || Tom Schwindl
commit 2222d76e1a740862f8ba5da876910876abb0a50a
Author: Tom Schwindl <schwindl_AT_posteo.de>
AuthorDate: Tue Sep 20 13:56:38 2022 +0200
Commit: Jan Klemkow <j.klemkow_AT_wemelug.de>
CommitDate: Tue Sep 20 17:13:11 2022 +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.
diff --git a/lchat.c b/lchat.c
index b949924..9f505f1 100644
--- a/lchat.c
+++ b/lchat.c
_AT_@ -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
index aaefeb2..0dc1f8e 100644
--- a/slackline.c
+++ b/slackline.c
_AT_@ -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);
Received on Tue Sep 20 2022 - 17:13:43 CEST
This archive was generated by hypermail 2.3.0
: Tue Sep 20 2022 - 17:24:37 CEST