tweaks: reduce two parameters to a single one by summing them

Also, rename the remaining parameter and rename a variable.
master
Benno Schulenberg 2019-01-06 17:50:53 +01:00
parent 0c42c51aa4
commit 0ae80ce362
1 changed files with 9 additions and 9 deletions

View File

@ -3042,19 +3042,19 @@ void do_verbatim_input(void)
#ifdef ENABLE_WORDCOMPLETION #ifdef ENABLE_WORDCOMPLETION
/* Return a copy of the found completion candidate. */ /* Return a copy of the found completion candidate. */
char *copy_completion(char *check_line, size_t start) char *copy_completion(char *text)
{ {
char *word; char *word;
size_t afterit = start, index = 0; size_t length = 0, index = 0;
/* Find the position where the candidate word ends. */ /* Find the end of the candidate word to get its length. */
while (is_word_mbchar(&check_line[afterit], FALSE)) while (is_word_mbchar(&text[length], FALSE))
afterit = move_mbright(check_line, afterit); length = move_mbright(text, length);
/* Now copy this candidate to a new string. */ /* Now copy this candidate to a new string. */
word = charalloc(afterit - start + 1); word = charalloc(length + 1);
while (start < afterit) while (index < length)
word[index++] = check_line[start++]; word[index++] = *(text++);
word[index] = '\0'; word[index] = '\0';
return word; return word;
@ -3156,7 +3156,7 @@ void complete_a_word(void)
i == openfile->current_x - shard_length) i == openfile->current_x - shard_length)
continue; continue;
completion = copy_completion(pletion_line->data, i); completion = copy_completion(pletion_line->data + i);
/* Look among earlier attempted completions for a duplicate. */ /* Look among earlier attempted completions for a duplicate. */
some_word = list_of_completions; some_word = list_of_completions;