about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorChristian Storm <Christian.Storm@tngtech.com>2015-02-08 12:15:01 +0100
committerChristian Storm <Christian.Storm@tngtech.com>2015-02-08 12:15:01 +0100
commit916a3d94517bd227aa48936dc19e7a44fc17dfea (patch)
treefc86fa0eb3ab019f67aecbd3e1f425dd3beb4f8f /src
parent129af0eafd7ccf2629e60f3cfb398a0f22492b63 (diff)
downloadprofani-tty-916a3d94517bd227aa48936dc19e7a44fc17dfea.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/ui/inputwin.c9
1 files changed, 9 insertions, 0 deletions
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;
 }
@@ -410,6 +412,13 @@ _inp_rl_getc(FILE *stream)
 }
 
 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)
 {
     if (rl_point != rl_end || !rl_line_buffer) {