tweaks: move a general function to a better place
parent
94c9defde1
commit
0c63b50fdc
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue