From 916a3d94517bd227aa48936dc19e7a44fc17dfea Mon Sep 17 00:00:00 2001 From: Christian Storm Date: Sun, 8 Feb 2015 12:15:01 +0100 Subject: [PATCH] Bind ^L to own clear method to retain ui elements When using readline's standard ^L binding, the screen is completely cleared, including status and title bar. By binding ^L to profanity's clear method, status and title bar are retained. --- src/ui/inputwin.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 6f043b31..328b92d6 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -86,6 +86,7 @@ static void _inp_write(char *line, int offset); static int _inp_rl_getc(FILE *stream); static void _inp_rl_linehandler(char *line); static int _inp_rl_tab_handler(int count, int key); +static int _inp_rl_clear_handler(int count, int key); static int _inp_rl_win1_handler(int count, int key); static int _inp_rl_win2_handler(int count, int key); static int _inp_rl_win3_handler(int count, int key); @@ -384,6 +385,7 @@ _inp_rl_startup_hook(void) rl_bind_keyseq("\\e[6~", _inp_rl_pagedown_handler); rl_bind_key('\t', _inp_rl_tab_handler); + rl_bind_key(CTRL('L'), _inp_rl_clear_handler); return 0; } @@ -409,6 +411,13 @@ _inp_rl_getc(FILE *stream) return ch; } +static int +_inp_rl_clear_handler(int count, int key) +{ + ui_clear_current(); + return 0; +} + static int _inp_rl_tab_handler(int count, int key) {