diff options
author | James Booth <boothj5@gmail.com> | 2015-02-10 19:30:18 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-02-10 19:30:18 +0000 |
commit | 6bee6cb0fbc7215091cbcbe9d146835a1a5405cb (patch) | |
tree | 87ae2bcf1e58e60bc40a2bc4c4cc2a6142ceaf0b /src/ui | |
parent | 5c9dd2802a6aefcaa67cbf03a65128b595b587c9 (diff) | |
download | profani-tty-6bee6cb0fbc7215091cbcbe9d146835a1a5405cb.tar.gz |
Free string on backspace
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/inputwin.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index b2d5e420..269d6fa7 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -611,17 +611,17 @@ _handle_backspace(void) } else if (inp_x > 0 && inp_x < display_size) { gchar *start = g_utf8_substring(input, 0, inp_x - 1); gchar *end = g_utf8_substring(input, inp_x, input_len_bytes); - GString *new = g_string_new(start); - g_string_append(new, end); + GString *new_str = g_string_new(start); + g_string_append(new_str, end); - for (input_len_bytes = 0; input_len_bytes < strlen(new->str); input_len_bytes++) { - input[input_len_bytes] = new->str[input_len_bytes]; + for (input_len_bytes = 0; input_len_bytes < strlen(new_str->str); input_len_bytes++) { + input[input_len_bytes] = new_str->str[input_len_bytes]; } input[input_len_bytes] = '\0'; g_free(start); g_free(end); - g_string_free(new, FALSE); + g_string_free(new_str, TRUE); _clear_input(); waddstr(inp_win, input); |