really fix bad #ifdefs; history functions are left out when NANO_SMALL
is defined, and history saving and loading functions are left out when NANO_SMALL is defined and/or ENABLE_NANORC isn't defined git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2586 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
8e15674c70
Коммит
1addd601bc
12
src/global.c
12
src/global.c
@ -167,7 +167,7 @@ const shortcut *currshortcut; /* Current shortcut list we're using */
|
||||
toggle *toggles = NULL;
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *search_history = NULL;
|
||||
filestruct *searchage = NULL;
|
||||
filestruct *searchbot = NULL;
|
||||
@ -256,9 +256,7 @@ void shortcut_init(bool unjustify)
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
const char *history_msg = N_("History");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
#endif
|
||||
@ -346,10 +344,8 @@ void shortcut_init(bool unjustify)
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
const char *nano_history_msg =
|
||||
N_("Edit the previous search/replace strings");
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
@ -672,12 +668,10 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
|
||||
@ -740,11 +734,9 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_NANORC
|
||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list_2);
|
||||
@ -771,7 +763,7 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
11
src/proto.h
11
src/proto.h
@ -523,14 +523,19 @@ void do_gotolinecolumn_void(void);
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
|
||||
#endif
|
||||
void do_find_bracket(void);
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef ENABLE_NANORC
|
||||
bool history_has_changed(void);
|
||||
#endif
|
||||
void history_init(void);
|
||||
filestruct *find_history(filestruct *h_start, filestruct *h_end, const
|
||||
char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c. */
|
||||
@ -647,7 +652,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
dollars);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
@ -656,7 +661,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* Have we gone past the last line while searching? */
|
||||
#ifndef NANO_SMALL
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
static bool history_changed = FALSE;
|
||||
/* Have any of the history lists changed? */
|
||||
#endif
|
||||
@ -1118,12 +1118,14 @@ void do_find_bracket(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate whether any of the history lists have changed. */
|
||||
bool history_has_changed(void)
|
||||
{
|
||||
return history_changed;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the search and replace history lists. */
|
||||
void history_init(void)
|
||||
@ -1214,8 +1216,10 @@ void update_history(filestruct **h, const char *s)
|
||||
*hbot = (*hbot)->next;
|
||||
(*hbot)->data = mallocstrcpy(NULL, "");
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Indicate that the history's been changed. */
|
||||
history_changed = TRUE;
|
||||
#endif
|
||||
|
||||
/* Set the current position in the list to the bottom. */
|
||||
*h = *hbot;
|
||||
|
36
src/winio.c
36
src/winio.c
@ -2430,7 +2430,7 @@ void nanoget_repaint(const char *buf, const char *inputbuf, size_t x)
|
||||
/* Get the input from the keyboard; this should only be called from
|
||||
* statusq(). */
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
@ -2446,7 +2446,12 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
bool tabbed = FALSE;
|
||||
/* Whether we've pressed Tab. */
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
char *history = NULL;
|
||||
/* The current history string. */
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int last_kbinput = ERR;
|
||||
/* The key we pressed before the current key. */
|
||||
@ -2454,12 +2459,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
/* The length of the original string that we're trying to
|
||||
* tab complete, if any. */
|
||||
#endif
|
||||
char *history = NULL;
|
||||
/* The current history string. */
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
curranswer_len = strlen(answer);
|
||||
@ -2501,7 +2501,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
switch (kbinput) {
|
||||
case NANO_TAB_KEY:
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
if (last_kbinput != NANO_TAB_KEY)
|
||||
complete_len = strlen(answer);
|
||||
@ -2513,14 +2513,14 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
if (allow_tabs)
|
||||
answer = input_tab(answer, &statusbar_x, &tabbed,
|
||||
list);
|
||||
#endif
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
/* If we're scrolling up at the bottom of the
|
||||
* history list, answer isn't blank, and
|
||||
@ -2546,10 +2546,10 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
* statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#endif /* !NANO_SMALL */
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
/* Get the newer search from the history list and
|
||||
* save it in answer. If there is no newer search,
|
||||
@ -2570,7 +2570,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#endif /* !NANO_SMALL */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2580,7 +2580,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
if (finished)
|
||||
break;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC) && !defined(DISABLE_TABCOMP)
|
||||
#if !defined(NANO_SMALL) && !defined(DISABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
|
||||
@ -2588,7 +2588,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
/* Free magichistory if we need to. */
|
||||
if (magichistory != NULL)
|
||||
free(magichistory);
|
||||
@ -2611,7 +2611,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
|
||||
* The allow_tabs parameter indicates whether we should allow tabs to be
|
||||
* interpreted. */
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#ifndef NANO_SMALL
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user