tweaks: rename another function, to remove the obscuring abbreviation

master
Benno Schulenberg 2020-03-12 12:38:01 +01:00
parent 8003842e5c
commit f6dedf3598
5 changed files with 16 additions and 17 deletions

View File

@ -122,10 +122,9 @@ bool is_punct_mbchar(const char *c)
return ispunct((unsigned char)*c);
}
/* Return TRUE when the given multibyte character c is a word-forming
* character (that is: alphanumeric, or specified in wordchars, or
* punctuation when allow_punct is TRUE), and FALSE otherwise. */
bool is_word_mbchar(const char *c, bool allow_punct)
/* Return TRUE when the given character is word-forming (it is alphanumeric or
* specified in 'wordchars', or it is punctuation when allow_punct is TRUE). */
bool is_word_char(const char *c, bool allow_punct)
{
if (*c == '\0')
return FALSE;

View File

@ -281,7 +281,7 @@ void do_prev_word(bool allow_punct)
openfile->current_x = step_left(openfile->current->data,
openfile->current_x);
if (is_word_mbchar(openfile->current->data + openfile->current_x,
if (is_word_char(openfile->current->data + openfile->current_x,
allow_punct)) {
seen_a_word = TRUE;
/* If at the head of a line now, this surely is a word start. */
@ -305,7 +305,7 @@ void do_prev_word(bool allow_punct)
* part of a word. Return TRUE if we started on a word, and FALSE otherwise. */
bool do_next_word(bool after_ends, bool allow_punct)
{
bool started_on_word = is_word_mbchar(openfile->current->data +
bool started_on_word = is_word_char(openfile->current->data +
openfile->current_x, allow_punct);
bool seen_space = !started_on_word;
#ifndef NANO_TINY
@ -332,7 +332,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
if (after_ends) {
/* If this is a word character, continue; else it's a separator,
* and if we've already seen a word, then it's a word end. */
if (is_word_mbchar(openfile->current->data + openfile->current_x,
if (is_word_char(openfile->current->data + openfile->current_x,
allow_punct))
seen_word = TRUE;
else if (seen_word)
@ -342,7 +342,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
{
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(openfile->current->data + openfile->current_x,
if (!is_word_char(openfile->current->data + openfile->current_x,
allow_punct))
seen_space = TRUE;
else if (seen_space)

View File

@ -44,7 +44,7 @@ void do_statusbar_end(void)
/* Move to the next word in the answer. */
void do_statusbar_next_word(void)
{
bool seen_space = !is_word_mbchar(answer + typing_x, FALSE);
bool seen_space = !is_word_char(answer + typing_x, FALSE);
bool seen_word = !seen_space;
/* Move forward until we reach either the end or the start of a word,
@ -55,14 +55,14 @@ void do_statusbar_next_word(void)
if (ISSET(AFTER_ENDS)) {
/* If this is a word character, continue; else it's a separator,
* and if we've already seen a word, then it's a word end. */
if (is_word_mbchar(answer + typing_x, FALSE))
if (is_word_char(answer + typing_x, FALSE))
seen_word = TRUE;
else if (seen_word)
break;
} else {
/* If this is not a word character, then it's a separator; else
* if we've already seen a separator, then it's a word start. */
if (!is_word_mbchar(answer + typing_x, FALSE))
if (!is_word_char(answer + typing_x, FALSE))
seen_space = TRUE;
else if (seen_space)
break;
@ -79,7 +79,7 @@ void do_statusbar_prev_word(void)
while (typing_x != 0) {
typing_x = step_left(answer, typing_x);
if (is_word_mbchar(answer + typing_x, FALSE))
if (is_word_char(answer + typing_x, FALSE))
seen_a_word = TRUE;
else if (seen_a_word) {
/* This is space now: we've overshot the start of the word. */

View File

@ -206,7 +206,7 @@ bool using_utf8(void);
bool is_alpha_mbchar(const char *c);
bool is_blank_char(const char *c);
bool is_cntrl_mbchar(const char *c);
bool is_word_mbchar(const char *c, bool allow_punct);
bool is_word_char(const char *c, bool allow_punct);
char control_mbrep(const char *c, bool isdata);
#ifdef ENABLE_UTF8
int mbwidth(const char *c);

View File

@ -2996,7 +2996,7 @@ char *copy_completion(char *text)
size_t length = 0, index = 0;
/* Find the end of the candidate word to get its length. */
while (is_word_mbchar(&text[length], FALSE))
while (is_word_char(&text[length], FALSE))
length = step_right(text, length);
/* Now copy this candidate to a new string. */
@ -3051,7 +3051,7 @@ void complete_a_word(void)
while (start_of_shard > 0) {
size_t oneleft = step_left(openfile->current->data, start_of_shard);
if (!is_word_mbchar(&openfile->current->data[oneleft], FALSE))
if (!is_word_char(&openfile->current->data[oneleft], FALSE))
break;
start_of_shard = oneleft;
}
@ -3092,11 +3092,11 @@ void complete_a_word(void)
continue;
/* If the found match is not /longer/ than shard, skip it. */
if (!is_word_mbchar(&pletion_line->data[i + j], FALSE))
if (!is_word_char(&pletion_line->data[i + j], FALSE))
continue;
/* If the match is not a separate word, skip it. */
if (i > 0 && is_word_mbchar(&pletion_line->data[
if (i > 0 && is_word_char(&pletion_line->data[
step_left(pletion_line->data, i)], FALSE))
continue;