toggle *toggles = NULL;
#endif
-#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
+#ifndef NANO_SMALL
filestruct *search_history = NULL;
filestruct *searchage = NULL;
filestruct *searchbot = NULL;
#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
#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
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,
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);
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);
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. */
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
#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, ...);
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
}
#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)
*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;
/* 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
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. */
/* 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);
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);
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
* 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,
statusbar_x = strlen(answer);
}
}
-#endif /* !NANO_SMALL && ENABLE_NANORC */
+#endif /* !NANO_SMALL */
break;
}
if (finished)
break;
-#if !defined(NANO_SMALL) && defined(ENABLE_NANORC) && !defined(DISABLE_TABCOMP)
+#if !defined(NANO_SMALL) && !defined(DISABLE_TABCOMP)
last_kbinput = kbinput;
#endif
wrefresh(bottomwin);
}
-#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
+#ifndef NANO_SMALL
/* Free magichistory if we need to. */
if (magichistory != NULL)
free(magichistory);
* 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, ...)