CVS code -
+Changes
- General:
+ - Search history and replace history up/down cursor arrows, w/history
+ tab completion, not available w/NANO_SMALL. Changes to
+ statusq, others (Ken Tyler). Added shortcut to search/replace
+ shortcuts so people will know it's there, forced KEY_UP and KEY_DOWN
+ defs in nano.h (Chris, in case blame needs to be placed later).
- Translation updates (see po/ChangeLog for details).
- Forward-ported Chris' --disable-wrapping-as-root option from
1.0.9. Per Jordi's suggestions, have it override
- If there's a page or less of text, do an edit_update() if the
mark is on; otherwise, the highlight won't be displayed. (DLR)
- nano.c:
+ - Added free_history list calls clean up, added init of list headers
+ modified statusq calls (Ken Tyler).
do_prev_word()
- Make the assert match that in do_next_word(). (DLR)
do_enter()
if (operating_dir != NULL && strcmp(operating_dir, ".") != 0)
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
- i = statusq(1, insertfile_list, inspath, _("File to insert into new buffer [from %s] "),
+ i = statusq(1, insertfile_list, inspath, 0, _("File to insert into new buffer [from %s] "),
operating_dir);
else
#endif
- i = statusq(1, insertfile_list, inspath, _("File to insert [from %s] "),
+ i = statusq(1, insertfile_list, inspath, 0, _("File to insert [from %s] "),
operating_dir);
else
#endif
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER))
- i = statusq(1, insertfile_list, inspath, _("File to insert into new buffer [from ./] "));
+ i = statusq(1, insertfile_list, inspath, 0, _("File to insert into new buffer [from ./] "));
else
#endif
- i = statusq(1, insertfile_list, inspath, _("File to insert [from ./] "));
+ i = statusq(1, insertfile_list, inspath, 0, _("File to insert [from ./] "));
if (i != -1) {
inspath = mallocstrcpy(inspath, answer);
#endif /* ENABLE_MULTIBUFFER */
if (i == NANO_EXTCMD_KEY) {
int ts;
- ts = statusq(1, extcmd_list, "", _("Command to execute "));
+ ts = statusq(1, extcmd_list, "", 0, _("Command to execute "));
if (ts == -1 || answer == NULL || answer[0] == '\0') {
statusbar(_("Cancelled"));
UNSET(KEEP_CUTBUFFER);
/* Be nice to the translation folks */
if (ISSET(MARK_ISSET) && !exiting) {
if (append == 2)
- i = statusq(1, writefile_list, "",
+ i = statusq(1, writefile_list, "", 0,
"%s%s%s", _("Prepend Selection to File"), formatstr, backupstr);
- else if (append == 1)
- i = statusq(1, writefile_list, "",
+ else if (append)
+ i = statusq(1, writefile_list, "", 0,
"%s%s%s", _("Append Selection to File"), formatstr, backupstr);
else
- i = statusq(1, writefile_list, "",
+ i = statusq(1, writefile_list, "", 0,
"%s%s%s", _("Write Selection to File"), formatstr, backupstr);
} else {
if (append == 2)
- i = statusq(1, writefile_list, answer,
+ i = statusq(1, writefile_list, answer, 0,
"%s%s%s", _("File Name to Prepend to"), formatstr, backupstr);
- else if (append == 1)
- i = statusq(1, writefile_list, answer,
+ else if (append)
+ i = statusq(1, writefile_list, answer, 0,
"%s%s%s", _("File Name to Append to"), formatstr, backupstr);
else
- i = statusq(1, writefile_list, answer,
+ i = statusq(1, writefile_list, answer, 0,
"%s%s%s", _("File Name to Write"), formatstr, backupstr);
}
#else
if (append == 2)
- i = statusq(1, writefile_list, answer,
+ i = statusq(1, writefile_list, answer, 0,
"%s", _("File Name to Prepend to"));
- else if (append == 1)
- i = statusq(1, writefile_list, answer,
+ else if (append)
+ i = statusq(1, writefile_list, answer, 0,
"%s", _("File Name to Append to"));
else
- i = statusq(1, writefile_list, answer,
+ i = statusq(1, writefile_list, answer, 0,
"%s", _("File Name to Write"));
#endif /* !NANO_SMALL */
case NANO_GOTO_KEY:
curs_set(1);
- j = statusq(0, gotodir_list, "", _("Goto Directory"));
+ j = statusq(0, gotodir_list, "", 0, _("Goto Directory"));
bottombars(browser_list);
curs_set(0);
char *last_search = NULL; /* Last string we searched for */
char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */
+int past_editbuff; /* search lines not displayed */
int flags = 0; /* Our new flag containing many options */
WINDOW *edit; /* The file portion of the editor */
toggle *toggles = NULL;
#endif
+#ifndef NANO_SMALL
+historyheadtype search_history;
+historyheadtype replace_history;
+#endif
+
/* Regular expressions */
#ifdef HAVE_REGEX_H
"", *nano_gotodir_msg = "", *nano_case_msg =
"", *nano_reverse_msg = "", *nano_execute_msg =
"", *nano_dos_msg = "", *nano_mac_msg =
- "", *nano_backup_msg = "";
+ "", *nano_backup_msg = "", *nano_editstr_msg = "";
#ifdef ENABLE_MULTIBUFFER
const char *nano_openprev_msg = "", *nano_opennext_msg =
nano_dos_msg = _("Write file out in DOS format");
nano_mac_msg = _("Write file out in Mac format");
nano_backup_msg = _("Back up original file when saving");
+ nano_editstr_msg = _("Edit the previous search/replace strings");
#ifdef HAVE_REGEX_H
nano_regexp_msg = _("Use regular expressions");
nano_bracket_msg = _("Find other bracket");
sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
#endif
+
+#ifndef NANO_SMALL
+ sc_init_one(&whereis_list, KEY_UP, _("History"),
+ IFHELP(nano_editstr_msg, 0), 0, 0, VIEW, 0);
+#endif
+
+
+
#endif /* !NANO_SMALL */
free_shortcutage(&replace_list);
sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"),
IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
#endif
+
+#ifndef NANO_SMALL
+ sc_init_one(&replace_list, KEY_UP, _("History"),
+ IFHELP(nano_editstr_msg, 0), 0, 0, VIEW, 0);
+#endif
+
#endif /* !NANO_SMALL */
free_shortcutage(&replace_list_2);
sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
+#ifndef NANO_SMALL
+ sc_init_one(&replace_list_2, KEY_UP, _("History"),
+ IFHELP(nano_editstr_msg, 0), 0, 0, VIEW, 0);
+#endif
+
free_shortcutage(&goto_list);
sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
free(bill);
}
#endif /* ENABLE_COLOR */
+#ifndef NANO_SMALL
+ /* free history lists */
+ free_history(&search_history);
+ free_history(&replace_history);
+#endif
}
#endif /* DEBUG */
/* What we do when we're all set to exit */
RETSIGTYPE finish(int sigage)
{
+
+#ifndef NANO_SMALL
+ free_history(&search_history);
+ free_history(&replace_history);
+#endif
+
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
do_replace_highlight(TRUE, word);
/* allow replace word to be corrected */
- i = statusq(0, spell_list, last_replace, _("Edit a replacement"));
+ i = statusq(0, spell_list, last_replace, 0, _("Edit a replacement"));
do_replace_highlight(FALSE, word);
#endif
}
}
+
if (!ISSET(NO_RCFILE))
do_rcfile();
#else
keypad(bottomwin, TRUE);
}
+#ifndef NANO_SMALL
+ history_init();
+#endif
+
#ifdef ENABLE_COLOR
do_colorinit();
#endif /* ENABLE_COLOR */
#define KEY_END -1
#endif /* KEY_END */
+/* Snatch these out of the ncurse sdefs, so we can use them in search
+ history regardless of whethere we're using ncurses or not */
+#ifndef KEY_UP
+#define KEY_UP 0403
+#define KEY_DOWN 0402
+#endif /* KEY_UP */
+
+
#define VERMSG "GNU nano " VERSION
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#endif /* ENABLE_COLOR */
+#ifndef NANO_SMALL
+typedef struct historytype {
+ struct historytype *next;
+ struct historytype *prev;
+ char *data;
+} historytype;
+typedef struct historyheadtype {
+ struct historytype *next; /* keep *next and *prev members together */
+ struct historytype *prev; /* and in same order as in historytype */
+ struct historytype *tail;
+ struct historytype *current;
+ int count;
+ int len;
+} historyheadtype;
+#endif /* !NANO_SMALL */
/* Bitwise flags so we can save space (or more correctly, not waste it) */
/* Minimum fill length (space available for text before wrapping occurs) */
#define MIN_FILL_LENGTH 10
+/* Maximum number of search history strings saved, same value used for replace history */
+#define MAX_SEARCH_HISTORY 100
#endif /* !NANO_H */
extern int temp_opt;
extern int wrap_at, flags, tabsize;
extern int search_last_line;
+extern int past_editbuff;
extern int currslen;
#ifndef DISABLE_JUSTIFY
extern toggle *toggles;
#endif
+#ifndef NANO_SMALL
+extern historyheadtype search_history;
+extern historyheadtype replace_history;
+#endif
+
/* Functions we want available */
/* Public functions in color.c */
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
#endif
int do_find_bracket(void);
+#ifndef NANO_SMALL
+void history_init(void);
+historytype *find_node(historytype *h, char *s);
+void remove_node(historytype *r);
+void insert_node(historytype *h, const char *s);
+void update_history(historyheadtype *h, char *s);
+char *get_history_older(historyheadtype *h);
+char *get_history_newer(historyheadtype *h);
+char *get_history_completion(historyheadtype *h, char *s);
+void free_history(historyheadtype *h);
+#endif
/* Public functions in utils.c */
int is_cntrl_char(int c);
void check_statblank(void);
void nanoget_repaint(const char *buf, const char *inputbuf, int x);
int nanogetstr(int allowtabs, const char *buf, const char *def,
+#ifndef NANO_SMALL
+ historyheadtype *history_list,
+#endif
const shortcut *s
#ifndef DISABLE_TABCOMP
, int *list
void edit_refresh_clearok(void);
void edit_update(filestruct *fileptr, topmidbotnone location);
int statusq(int tabs, const shortcut *s, const char *def,
+#ifndef NANO_SMALL
+ historyheadtype *history_list,
+#endif
const char *msg, ...);
int do_yesno(int all, int leavecursor, const char *msg, ...);
int total_refresh(void);
lineno = 0;
- if (userage == NULL)
+ if (userage == NULL) {
rcfile_error(_("I can't find my home directory! Wah!"));
- else {
+ SET(NO_RCFILE); /* if no .nanorc, don't try to read .nano_history */
+ } else {
nanorc = nrealloc(nanorc, strlen(userage->pw_dir) + 9);
sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
#endif
if ((rcstream = fopen(nanorc, "r")) == NULL) {
/* Don't complain about the file not existing */
- if (errno != ENOENT)
+ if (errno != ENOENT) {
rcfile_error(_("Unable to open ~/.nanorc file, %s"),
strerror(errno));
+ SET(NO_RCFILE);
+ }
} else {
parse_rcfile(rcstream);
fclose(rcstream);
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
+#include <errno.h>
#include <assert.h>
#include "proto.h"
#include "nano.h"
+#ifndef NANO_SMALL
+#ifdef ENABLE_NANORC
+#include <pwd.h>
+#endif
+#endif
+
static int past_editbuff;
/* findnextstr() is now searching lines not displayed */
}
/* Set up the system variables for a search or replace. Returns -1 on
- abort, 0 on success, and 1 on rerun calling program
+ abort, 0 on success, and 1 on rerun calling program
Return -2 to run opposite program (search -> replace, replace ->
search).
backupstring = NULL;
UNSET(CLEAR_BACKUPSTRING);
}
-
- /* Okay, fun time. backupstring is our holder for what is being
+
+ /* Okay, fun time. backupstring is our holder for what is being
returned from the statusq call. Using answer for this would be tricky.
Here, if we're using PICO_MODE, we only want nano to put the
old string back up as editable if it's not the same as last_search.
Otherwise, if we don't already have a backupstring, set it to
last_search. */
-
+#if 0
+/* might need again ;)*/
if (ISSET(PICO_MODE)) {
if (backupstring == NULL || !strcmp(backupstring, last_search)) {
+ /* backupstring = mallocstrcpy(backupstring, ""); */
backupstring = charalloc(1);
backupstring[0] = '\0';
}
- }
- else if (backupstring == NULL)
+ } else
+#endif
+ if (backupstring == NULL)
+#ifndef NANO_SMALL
+ backupstring = mallocstrcpy(backupstring, search_history.current->data);
+#else
backupstring = mallocstrcpy(backupstring, last_search);
+#endif
+/* NEW TEST */
+ if (ISSET(PICO_MODE)) {
+ backupstring = mallocstrcpy(backupstring, "");
+ search_history.current = (historytype *)&search_history.next;
+ }
+/* */
/* If using Pico messages, we do things the old fashioned way... */
if (ISSET(PICO_MODE) && last_search[0] != '\0') {
buf = charalloc(COLS / 3 + 7);
/* This is now one simple call. It just does a lot */
i = statusq(0, replacing ? replace_list : whereis_list, backupstring,
- "%s%s%s%s%s%s",
+#ifndef NANO_SMALL
+ &search_history,
+#endif
+ "%s%s%s%s%s%s",
_("Search"),
/* This string is just a modifier for the search prompt,
reset_cursor();
free(backupstring);
backupstring = NULL;
+#ifndef NANO_SMALL
+ search_history.current = search_history.next;
+#endif
return -1;
} else {
switch (i) {
case NANO_FROMSEARCHTOGOTO_KEY:
free(backupstring);
backupstring = NULL;
- do_gotoline_void();
+#ifndef NANO_SMALL
+ search_history.current = search_history.next;
+#endif
+ i = (int)strtol(answer, &buf, 10); /* just testing answer here */
+ if (!(errno == ERANGE || *answer == '\0' || *buf != '\0'))
+ do_gotoline(-1, 0);
+ else
+ do_gotoline_void();
return -3;
default:
do_early_abort();
not_found_msg(needle);
return NULL;
}
- }
+ }
#ifndef NANO_SMALL
else { /* reverse search */
current_x_find = current_x - 1;
/* The sneaky user deleted the previous search string */
if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Search Cancelled"));
+#ifndef NANO_SMALL
+ search_history.current = search_history.next;
+#endif
search_abort();
return 0;
}
else
last_search = mallocstrcpy(last_search, answer);
+#ifndef NANO_SMALL
+ /* add this search string to the search history list */
+ update_history(&search_history, answer);
+#endif /* !NANO_SMALL */
+
search_last_line = 0;
didfind = findnextstr(FALSE, FALSE, current, current_x, answer);
return 0;
}
+#ifndef NANO_SMALL
+ update_history(&search_history, answer);
+#endif /* !NANO_SMALL */
+
/* Again, there was a previous string, but they deleted it and hit enter */
if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Replace Cancelled"));
answer = mallocstrcpy(answer, last_search);
else
last_search = mallocstrcpy(last_search, answer);
+
prevanswer = mallocstrcpy(prevanswer, last_search);
if (ISSET(PICO_MODE) && last_replace[0] != '\0') {
strncpy(buf, last_replace, COLS / 3 - 1);
strcpy(buf + COLS / 3 - 1, "...");
- i = statusq(0, replace_list_2, "", _("Replace with [%s]"),
- buf);
+ i = statusq(0, replace_list_2, "",
+#ifndef NANO_SMALL
+ &replace_history,
+#endif
+ _("Replace with [%s]"), buf);
free(buf);
} else
- i = statusq(0, replace_list_2, "", _("Replace with [%s]"),
- last_replace);
- } else
- i = statusq(0, replace_list_2, last_replace, _("Replace with"));
+ i = statusq(0, replace_list_2, "",
+#ifndef NANO_SMALL
+ &replace_history,
+#endif
+ _("Replace with [%s]") ,last_replace);
+ } else {
+#ifndef NANO_SMALL
+ replace_history.current = (historytype *)&replace_history.next;
+ last_replace = mallocstrcpy(last_replace, "");
+#endif
+ i = statusq(0, replace_list_2, last_replace,
+#ifndef NANO_SMALL
+ &replace_history,
+#endif
+ _("Replace with"));
+ }
+#ifndef NANO_SMALL
+ if (i == 0)
+ update_history(&replace_history, answer);
+#endif /* !NANO_SMALL */
- /* save where we are */
begin = current;
beginx = current_x;
search_last_line = 0;
int do_gotoline(int line, int save_pos)
{
if (line <= 0) { /* Ask for it */
- if (statusq(0, goto_list, "", _("Enter line number"))) {
+ if (statusq(0, goto_list, (line ? answer : ""), 0, _("Enter line number"))) {
statusbar(_("Aborted"));
goto_abort();
return 0;
edit_update(current, NONE);
else
edit_update(current, CENTER);
-
placewewant = 0;
goto_abort();
+ blank_statusbar_refresh();
return 1;
}
filestruct *current_save;
ch_under_cursor = current->data[current_x];
-
+
+/* if ((!(pos = strchr(brackets, ch_under_cursor))) || (!((offset = pos - brackets) < 8))) { */
+
if (((pos = strchr(brackets, ch_under_cursor)) == NULL) || (((offset = pos - brackets) < 8) == 0)) {
statusbar(_("Not a bracket"));
return 1;
return 0;
}
#endif
+
+#ifndef NANO_SMALL
+/*
+ * search and replace history list support functions
+ */
+
+/* initialize search and replace history lists */
+void history_init(void)
+{
+ search_history.next = (historytype *)&search_history.prev;
+ search_history.prev = NULL;
+ search_history.tail = (historytype *)&search_history.next;
+ search_history.current = search_history.next;
+ search_history.count = 0;
+ search_history.len = 0;
+
+ replace_history.next = (historytype *)&replace_history.prev;
+ replace_history.prev = NULL;
+ replace_history.tail = (historytype *)&replace_history.next;
+ replace_history.current = replace_history.next;
+ replace_history.count = 0;
+ replace_history.len = 0;
+}
+
+/* find first node containing string *s in history list *h */
+historytype *find_node(historytype *h, char *s)
+{
+ for ( ; h->next ; h = h->next)
+ if (strcmp(s, h->data) == 0)
+ return h;
+ return NULL;
+}
+
+/* remove node *r */
+void remove_node(historytype *r)
+{
+ r->prev->next = r->next;
+ r->next->prev = r->prev;
+ free(r->data);
+ free(r);
+}
+
+/* add a node after node *h */
+void insert_node(historytype *h, const char *s)
+{
+ historytype *a;
+
+ a = nmalloc(sizeof(historytype));
+ a->next = h->next;
+ a->prev = h->next->prev;
+ h->next->prev = a;
+ h->next = a;
+ a->data = mallocstrcpy(NULL, s);
+}
+
+/* update history list */
+void update_history(historyheadtype *h, char *s)
+{
+ historytype *p;
+
+ if ((p = find_node(h->next, s))) {
+ if (p == h->next) /* catch delete and re-insert of same string in 1st node */
+ goto up_hs;
+ remove_node(p); /* delete identical older string */
+ h->count--;
+ }
+ if (h->count == MAX_SEARCH_HISTORY) { /* list 'full', delete oldest */
+ remove_node(h->tail);
+ h->count--;
+ }
+ insert_node((historytype *)h, s);
+ h->count++;
+up_hs:
+ h->current = h->next;
+}
+
+/* return a pointer to either the next older history or NULL if no more */
+char *get_history_older(historyheadtype *h)
+{
+ if (h->current->next) { /* any older entries ? */
+ h->current = h->current->next; /* yes */
+ return h->current->data; /* return it */
+ }
+ return NULL; /* end of list */
+}
+
+char *get_history_newer(historyheadtype *h)
+{
+ if (h->current->prev) {
+ h->current = h->current->prev;
+ if (h->current->prev)
+ return h->current->data;
+ }
+ return NULL;
+}
+
+/* get a completion */
+char *get_history_completion(historyheadtype *h, char *s)
+{
+ historytype *p;
+
+ for (p = h->current->next ; p->next ; p = p->next) {
+ if ((strncmp(s, p->data, h->len) == 0) && (strlen(p->data) != h->len)) {
+ h->current = p;
+ return p->data;
+ }
+ }
+ h->current = (historytype*)h;
+ null_at(&s, h->len);
+ return s;
+}
+
+/* free a history list */
+void free_history(historyheadtype *h)
+{
+ historytype *p, *n;
+
+ for (p = h->next ; (n = p->next) ; p = n)
+ remove_node(p);
+}
+
+/* end of history support functions */
+#endif /* !NANO_SMALL */
/* Get the input from the kb; this should only be called from
* statusq(). */
int nanogetstr(int allowtabs, const char *buf, const char *def,
+#ifndef NANO_SMALL
+ historyheadtype *history_list,
+#endif
const shortcut *s
#ifndef DISABLE_TABCOMP
, int *list
/* used by input_tab() */
const shortcut *t;
+#ifndef NANO_SMALL
+ /* for history */
+ char *history = NULL;
+ char *complete = NULL;
+ int last_kbinput = 0;
+#endif
xend = strlen(def);
x = xend;
answer = (char *)nrealloc(answer, xend + 1);
xend--;
}
break;
-#ifndef DISABLE_TABCOMP
case NANO_CONTROL_I:
- if (allowtabs) {
- int shift = 0;
+#ifndef NANO_SMALL
+ /* tab history completion */
+ if (history_list) {
+ if ((!complete) || (last_kbinput != NANO_CONTROL_I)) {
+ history_list->current = (historytype *)history_list;
+ history_list->len = strlen(answer);
+ }
- answer = input_tab(answer, x, &tabbed, &shift, list);
- xend = strlen(answer);
- x += shift;
- if (x > xend)
+ if (history_list->len) {
+ complete = get_history_completion(history_list, answer);
+ xend = strlen(complete);
x = xend;
+ answer = mallocstrcpy(answer, complete);
+ }
}
- break;
+#ifndef DISABLE_TABCOMP
+ else {
+#endif
#endif
+#ifndef DISABLE_TABCOMP
+ if (allowtabs) {
+ int shift = 0;
+
+ answer = input_tab(answer, x, &tabbed, &shift, list);
+ xend = strlen(answer);
+ x += shift;
+ if (x > xend)
+ x = xend;
+ }
+ }
+#endif
+ break;
case KEY_LEFT:
case NANO_BACK_KEY:
if (x > 0)
x--;
break;
case KEY_UP:
+#ifndef NANO_SMALL
+ if (history_list) {
+ /* get older search from the history list */
+ if ((history = get_history_older(history_list))) {
+ answer = mallocstrcpy(answer, history);
+ xend = strlen(history);
+ } else {
+ answer = mallocstrcpy(answer, "");
+ xend = 0;
+ }
+ x = xend;
+ }
+ break;
+#endif
case KEY_DOWN:
+#ifndef NANO_SMALL
+ if (history_list) {
+ /* get newer search from the history list */
+ if ((history = get_history_newer(history_list))) {
+ answer = mallocstrcpy(answer, history);
+ xend = strlen(history);
+ } else {
+ answer = mallocstrcpy(answer, "");
+ xend = 0;
+ }
+ x = xend;
+ }
+#endif
break;
-
case KEY_DC:
goto do_deletekey;
#ifdef DEBUG
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
#endif
- }
+ } /* switch (kbinput) */
+ last_kbinput = kbinput;
nanoget_repaint(buf, answer, x);
wrefresh(bottomwin);
} /* while (kbinput ...) */
wmove(bottomwin, 1 + j, i * (COLS / numcols));
#ifndef NANO_SMALL
+ /* Yucky sentinel values we can't handle a better way */
if (s->val == NANO_CONTROL_SPACE)
strcpy(keystr, "^ ");
- else
-#endif /* !NANO_SMALL */
- if (s->val > 0) {
+ else if (s->val == KEY_UP)
+ strcpy(keystr, _("Up"));
+#endif /* NANO_SMALL */
+ else if (s->val > 0) {
if (s->val < 64)
sprintf(keystr, "^%c", s->val + 64);
else
* very small and keystroke and desc are long. */
void onekey(const char *keystroke, const char *desc, int len)
{
+
wattron(bottomwin, A_REVERSE);
waddnstr(bottomwin, keystroke, len);
wattroff(bottomwin, A_REVERSE);
original = fileptr->data;
converted = charalloc(strlenpt(original) + 1);
-
- /* Next, convert all the tabs to spaces, so everything else is easy.
+
+ /* Next, convert all the tabs to spaces, so everything else is easy.
* Note the internal speller sends us index == -1. */
index = fileptr == current && index > 0 ? strnlenpt(original, index) : 0;
#ifndef NANO_SMALL
* New arg tabs tells whether or not to allow tab completion.
*/
int statusq(int tabs, const shortcut *s, const char *def,
+#ifndef NANO_SMALL
+ historyheadtype *which_history,
+#endif
const char *msg, ...)
{
va_list ap;
va_end(ap);
foo[COLS - 4] = '\0';
+ ret = nanogetstr(tabs, foo, def,
+#ifndef NANO_SMALL
+ which_history,
+#endif
+ s
#ifndef DISABLE_TABCOMP
- ret = nanogetstr(tabs, foo, def, s, &list);
-#else
- ret = nanogetstr(tabs, foo, def, s);
+ , &list
#endif
+ );
free(foo);
switch (ret) {