tweaks: transform the token DISABLE_WRAPPING to ENABLE_WRAPPING

This commit is contained in:
Benno Schulenberg 2017-10-29 21:00:09 +01:00
parent 87da3ecbe0
commit a5974bd1ec
7 changed files with 34 additions and 32 deletions

View File

@ -234,8 +234,13 @@ fi
AC_ARG_ENABLE(wrapping,
AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text]))
if test "x$enable_wrapping" = xno; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all hard text wrapping.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_wrapping" != xyes; then
enable_wrapping=no
fi
fi
if test "x$enable_wrapping" != xno; then
AC_DEFINE(ENABLE_WRAPPING, 1, [Define this to have hard text wrapping.])
fi
AC_ARG_ENABLE(wrapping-as-root,
@ -279,9 +284,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_speller" != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
fi
if test "x$enable_wrapping" != xyes; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
fi
fi
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)

View File

@ -1252,7 +1252,7 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "M-H", 0, do_toggle_void, SMART_HOME);
add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT);
add_to_sclist(MMAIN, "M-K", 0, do_toggle_void, CUT_FROM_CURSOR);
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP);
#endif
add_to_sclist(MMAIN, "M-Q", 0, do_toggle_void, TABS_TO_SPACES);
@ -1687,7 +1687,7 @@ sc *strtosc(const char *input)
s->toggle = AUTOINDENT;
else if (!strcasecmp(input, "cuttoend"))
s->toggle = CUT_FROM_CURSOR;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
else if (!strcasecmp(input, "nowrap"))
s->toggle = NO_WRAP;
#endif

View File

@ -899,7 +899,7 @@ void usage(void)
print_opt("-u", "--unix", N_("Save a file by default in Unix format"));
#endif
print_opt("-v", "--view", N_("View mode (read-only)"));
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines"));
#endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
@ -969,7 +969,7 @@ void version(void)
#ifdef ENABLE_TABCOMP
printf(" --enable-tabcomp");
#endif
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
printf(" --enable-wrapping");
#endif
#else /* !NANO_TINY */
@ -1021,7 +1021,7 @@ void version(void)
#ifndef ENABLE_WORDCOMPLETION
printf(" --disable-wordcomp");
#endif
#ifdef DISABLE_WRAPPING
#ifndef ENABLE_WRAPPING
printf(" --disable-wrapping");
#endif
#endif /* !NANO_TINY */
@ -1643,7 +1643,7 @@ int do_input(bool allow_funcs)
* all available characters in the input puddle. Note that this
* puddle will be empty if we're in view mode. */
if (have_shortcut || get_key_buffer_len() == 0) {
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* If we got a shortcut or toggle, and it's not the shortcut
* for verbatim input, turn off prepending of wrapped text. */
if (have_shortcut && s->scfunc != do_verbatim_input)
@ -1861,7 +1861,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
update_undo(ADD);
#endif
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */
if (!ISSET(NO_WRAP) && do_wrap(openfile->current))
refresh_needed = TRUE;
@ -1896,7 +1896,7 @@ int main(int argc, char **argv)
#ifndef DISABLE_WRAPJUSTIFY
bool fill_used = FALSE;
/* Was the fill option used on the command line? */
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
bool forced_wrapping = FALSE;
/* Should long lines be automatically hard wrapped? */
#endif
@ -1953,7 +1953,7 @@ int main(int argc, char **argv)
#endif
{"tempfile", 0, NULL, 't'},
{"view", 0, NULL, 'v'},
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
{"nowrap", 0, NULL, 'w'},
#endif
{"nohelp", 0, NULL, 'x'},
@ -2178,7 +2178,7 @@ int main(int argc, char **argv)
exit(1);
}
fill_used = TRUE;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
forced_wrapping = TRUE;
#endif
break;
@ -2199,7 +2199,7 @@ int main(int argc, char **argv)
case 'v':
SET(VIEW_MODE);
break;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
case 'w':
SET(NO_WRAP);
/* If both --fill and --nowrap are given on the
@ -2343,7 +2343,7 @@ int main(int argc, char **argv)
#endif
#endif /* ENABLE_NANORC */
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root)
* if --fill was given on the command line and not undone by --nowrap. */
if (forced_wrapping)

View File

@ -128,7 +128,7 @@
#undef ENABLE_MOUSE
#endif
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#if !defined(ENABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif
@ -165,7 +165,7 @@ typedef enum {
typedef enum {
ADD, DEL, BACK, CUT, CUT_TO_EOF, REPLACE,
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
SPLIT_BEGIN, SPLIT_END,
#endif
INDENT, UNINDENT,

View File

@ -547,7 +547,7 @@ void add_undo(undo_type action);
void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action);
#endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
#endif

View File

@ -60,7 +60,7 @@ static const rcoption rcopts[] = {
{"nohelp", NO_HELP},
{"nonewlines", NO_NEWLINES},
{"nopauses", NO_PAUSES},
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
{"nowrap", NO_WRAP},
#endif
#ifndef DISABLE_OPERATINGDIR

View File

@ -35,7 +35,7 @@ static pid_t pid = -1;
/* The PID of the forked process in execute_command(), for use
* with the cancel_command() signal handler. */
#endif
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
static bool prepend_wrap = FALSE;
/* Should we prepend wrapped text to the next line? */
#endif
@ -757,7 +757,7 @@ void do_undo(void)
f->data = data;
goto_line_posx(u->mark_begin_lineno, u->mark_begin_x);
break;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
case SPLIT_END:
goto_line_posx(u->lineno, u->begin);
openfile->current_undo = openfile->current_undo->next;
@ -941,7 +941,7 @@ void do_redo(void)
renumber(shoveline);
goto_line_posx(u->lineno + 1, u->mark_begin_x);
break;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
case SPLIT_BEGIN:
goto_line_posx(u->lineno, u->begin);
openfile->current_undo = u;
@ -1244,7 +1244,7 @@ void add_undo(undo_type action)
/* Allocate and initialize a new undo type. */
u = (undo *) nmalloc(sizeof(undo));
u->type = action;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
if (u->type == SPLIT_BEGIN) {
/* Some action, most likely an ADD, was performed that invoked
* do_wrap(). Rearrange the undo order so that this previous
@ -1303,7 +1303,7 @@ void add_undo(undo_type action)
}
action = u->type = JOIN;
break;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
case SPLIT_BEGIN:
action = openfile->undotop->type;
break;
@ -1507,7 +1507,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
u->strdata = mallocstrcpy(NULL, openfile->current->data);
u->mark_begin_x = openfile->current_x;
break;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
case SPLIT_BEGIN:
case SPLIT_END:
#endif
@ -1526,7 +1526,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
}
#endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* Unset the prepend_wrap flag. We need to do this as soon as we do
* something other than type text. */
void wrap_reset(void)
@ -1666,7 +1666,7 @@ bool do_wrap(filestruct *line)
return TRUE;
}
#endif /* !DISABLE_WRAPPING */
#endif /* ENABLE_WRAPPING */
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
/* We are trying to break a chunk off line. We find the last blank such
@ -3637,7 +3637,7 @@ void complete_a_word(void)
int start_of_shard, shard_length = 0;
int i = 0, j = 0;
completion_word *some_word;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
bool was_set_wrapping = !ISSET(NO_WRAP);
#endif
@ -3742,14 +3742,14 @@ void complete_a_word(void)
some_word->next = list_of_completions;
list_of_completions = some_word;
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* Temporarily disable wrapping so only one undo item is added. */
SET(NO_WRAP);
#endif
/* Inject the completion into the buffer. */
do_output(&completion[shard_length],
strlen(completion) - shard_length, FALSE);
#ifndef DISABLE_WRAPPING
#ifdef ENABLE_WRAPPING
/* If needed, reenable wrapping and wrap the current line. */
if (was_set_wrapping) {
UNSET(NO_WRAP);