tweaks: rename four parameters, to be more distinct and telling
Этот коммит содержится в:
родитель
78767b583d
Коммит
75f4309c1f
14
src/nano.c
14
src/nano.c
@ -1635,8 +1635,8 @@ void process_a_keystroke(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The user typed output_len multibyte characters. Add them to the buffer. */
|
||||
void inject(char *output, size_t output_len)
|
||||
/* Insert the given short burst of bytes into the edit buffer. */
|
||||
void inject(char *burst, size_t count)
|
||||
{
|
||||
size_t current_len = strlen(openfile->current->data);
|
||||
size_t index = 0;
|
||||
@ -1651,12 +1651,12 @@ void inject(char *output, size_t output_len)
|
||||
}
|
||||
#endif
|
||||
|
||||
while (index < output_len) {
|
||||
while (index < count) {
|
||||
/* Encode an embedded NUL byte as 0x0A. */
|
||||
if (output[index] == '\0')
|
||||
output[index] = '\n';
|
||||
if (burst[index] == '\0')
|
||||
burst[index] = '\n';
|
||||
|
||||
charlen = char_length(output + index);
|
||||
charlen = char_length(burst + index);
|
||||
|
||||
/* Make room for the new character and copy it into the line. */
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
@ -1665,7 +1665,7 @@ void inject(char *output, size_t output_len)
|
||||
openfile->current->data + openfile->current_x,
|
||||
current_len - openfile->current_x + 1);
|
||||
strncpy(openfile->current->data + openfile->current_x,
|
||||
output + index, charlen);
|
||||
burst + index, charlen);
|
||||
|
||||
current_len += charlen;
|
||||
index += charlen;
|
||||
|
14
src/prompt.c
14
src/prompt.c
@ -173,23 +173,23 @@ int do_statusbar_input(bool *finished)
|
||||
return input;
|
||||
}
|
||||
|
||||
/* The user typed input_len multibyte characters. Add them to the answer. */
|
||||
void inject_into_answer(char *output, size_t input_len)
|
||||
/* Insert the given short burst of bytes into the anwer. */
|
||||
void inject_into_answer(char *burst, size_t count)
|
||||
{
|
||||
size_t charlen, index = 0;
|
||||
|
||||
while (index < input_len) {
|
||||
while (index < count) {
|
||||
/* Encode any NUL byte as 0x0A. */
|
||||
if (output[index] == '\0')
|
||||
output[index] = '\n';
|
||||
if (burst[index] == '\0')
|
||||
burst[index] = '\n';
|
||||
|
||||
charlen = char_length(output + index);
|
||||
charlen = char_length(burst + index);
|
||||
|
||||
/* Insert the typed character into the existing answer string. */
|
||||
answer = charealloc(answer, strlen(answer) + charlen + 1);
|
||||
memmove(answer + typing_x + charlen, answer + typing_x,
|
||||
strlen(answer) - typing_x + 1);
|
||||
strncpy(answer + typing_x, output + index, charlen);
|
||||
strncpy(answer + typing_x, burst + index, charlen);
|
||||
|
||||
typing_x += charlen;
|
||||
index += charlen;
|
||||
|
@ -442,10 +442,10 @@ void confirm_margin(void);
|
||||
#endif
|
||||
void unbound_key(int code);
|
||||
bool okay_for_view(const keystruct *shortcut);
|
||||
void inject(char *output, size_t output_len);
|
||||
void inject(char *burst, size_t count);
|
||||
|
||||
/* Most functions in prompt.c. */
|
||||
void inject_into_answer(char *output, size_t input_len);
|
||||
void inject_into_answer(char *burst, size_t count);
|
||||
void do_statusbar_home(void);
|
||||
void do_statusbar_end(void);
|
||||
void do_statusbar_left(void);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user