From 89bb93733a16041062fa1522a18fc9d23f7caf07 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sat, 29 May 2004 16:47:52 +0000 Subject: [PATCH] a few last cosmetic reorderings and fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1784 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/global.c | 11 ++++++----- src/nano.c | 2 +- src/proto.h | 7 ++++--- src/rcfile.c | 29 ++++++++++++++++------------- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/global.c b/src/global.c index 9b0334b5..be8ce563 100644 --- a/src/global.c +++ b/src/global.c @@ -66,6 +66,12 @@ filestruct *cutbuffer = NULL; /* A place to store cut text */ openfilestruct *open_files = NULL; /* The list of open files */ #endif +#if !defined(NANO_SMALL) && defined(ENABLE_NANORC) +char *whitespace = NULL; /* Characters used when displaying + the first characters of tabs and + spaces. */ +#endif + #ifndef DISABLE_JUSTIFY char *punct = NULL; /* Closing punctuation that can end sentences. */ @@ -78,11 +84,6 @@ char *quotestr = NULL; /* Quote string. The default value is #ifndef NANO_SMALL char *backup_dir = NULL; /* Backup directory. */ -#ifdef ENABLE_NANORC -char *whitespace = NULL; /* Characters used when displaying - the first characters of tabs and - spaces. */ -#endif #endif int resetstatuspos; /* Hack for resetting the status bar diff --git a/src/nano.c b/src/nano.c index e8addff0..99c0a2fe 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1283,7 +1283,7 @@ int do_wrap(filestruct *inptr) * create the new wrap line. Finally, we clean up. */ /* Step 1, finding where to wrap. We are going to add a new-line - * after a white-space character. In this step, we set wrap_loc as the + * after a whitespace character. In this step, we set wrap_loc as the * location of this replacement. * * Where should we break the line? We need the last "legal wrap point" diff --git a/src/proto.h b/src/proto.h index e38ae641..68565c0d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -46,6 +46,10 @@ extern int search_last_line; extern int search_offscreen; extern int currslen; +#if !defined(NANO_SMALL) && defined(ENABLE_NANORC) +extern char *whitespace; +#endif + #ifndef DISABLE_JUSTIFY extern char *punct; extern char *brackets; @@ -54,9 +58,6 @@ extern char *quotestr; #ifndef NANO_SMALL extern char *backup_dir; -#ifdef ENABLE_NANORC -extern char *whitespace; -#endif #endif extern WINDOW *topwin, *edit, *bottomwin; diff --git a/src/rcfile.c b/src/rcfile.c index 0dbad5fb..fa99dcee 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -548,6 +548,9 @@ void parse_rcfile(FILE *rcstream) #ifndef DISABLE_WRAPJUSTIFY || !strcasecmp(rcopts[i].name, "fill") #endif +#ifndef NANO_SMALL + || !strcasecmp(rcopts[i].name, "whitespace") +#endif #ifndef DISABLE_JUSTIFY || !strcasecmp(rcopts[i].name, "punct") || !strcasecmp(rcopts[i].name, "brackets") @@ -555,7 +558,6 @@ void parse_rcfile(FILE *rcstream) #endif #ifndef NANO_SMALL || !strcasecmp(rcopts[i].name, "backupdir") - || !strcasecmp(rcopts[i].name, "whitespace") #endif #ifndef DISABLE_SPELLER || !strcasecmp(rcopts[i].name, "speller") @@ -594,6 +596,19 @@ void parse_rcfile(FILE *rcstream) wrap_at = j; } else #endif +#ifndef NANO_SMALL + if (!strcasecmp(rcopts[i].name, "whitespace")) { + size_t ws_len; + whitespace = mallocstrcpy(NULL, option); + ws_len = strlen(whitespace); + if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) { + rcfile_error(_("Two non-control characters required")); + free(whitespace); + whitespace = NULL; + } else + SET(WHITESPACE_DISPLAY); + } else +#endif #ifndef DISABLE_JUSTIFY if (!strcasecmp(rcopts[i].name, "punct")) { punct = mallocstrcpy(NULL, option); @@ -616,18 +631,6 @@ void parse_rcfile(FILE *rcstream) if (!strcasecmp(rcopts[i].name, "backupdir")) backup_dir = mallocstrcpy(NULL, option); else - - if (!strcasecmp(rcopts[i].name, "whitespace")) { - size_t ws_len; - whitespace = mallocstrcpy(NULL, option); - ws_len = strlen(whitespace); - if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) { - rcfile_error(_("Two non-control characters required")); - free(whitespace); - whitespace = NULL; - } else - SET(WHITESPACE_DISPLAY); - } else #endif #ifndef DISABLE_SPELLER if (!strcasecmp(rcopts[i].name, "speller")) -- 2.39.5