tweaks: move a general function to a better place

This commit is contained in:
Benno Schulenberg 2019-08-09 19:24:30 +02:00
parent 94c9defde1
commit 0c63b50fdc
3 changed files with 10 additions and 10 deletions

View File

@ -602,6 +602,15 @@ bool has_blank_char(const char *string)
}
#endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */
/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *string)
{
while (*string != '\0' && (is_blank_mbchar(string) || *string == '\r'))
string += char_length(string);
return !*string;
}
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
bool is_valid_unicode(wchar_t wc)

View File

@ -235,6 +235,7 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
bool has_blank_char(const char *s);
#endif
bool white_string(const char *s);
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
@ -508,7 +509,6 @@ void do_tab(void);
void do_indent(void);
void do_unindent(void);
#endif
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
void do_comment(void);
#endif

View File

@ -297,15 +297,6 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
}
#endif /* !NANO_TINY */
/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *s)
{
while (*s != '\0' && (is_blank_mbchar(s) || *s == '\r'))
s += char_length(s);
return !*s;
}
#ifdef ENABLE_COMMENT
/* Test whether the given line can be uncommented, or add or remove a comment,
* depending on action. Return TRUE if the line is uncommentable, or when