commit 2222d76e1a740862f8ba5da876910876abb0a50a
Author:     Tom Schwindl <[email protected]>
AuthorDate: Tue Sep 20 13:56:38 2022 +0200
Commit:     Jan Klemkow <[email protected]>
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
@@ -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
@@ -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);

Reply via email to