about summary refs log tree commit diff stats
path: root/src/ui/inputwin.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-01-31 00:20:25 +0000
committerJames Booth <boothj5@gmail.com>2015-01-31 00:20:25 +0000
commitf94b6ef0a213df2834ceece34036cf4c4990ba9a (patch)
tree276621305aadee040be79273b17c4070cae66518 /src/ui/inputwin.c
parent1cf5592b1fd59b4a9277a5c969403f717d50a7cc (diff)
downloadprofani-tty-f94b6ef0a213df2834ceece34036cf4c4990ba9a.tar.gz
Added idle and activity handlers
Diffstat (limited to 'src/ui/inputwin.c')
-rw-r--r--src/ui/inputwin.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 55bf8912..b736fca3 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -143,16 +143,6 @@ offset_to_col(char *str, int offset)
 }
 
 void
-inp_write(char *line, int offset)
-{
-    int col = offset_to_col(line, offset);
-    werase(inp_win);
-    waddstr(inp_win, line);
-    wmove(inp_win, 0, col);
-    _inp_win_update_virtual();
-}
-
-void
 inp_non_block(gint block_timeout)
 {
     wtimeout(inp_win, block_timeout);
@@ -164,6 +154,16 @@ inp_block(void)
     wtimeout(inp_win, -1);
 }
 
+void
+inp_write(char *line, int offset)
+{
+    int col = offset_to_col(line, offset);
+    werase(inp_win);
+    waddstr(inp_win, line);
+    wmove(inp_win, 0, col);
+    _inp_win_update_virtual();
+}
+
 gboolean
 inp_readline(void)
 {
@@ -177,7 +177,12 @@ inp_readline(void)
 
     if (FD_ISSET(fileno(rl_instream), &fds)) {
         rl_callback_read_char();
+        if (rl_line_buffer && rl_line_buffer[0] != '/') {
+            prof_handle_activity();
+        }
         inp_write(rl_line_buffer, rl_point);
+    } else {
+        prof_handle_idle();
     }
 
     p_rl_timeout.tv_sec = 0;