nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 0c63b50fdc92cf88531f0ad460b8617995026d61
parent 94c9defde10219a73d74cc00d904ab8e6e1f5979
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  9 Aug 2019 19:24:30 +0200

tweaks: move a general function to a better place

Diffstat:
Msrc/chars.c | 9+++++++++
Msrc/proto.h | 2+-
Msrc/text.c | 9---------
3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/chars.c b/src/chars.c @@ -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) diff --git a/src/proto.h b/src/proto.h @@ -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 diff --git a/src/text.c b/src/text.c @@ -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