diff options
author | James Booth <boothj5@gmail.com> | 2013-01-05 22:02:30 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-05 22:02:30 +0000 |
commit | 54472ed5016adb2d87957599ddfff274f39da585 (patch) | |
tree | 9dd22203a6d4c89525198558309fe8fadaed3416 | |
parent | 1e4559637343ace8c0d52d3f5e08e9c4e53648b5 (diff) | |
download | profani-tty-54472ed5016adb2d87957599ddfff274f39da585.tar.gz |
Fixed command history
-rw-r--r-- | src/input_win.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/input_win.c b/src/input_win.c index b1249403..112d3253 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -251,7 +251,7 @@ inp_replace_input(char *input, const char * const new_input, int *size) { strcpy(input, new_input); *size = strlen(input); - _inp_clear_no_pad(); + inp_clear(); input[*size] = '\0'; wprintw(inp_win, input); } @@ -440,8 +440,12 @@ _handle_edit(const wint_t ch, char *input, int *size) prev = history_previous(input, size); if (prev) { inp_replace_input(input, prev, size); - pad_start = 0; - prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1); + display_size = g_utf8_strlen(input, *size); + wmove(inp_win, inp_y, display_size); + if (display_size > cols-2) { + pad_start = display_size - cols + 1; + prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1); + } } return 1; @@ -449,8 +453,12 @@ _handle_edit(const wint_t ch, char *input, int *size) next = history_next(input, size); if (next) { inp_replace_input(input, next, size); - pad_start = 0; - prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1); + display_size = g_utf8_strlen(input, *size); + wmove(inp_win, inp_y, display_size); + if (display_size > cols-2) { + pad_start = display_size - cols + 1; + prefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1); + } } return 1; |