src/move.c (do_prev_word, do_next_word): Sort these in standard way.
* src/prompt.c (do_statusbar_output): Don't move too many bytes.
This fixes Savannah bug #47219 (uncovered by r5655).
+ * src/prompt.c (do_statusbar_output): Elide a variable.
2016-02-21 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (input_tab): If the first Tab added the part that all
void do_statusbar_output(int *the_input, size_t input_len,
bool filtering, bool *got_enter)
{
- size_t answer_len, i;
char *output = charalloc(input_len + 1);
char *char_buf = charalloc(mb_cur_max());
- int char_buf_len;
+ int i, char_buf_len;
assert(answer != NULL);
output[i] = (char)the_input[i];
output[i] = '\0';
- answer_len = strlen(answer);
i = 0;
while (i < input_len) {
if (filtering && is_ascii_cntrl_char(*(output + i - char_buf_len)))
continue;
- /* More dangerousness fun. =) */
- answer = charealloc(answer, answer_len + char_buf_len + 1);
-
- assert(statusbar_x <= answer_len);
+ assert(statusbar_x <= strlen(answer));
+ /* Insert the typed character into the existing answer string. */
+ answer = charealloc(answer, strlen(answer) + char_buf_len + 1);
charmove(answer + statusbar_x + char_buf_len, answer + statusbar_x,
- answer_len - statusbar_x + 1);
+ strlen(answer) - statusbar_x + 1);
strncpy(answer + statusbar_x, char_buf, char_buf_len);
- answer_len += char_buf_len;
statusbar_x += char_buf_len;
}