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, AC_ARG_ENABLE(wrapping,
AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text])) AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text]))
if test "x$enable_wrapping" = xno; then if test "x$enable_tiny" = xyes; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all hard text wrapping.]) 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 fi
AC_ARG_ENABLE(wrapping-as-root, AC_ARG_ENABLE(wrapping-as-root,
@ -279,9 +284,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_speller" != xyes; then if test "x$enable_speller" != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.]) AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
fi fi
if test "x$enable_wrapping" != xyes; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
fi
fi fi
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes) 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-H", 0, do_toggle_void, SMART_HOME);
add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT); add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT);
add_to_sclist(MMAIN, "M-K", 0, do_toggle_void, CUT_FROM_CURSOR); 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); add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP);
#endif #endif
add_to_sclist(MMAIN, "M-Q", 0, do_toggle_void, TABS_TO_SPACES); 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; s->toggle = AUTOINDENT;
else if (!strcasecmp(input, "cuttoend")) else if (!strcasecmp(input, "cuttoend"))
s->toggle = CUT_FROM_CURSOR; s->toggle = CUT_FROM_CURSOR;
#ifndef DISABLE_WRAPPING #ifdef ENABLE_WRAPPING
else if (!strcasecmp(input, "nowrap")) else if (!strcasecmp(input, "nowrap"))
s->toggle = NO_WRAP; s->toggle = NO_WRAP;
#endif #endif

View File

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

View File

@ -128,7 +128,7 @@
#undef ENABLE_MOUSE #undef ENABLE_MOUSE
#endif #endif
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY) #if !defined(ENABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1 #define DISABLE_WRAPJUSTIFY 1
#endif #endif
@ -165,7 +165,7 @@ typedef enum {
typedef enum { typedef enum {
ADD, DEL, BACK, CUT, CUT_TO_EOF, REPLACE, ADD, DEL, BACK, CUT, CUT_TO_EOF, REPLACE,
#ifndef DISABLE_WRAPPING #ifdef ENABLE_WRAPPING
SPLIT_BEGIN, SPLIT_END, SPLIT_BEGIN, SPLIT_END,
#endif #endif
INDENT, UNINDENT, 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_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action); void update_undo(undo_type action);
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING #ifdef ENABLE_WRAPPING
void wrap_reset(void); void wrap_reset(void);
bool do_wrap(filestruct *line); bool do_wrap(filestruct *line);
#endif #endif

View File

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