diff --git a/configure.ac b/configure.ac index 66fcd61f241b4a32ee3385279b0042525cca87d7..8d124afc1594c053604dc6faaf7f84b4cc7709c1 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 57784114a60afbf57365cd875b7d962876df116c..30ad365062944be3170e148f4579dc898d268c17 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 13a8ba22f7bf101d93496c106ec3e6e23e4cac46..31652db09921a61ac8a77f99dab95476b0d3e056 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 62c0702adae093678829e5397ba32f2a965d1dbf..c7c2b09e3919a54a25c89794d3cf01d701181f89 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 046df5c4fb20757660e3670e700978ce1107b1f4..e1ae70ff5e7b5453baadee34d9a0cdbd03de73ca 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 c7c82065558644db5e8f901c608d24cbf52dfffb..14e8d05a8ac71be0d40eec99f404a03d22a0049e 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 */