From a05180ed2debccc79e8b479660095136fee3160d Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 8 May 2017 19:15:51 +0200 Subject: [PATCH] tweaks: transform the token DISABLE_TABCOMP to ENABLE_TABCOMP --- configure.ac | 14 +++++++++----- src/files.c | 6 +++--- src/nano.c | 4 ++-- src/prompt.c | 12 ++++++------ src/proto.h | 6 +++--- src/search.c | 4 ++-- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 66fcd61f..8d124afc 100644 --- a/configure.ac +++ b/configure.ac @@ -213,8 +213,15 @@ fi AC_ARG_ENABLE(tabcomp, AS_HELP_STRING([--disable-tabcomp], [Disable the tab-completion functions])) -if test "x$enable_tabcomp" = xno; then - AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for filenames and search strings.]) +if test "x$enable_tiny" = xyes; then + if test "x$enable_tabcomp" != xyes; then + enable_tabcomp=no + fi +fi +if test "x$disable_tabcomp" != xyes; then + if test "x$enable_tabcomp" != xno; then + AC_DEFINE(ENABLE_TABCOMP, 1, [Define this to have tab completion for filenames and search strings.]) + fi fi AC_ARG_ENABLE(wordcomp, @@ -285,9 +292,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_tabcomp" != xyes; then - AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab-completion functions for files and search strings.]) - fi if test "x$enable_wrapping" != xyes; then AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.]) fi diff --git a/src/files.c b/src/files.c index 57784114..30ad3650 100644 --- a/src/files.c +++ b/src/files.c @@ -2385,7 +2385,7 @@ char *real_dir_from_tilde(const char *buf) return retval; } -#if !defined(DISABLE_TABCOMP) || defined(ENABLE_BROWSER) +#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER) /* Our sort routine for file listings. Sort alphabetically and * case-insensitively, and sort directories before filenames. */ int diralphasort(const void *va, const void *vb) @@ -2422,7 +2422,7 @@ void free_chararray(char **array, size_t len) } #endif -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP /* Is the given path a directory? */ bool is_dir(const char *buf) { @@ -2746,7 +2746,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, return buf; } -#endif /* !DISABLE_TABCOMP */ +#endif /* ENABLE_TABCOMP */ /* Return the filename part of the given path. */ const char *tail(const char *path) diff --git a/src/nano.c b/src/nano.c index 13a8ba22..31652db0 100644 --- a/src/nano.c +++ b/src/nano.c @@ -955,7 +955,7 @@ void version(void) #ifndef DISABLE_SPELLER printf(" --enable-speller"); #endif -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP printf(" --enable-tabcomp"); #endif #ifndef DISABLE_WRAPPING @@ -1004,7 +1004,7 @@ void version(void) #ifdef DISABLE_SPELLER printf(" --disable-speller"); #endif -#ifdef DISABLE_TABCOMP +#ifndef ENABLE_TABCOMP printf(" --disable-tabcomp"); #endif #ifndef ENABLE_WORDCOMPLETION diff --git a/src/prompt.c b/src/prompt.c index 62c0702a..c7c2b09e 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -431,7 +431,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, int kbinput = ERR; bool ran_func, finished; functionptrtype func; -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP bool tabbed = FALSE; /* Whether we've pressed Tab. */ #endif @@ -441,7 +441,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, char *magichistory = NULL; /* The temporary string typed at the bottom of the history, if * any. */ -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP int last_kbinput = ERR; /* The key we pressed before the current key. */ size_t complete_len = 0; @@ -482,7 +482,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, if (func == do_cancel || func == do_enter) break; -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP if (func != do_tab) tabbed = FALSE; @@ -503,7 +503,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, answer = input_tab(answer, allow_files, &statusbar_x, &tabbed, refresh_func, listed); } else -#endif /* !DISABLE_TABCOMP */ +#endif /* ENABLE_TABCOMP */ #ifndef DISABLE_HISTORIES if (func == get_history_older_void) { if (history_list != NULL) { @@ -567,7 +567,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs, update_the_statusbar(); -#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP) +#if !defined(DISABLE_HISTORIES) && defined(ENABLE_TABCOMP) last_kbinput = kbinput; #endif } @@ -658,7 +658,7 @@ int do_prompt(bool allow_tabs, bool allow_files, fprintf(stderr, "answer = \"%s\"\n", answer); #endif -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP /* If we've done tab completion, there might still be a list of * filename matches on the edit window. Clear them off. */ if (listed) diff --git a/src/proto.h b/src/proto.h index 046df5c4..e1ae70ff 100644 --- a/src/proto.h +++ b/src/proto.h @@ -304,11 +304,11 @@ void do_writeout_void(void); void do_savefile(void); #endif char *real_dir_from_tilde(const char *buf); -#if !defined(DISABLE_TABCOMP) || defined(ENABLE_BROWSER) +#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER) int diralphasort(const void *va, const void *vb); void free_chararray(char **array, size_t len); #endif -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP char *input_tab(char *buf, bool allow_files, size_t *place, bool *lastwastab, void (*refresh_func)(void), bool *listed); #endif @@ -496,7 +496,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, void do_gotolinecolumn_void(void); #ifndef NANO_TINY void do_find_bracket(void); -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP char *get_history_completion(filestruct **h, char *s, size_t len); #endif #endif diff --git a/src/search.c b/src/search.c index c7c82065..14e8d05a 100644 --- a/src/search.c +++ b/src/search.c @@ -1224,7 +1224,7 @@ void get_history_older_void(void) ; } -#ifndef DISABLE_TABCOMP +#ifdef ENABLE_TABCOMP /* Move h to the next string that's a tab completion of the string s, * looking at only the first len characters of s, and return that * string. If there isn't one, or if len is 0, don't move h and return @@ -1277,5 +1277,5 @@ char *get_history_completion(filestruct **h, char *s, size_t len) * match, or len is 0. Return s. */ return (char *)s; } -#endif /* !DISABLE_TABCOMP */ +#endif /* ENSABLE_TABCOMP */ #endif /* !DISABLE_HISTORIES */