for a backwards search in the refactored code, and enclose
dump_buffer() and dump_buffer_reverse() in one ENABLE_DEBUG
#ifdef instead of two.
+ - Convert memmove() function calls to charmove() macro calls, as
+ the former all work on char*'s. (DLR)
- files.c:
do_browser()
- Some of the Pico compatibility options in the file browser
/* Make the first cut line manually. */
tmp = copy_node(top);
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
- memmove(tmp->data, top->data + top_x, newsize);
+ charmove(tmp->data, top->data + top_x, newsize);
null_at(&tmp->data, newsize);
add_to_cutbuffer(tmp);
if (top == bot) {
/* In this case, the remainder line is shorter, so we must
move text from the end forward first. */
- memmove(top->data + top_x, bot->data + bot_x,
+ charmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
top->data = charealloc(top->data, newsize);
} else {
/* Here, the remainder line might get longer, so we
realloc() it first. */
top->data = charealloc(top->data, newsize);
- memmove(top->data + top_x, bot->data + bot_x,
+ charmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
}
}
size_t cur_len = strlen(current->data);
current->data = charealloc(current->data, cur_len + buf_len + 1);
- memmove(current->data + current_x + buf_len,
+ charmove(current->data + current_x + buf_len,
current->data + current_x, cur_len - current_x + 1);
strncpy(current->data + current_x, cutbuffer->data, buf_len);
/* Use strncpy() to not copy the terminal '\0'. */
/* more dangerousness fun =) */
current->data = charealloc(current->data, current_len + 2);
assert(current_x <= current_len);
- memmove(¤t->data[current_x + 1],
+ charmove(¤t->data[current_x + 1],
¤t->data[current_x],
current_len - current_x + 1);
current->data[current_x] = ch;
if (current_x != strlen(current->data)) {
/* Let's get dangerous */
- memmove(¤t->data[current_x], ¤t->data[current_x + 1],
+ charmove(¤t->data[current_x], ¤t->data[current_x + 1],
strlen(current->data) - current_x);
align(¤t->data);
current->next->data = charealloc(current->next->data,
next_line_len + line_len - break_pos + 1);
- memmove(current->next->data + indent_len + line_len - break_pos,
+ charmove(current->next->data + indent_len + line_len - break_pos,
current->next->data + indent_len,
next_line_len - indent_len + 1);
strcpy(current->next->data + indent_len,
totsize -= indent_len;
current_y--;
} else {
- memmove(current->next->data + indent_len,
+ charmove(current->next->data + indent_len,
current->next->data + indent_len + break_pos + 1,
next_line_len - break_pos - indent_len);
null_at(¤t->next->data,
break;
case NANO_DELETE_KEY:
if (x < xend) {
- memmove(answer + x, answer + x + 1, xend - x);
+ charmove(answer + x, answer + x + 1, xend - x);
xend--;
}
break;
break;
case NANO_BACKSPACE_KEY:
if (x > 0) {
- memmove(answer + x - 1, answer + x, xend - x + 1);
+ charmove(answer + x - 1, answer + x, xend - x + 1);
x--;
xend--;
}
if (kbinput < 32 || kbinput == 127)
break;
answer = charealloc(answer, xend + 2);
- memmove(answer + x + 1, answer + x, xend - x + 1);
+ charmove(answer + x + 1, answer + x, xend - x + 1);
xend++;
answer[x] = kbinput;
x++;