diff options
Diffstat (limited to 'src/ui/inputwin.c')
-rw-r--r-- | src/ui/inputwin.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index e4da800b..654a4602 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -1,7 +1,7 @@ /* * inputwin.c * - * Copyright (C) 2012 - 2017 James Booth <boothj5@gmail.com> + * Copyright (C) 2012 - 2018 James Booth <boothj5@gmail.com> * * This file is part of Profanity. * @@ -87,7 +87,7 @@ static char *inp_line = NULL; static gboolean get_password = FALSE; static void _inp_win_update_virtual(void); -static int _inp_printable(const wint_t ch); +static int _inp_edited(const wint_t ch); static void _inp_win_handle_scroll(void); static int _inp_offset_to_col(char *str, int offset); static void _inp_write(char *line, int offset); @@ -251,7 +251,7 @@ inp_get_line(void) line = inp_readline(); ui_update(); } - status_bar_clear(); + status_bar_clear_prompt(); return line; } @@ -269,7 +269,7 @@ inp_get_password(void) ui_update(); } get_password = FALSE; - status_bar_clear(); + status_bar_clear_prompt(); return password; } @@ -301,8 +301,24 @@ _inp_write(char *line, int offset) } static int -_inp_printable(const wint_t ch) +_inp_edited(const wint_t ch) { + // backspace + if (ch == 127) { + return 1; + } + + // ctrl-w + if (ch == 23) { + return 1; + } + + // enter + if (ch == 13) { + return 1; + } + + // printable char bytes[MB_CUR_MAX+1]; size_t utf_len = wcrtomb(bytes, ch, (mbstate_t*)NULL); bytes[utf_len] = '\0'; @@ -472,7 +488,7 @@ _inp_rl_getc(FILE *stream) shift_tab = FALSE; - if (_inp_printable(ch)) { + if (_inp_edited(ch)) { ProfWin *window = wins_get_current(); cmd_ac_reset(window); } |