tweaks: rename another function, to remove the obscuring abbreviation
parent
8003842e5c
commit
f6dedf3598
|
@ -122,10 +122,9 @@ bool is_punct_mbchar(const char *c)
|
||||||
return ispunct((unsigned char)*c);
|
return ispunct((unsigned char)*c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return TRUE when the given multibyte character c is a word-forming
|
/* Return TRUE when the given character is word-forming (it is alphanumeric or
|
||||||
* character (that is: alphanumeric, or specified in wordchars, or
|
* specified in 'wordchars', or it is punctuation when allow_punct is TRUE). */
|
||||||
* punctuation when allow_punct is TRUE), and FALSE otherwise. */
|
bool is_word_char(const char *c, bool allow_punct)
|
||||||
bool is_word_mbchar(const char *c, bool allow_punct)
|
|
||||||
{
|
{
|
||||||
if (*c == '\0')
|
if (*c == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -281,7 +281,7 @@ void do_prev_word(bool allow_punct)
|
||||||
openfile->current_x = step_left(openfile->current->data,
|
openfile->current_x = step_left(openfile->current->data,
|
||||||
openfile->current_x);
|
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)) {
|
allow_punct)) {
|
||||||
seen_a_word = TRUE;
|
seen_a_word = TRUE;
|
||||||
/* If at the head of a line now, this surely is a word start. */
|
/* 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. */
|
* 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 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);
|
openfile->current_x, allow_punct);
|
||||||
bool seen_space = !started_on_word;
|
bool seen_space = !started_on_word;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -332,7 +332,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
|
||||||
if (after_ends) {
|
if (after_ends) {
|
||||||
/* If this is a word character, continue; else it's a separator,
|
/* 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. */
|
* 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))
|
allow_punct))
|
||||||
seen_word = TRUE;
|
seen_word = TRUE;
|
||||||
else if (seen_word)
|
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 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 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))
|
allow_punct))
|
||||||
seen_space = TRUE;
|
seen_space = TRUE;
|
||||||
else if (seen_space)
|
else if (seen_space)
|
||||||
|
|
|
@ -44,7 +44,7 @@ void do_statusbar_end(void)
|
||||||
/* Move to the next word in the answer. */
|
/* Move to the next word in the answer. */
|
||||||
void do_statusbar_next_word(void)
|
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;
|
bool seen_word = !seen_space;
|
||||||
|
|
||||||
/* Move forward until we reach either the end or the start of a word,
|
/* 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 (ISSET(AFTER_ENDS)) {
|
||||||
/* If this is a word character, continue; else it's a separator,
|
/* 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. */
|
* 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;
|
seen_word = TRUE;
|
||||||
else if (seen_word)
|
else if (seen_word)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* If this is not a word character, then it's a separator; 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 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;
|
seen_space = TRUE;
|
||||||
else if (seen_space)
|
else if (seen_space)
|
||||||
break;
|
break;
|
||||||
|
@ -79,7 +79,7 @@ void do_statusbar_prev_word(void)
|
||||||
while (typing_x != 0) {
|
while (typing_x != 0) {
|
||||||
typing_x = step_left(answer, typing_x);
|
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;
|
seen_a_word = TRUE;
|
||||||
else if (seen_a_word) {
|
else if (seen_a_word) {
|
||||||
/* This is space now: we've overshot the start of the word. */
|
/* This is space now: we've overshot the start of the word. */
|
||||||
|
|
|
@ -206,7 +206,7 @@ bool using_utf8(void);
|
||||||
bool is_alpha_mbchar(const char *c);
|
bool is_alpha_mbchar(const char *c);
|
||||||
bool is_blank_char(const char *c);
|
bool is_blank_char(const char *c);
|
||||||
bool is_cntrl_mbchar(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);
|
char control_mbrep(const char *c, bool isdata);
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
int mbwidth(const char *c);
|
int mbwidth(const char *c);
|
||||||
|
|
|
@ -2996,7 +2996,7 @@ char *copy_completion(char *text)
|
||||||
size_t length = 0, index = 0;
|
size_t length = 0, index = 0;
|
||||||
|
|
||||||
/* Find the end of the candidate word to get its length. */
|
/* 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);
|
length = step_right(text, length);
|
||||||
|
|
||||||
/* Now copy this candidate to a new string. */
|
/* Now copy this candidate to a new string. */
|
||||||
|
@ -3051,7 +3051,7 @@ void complete_a_word(void)
|
||||||
while (start_of_shard > 0) {
|
while (start_of_shard > 0) {
|
||||||
size_t oneleft = step_left(openfile->current->data, start_of_shard);
|
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;
|
break;
|
||||||
start_of_shard = oneleft;
|
start_of_shard = oneleft;
|
||||||
}
|
}
|
||||||
|
@ -3092,11 +3092,11 @@ void complete_a_word(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If the found match is not /longer/ than shard, skip it. */
|
/* 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;
|
continue;
|
||||||
|
|
||||||
/* If the match is not a separate word, skip it. */
|
/* 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))
|
step_left(pletion_line->data, i)], FALSE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue