tweaks: rename a variable, and add a helping one
Этот коммит содержится в:
родитель
3c4a4b04ce
Коммит
8625609c2d
11
src/nano.c
11
src/nano.c
@ -1638,7 +1638,8 @@ void process_a_keystroke(void)
|
|||||||
/* Insert the given short burst of bytes into the edit buffer. */
|
/* Insert the given short burst of bytes into the edit buffer. */
|
||||||
void inject(char *burst, size_t count)
|
void inject(char *burst, size_t count)
|
||||||
{
|
{
|
||||||
size_t current_len = strlen(openfile->current->data);
|
size_t datalen = strlen(openfile->current->data);
|
||||||
|
char *thepoint = openfile->current->data + openfile->current_x;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
size_t original_row = 0, old_amount = 0;
|
size_t original_row = 0, old_amount = 0;
|
||||||
|
|
||||||
@ -1665,11 +1666,9 @@ void inject(char *burst, size_t count)
|
|||||||
|
|
||||||
/* Make room for the new bytes and copy them into the line. */
|
/* Make room for the new bytes and copy them into the line. */
|
||||||
openfile->current->data = charealloc(openfile->current->data,
|
openfile->current->data = charealloc(openfile->current->data,
|
||||||
current_len + count + 1);
|
datalen + count + 1);
|
||||||
memmove(openfile->current->data + openfile->current_x + count,
|
memmove(thepoint + count, thepoint, datalen - openfile->current_x + 1);
|
||||||
openfile->current->data + openfile->current_x,
|
strncpy(thepoint, burst, count);
|
||||||
current_len - openfile->current_x + 1);
|
|
||||||
strncpy(openfile->current->data + openfile->current_x, burst, count);
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* When the mark is to the right of the cursor, compensate its position. */
|
/* When the mark is to the right of the cursor, compensate its position. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user