tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
Also, allow Ctrl+Left/Right with --enable-tiny --enable-browser.master
parent
a33a4f00e5
commit
dc3610fc8e
14
configure.ac
14
configure.ac
|
@ -64,8 +64,15 @@ dnl Checks for options.
|
|||
|
||||
AC_ARG_ENABLE(browser,
|
||||
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
||||
if test "x$enable_browser" = xno; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_browser" != xyes; then
|
||||
enable_browser=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_browser" != xyes; then
|
||||
if test "x$enable_browser" != xno; then
|
||||
AC_DEFINE(ENABLE_BROWSER, 1, [Define this to enable the built-in file browser.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
|
@ -249,9 +256,6 @@ AC_ARG_ENABLE(tiny,
|
|||
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
|
||||
if test "x$enable_browser" != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi
|
||||
if test "x$enable_color" != xyes; then
|
||||
AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
|
||||
color_support=no
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
|
@ -183,14 +183,12 @@ char *do_browser(char *path)
|
|||
} else if (func == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == do_prev_word_void) {
|
||||
selected -= (selected % width);
|
||||
} else if (func == do_next_word_void) {
|
||||
selected += width - 1 - (selected % width);
|
||||
if (selected >= filelist_len)
|
||||
selected = filelist_len - 1;
|
||||
#endif
|
||||
} else if (func == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
|
@ -812,4 +810,4 @@ char *strip_last_component(const char *path)
|
|||
return copy;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
|
|
10
src/files.c
10
src/files.c
|
@ -1106,7 +1106,7 @@ void do_insertfile(void)
|
|||
} else {
|
||||
ssize_t was_current_lineno = openfile->current->lineno;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||
functionptrtype func = func_from_key(&i);
|
||||
#endif
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
@ -1127,7 +1127,7 @@ void do_insertfile(void)
|
|||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
|
@ -2173,7 +2173,7 @@ int do_writeout(bool exiting)
|
|||
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
|
@ -2184,7 +2184,7 @@ int do_writeout(bool exiting)
|
|||
free(answer);
|
||||
answer = chosen;
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (func == dos_format_void) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
|
@ -2385,7 +2385,7 @@ char *real_dir_from_tilde(const char *buf)
|
|||
return retval;
|
||||
}
|
||||
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if !defined(DISABLE_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)
|
||||
|
|
28
src/global.c
28
src/global.c
|
@ -272,7 +272,7 @@ void flip_replace(void)
|
|||
void gototext_void(void)
|
||||
{
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void)
|
||||
{
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ void shortcut_init(void)
|
|||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for a string or a regular expression");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_browser_whereis_msg = N_("Search for a string");
|
||||
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
||||
#ifndef NANO_TINY
|
||||
|
@ -623,7 +623,7 @@ void shortcut_init(void)
|
|||
const char *nano_next_history_msg =
|
||||
N_("Recall the next search/replace string");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
|
@ -638,7 +638,7 @@ void shortcut_init(void)
|
|||
#endif
|
||||
#endif
|
||||
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_exitbrowser_msg = N_("Exit from the file browser");
|
||||
const char *nano_firstfile_msg = N_("Go to the first file in the list");
|
||||
const char *nano_lastfile_msg = N_("Go to the last file in the list");
|
||||
|
@ -676,7 +676,7 @@ void shortcut_init(void)
|
|||
/* Remember the entry for Exit, to be able to replace it with Close. */
|
||||
exitfunc = tailfunc;
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_exit, MBROWSER,
|
||||
exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
|
@ -713,7 +713,7 @@ void shortcut_init(void)
|
|||
add_to_funcs(do_replace, MMAIN,
|
||||
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_search, MBROWSER,
|
||||
whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW);
|
||||
|
||||
|
@ -824,7 +824,7 @@ void shortcut_init(void)
|
|||
N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MMAIN,
|
||||
N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW);
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_left, MBROWSER,
|
||||
N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MBROWSER,
|
||||
|
@ -1009,7 +1009,7 @@ void shortcut_init(void)
|
|||
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
||||
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
|
||||
|
@ -1028,7 +1028,7 @@ void shortcut_init(void)
|
|||
add_to_funcs(discard_buffer, MWRITEFILE,
|
||||
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_research, MBROWSER,
|
||||
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(total_refresh, MBROWSER,
|
||||
|
@ -1261,7 +1261,7 @@ void shortcut_init(void)
|
|||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0);
|
||||
|
@ -1295,7 +1295,7 @@ void shortcut_init(void)
|
|||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
/* In restricted mode, don't allow entering the file browser. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
|
||||
|
@ -1303,7 +1303,7 @@ void shortcut_init(void)
|
|||
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
|
||||
/* Allow exiting from the file browser and the help viewer with
|
||||
* the same key as they were entered. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_HELP
|
||||
|
@ -1608,7 +1608,7 @@ sc *strtosc(const char *input)
|
|||
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = flip_newbuffer;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "tofiles") ||
|
||||
!strcasecmp(input, "browser"))
|
||||
s->scfunc = to_files_void;
|
||||
|
@ -1707,7 +1707,7 @@ int strtomenu(const char *input)
|
|||
#endif
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
return MLINTER;
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "browser"))
|
||||
return MBROWSER;
|
||||
else if (!strcasecmp(input, "whereisfile"))
|
||||
|
|
|
@ -271,7 +271,7 @@ void do_help(void)
|
|||
title = NULL;
|
||||
inhelp = FALSE;
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
||||
browser_refresh();
|
||||
else
|
||||
|
@ -353,7 +353,7 @@ void help_init(void)
|
|||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (currmenu == MBROWSER) {
|
||||
htx[0] = N_("File Browser Help Text\n\n "
|
||||
"The file browser is used to visually browse the "
|
||||
|
@ -391,7 +391,7 @@ void help_init(void)
|
|||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currmenu == MSPELL) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
|
|
|
@ -848,7 +848,7 @@ void usage(void)
|
|||
print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
|
||||
print_opt("-d", "--rebinddelete",
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
print_opt("-g", "--showcursor", N_("Show cursor in file browser"));
|
||||
#endif
|
||||
|
@ -916,7 +916,7 @@ void version(void)
|
|||
|
||||
#ifdef NANO_TINY
|
||||
printf(" --enable-tiny");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
printf(" --enable-browser");
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
|
@ -962,7 +962,7 @@ void version(void)
|
|||
printf(" --enable-wrapping");
|
||||
#endif
|
||||
#else /* !NANO_TINY */
|
||||
#ifdef DISABLE_BROWSER
|
||||
#ifndef ENABLE_BROWSER
|
||||
printf(" --disable-browser");
|
||||
#endif
|
||||
#ifdef DISABLE_COLOR
|
||||
|
@ -1935,7 +1935,7 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
{"constantshow", 0, NULL, 'c'},
|
||||
{"rebinddelete", 0, NULL, 'd'},
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
{"showcursor", 0, NULL, 'g'},
|
||||
#endif
|
||||
{"help", 0, NULL, 'h'},
|
||||
|
|
|
@ -176,7 +176,7 @@ extern char *homedir;
|
|||
typedef void (*functionptrtype)(void);
|
||||
|
||||
/* Most functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
char *do_browse_from(const char *inpath);
|
||||
void read_the_list(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
|
@ -304,7 +304,7 @@ void do_writeout_void(void);
|
|||
void do_savefile(void);
|
||||
#endif
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if !defined(DISABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
|
@ -690,7 +690,7 @@ void regexp_void(void);
|
|||
void backwards_void(void);
|
||||
void flip_replace(void);
|
||||
void gototext_void(void);
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void);
|
||||
void goto_dir_void(void);
|
||||
#endif
|
||||
|
|
|
@ -1989,7 +1989,7 @@ void titlebar(const char *path)
|
|||
/* Figure out the path, prefix and state strings. */
|
||||
if (inhelp)
|
||||
branding = "";
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (path != NULL)
|
||||
prefix = _("DIR:");
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue