2009-01-19 Chris Allegretta <chrisa@asty.org>
* Change funcion definitions to shorts instead of (void *)s. New mapping function iso_me_harder_funcmap(). Fixes compilation complaints with -pedantic, reported by Eitan Adler <eitanadlerlist@gmail.com>. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4349 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
4630102f5b
commit
a117163a4c
|
@ -1,3 +1,8 @@
|
||||||
|
2009-01-19 Chris Allegretta <chrisa@asty.org>
|
||||||
|
* Change funcion definitions to shorts instead of (void *)s. New mapping function
|
||||||
|
iso_me_harder_funcmap(). Fixes compilation complaints with -pedantic,
|
||||||
|
reported by Eitan Adler <eitanadlerlist@gmail.com>.
|
||||||
|
|
||||||
GNU nano 2.1.7 - 2008.11.10
|
GNU nano 2.1.7 - 2008.11.10
|
||||||
2008-10-20 Chris Allegretta <chrisa@asty.org>
|
2008-10-20 Chris Allegretta <chrisa@asty.org>
|
||||||
* files.c (do_writeout): Add check for file modification when saving
|
* files.c (do_writeout): Add check for file modification when saving
|
||||||
|
|
|
@ -156,7 +156,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
* time, put back the Enter key so that it's
|
* time, put back the Enter key so that it's
|
||||||
* read in. */
|
* read in. */
|
||||||
if (old_selected == selected)
|
if (old_selected == selected)
|
||||||
unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE);
|
unget_kbinput(sc_seq_or(DO_ENTER, 0), FALSE, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_MOUSE */
|
#endif /* !DISABLE_MOUSE */
|
||||||
|
@ -169,9 +169,9 @@ char *do_browser(char *path, DIR *dir)
|
||||||
if (!f)
|
if (!f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (f->scfunc == total_refresh) {
|
if (f->scfunc == TOTAL_REFRESH) {
|
||||||
total_redraw();
|
total_redraw();
|
||||||
} else if (f->scfunc == do_help_void) {
|
} else if (f->scfunc == DO_HELP_VOID) {
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
do_browser_help();
|
do_browser_help();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
@ -179,33 +179,33 @@ char *do_browser(char *path, DIR *dir)
|
||||||
nano_disabled_msg();
|
nano_disabled_msg();
|
||||||
#endif
|
#endif
|
||||||
/* Search for a filename. */
|
/* Search for a filename. */
|
||||||
} else if (f->scfunc == do_search) {
|
} else if (f->scfunc == DO_SEARCH) {
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
do_filesearch();
|
do_filesearch();
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
/* Search for another filename. */
|
/* Search for another filename. */
|
||||||
} else if (f->scfunc == (void *) whereis_next_msg) {
|
} else if (f->scfunc == WHEREIS_NEXT_MSG) {
|
||||||
do_fileresearch();
|
do_fileresearch();
|
||||||
} else if (f->scfunc == do_page_up) {
|
} else if (f->scfunc == DO_PAGE_UP) {
|
||||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||||
width)
|
width)
|
||||||
selected -= (editwinrows + fileline % editwinrows) *
|
selected -= (editwinrows + fileline % editwinrows) *
|
||||||
width;
|
width;
|
||||||
else
|
else
|
||||||
selected = 0;
|
selected = 0;
|
||||||
} else if (f->scfunc == do_page_down) {
|
} else if (f->scfunc == DO_PAGE_DOWN) {
|
||||||
selected += (editwinrows - fileline % editwinrows) *
|
selected += (editwinrows - fileline % editwinrows) *
|
||||||
width;
|
width;
|
||||||
if (selected > filelist_len - 1)
|
if (selected > filelist_len - 1)
|
||||||
selected = filelist_len - 1;
|
selected = filelist_len - 1;
|
||||||
} else if (f->scfunc == (void *) first_file_msg) {
|
} else if (f->scfunc == FIRST_FILE_MSG) {
|
||||||
if (meta_key)
|
if (meta_key)
|
||||||
selected = 0;
|
selected = 0;
|
||||||
} else if (f->scfunc == (void *) last_file_msg) {
|
} else if (f->scfunc == LAST_FILE_MSG) {
|
||||||
if (meta_key)
|
if (meta_key)
|
||||||
selected = filelist_len - 1;
|
selected = filelist_len - 1;
|
||||||
/* Go to a specific directory. */
|
/* Go to a specific directory. */
|
||||||
} else if (f->scfunc == (void *) goto_dir_msg) {
|
} else if (f->scfunc == GOTO_DIR_MSG) {
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
|
|
||||||
i = do_prompt(TRUE,
|
i = do_prompt(TRUE,
|
||||||
|
@ -238,7 +238,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
* answer in ans, so that the file list is displayed
|
* answer in ans, so that the file list is displayed
|
||||||
* again, the prompt is displayed again, and what we
|
* again, the prompt is displayed again, and what we
|
||||||
* typed before at the prompt is displayed again. */
|
* typed before at the prompt is displayed again. */
|
||||||
unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE);
|
unget_kbinput(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE);
|
||||||
ans = mallocstrcpy(ans, answer);
|
ans = mallocstrcpy(ans, answer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -285,19 +285,19 @@ char *do_browser(char *path, DIR *dir)
|
||||||
free(path);
|
free(path);
|
||||||
path = new_path;
|
path = new_path;
|
||||||
goto change_browser_directory;
|
goto change_browser_directory;
|
||||||
} else if (f->scfunc == do_up_void) {
|
} else if (f->scfunc == DO_UP_VOID) {
|
||||||
if (selected >= width)
|
if (selected >= width)
|
||||||
selected -= width;
|
selected -= width;
|
||||||
} else if (f->scfunc == do_left) {
|
} else if (f->scfunc == DO_LEFT) {
|
||||||
if (selected > 0)
|
if (selected > 0)
|
||||||
selected--;
|
selected--;
|
||||||
} else if (f->scfunc == do_down_void) {
|
} else if (f->scfunc == DO_DOWN_VOID) {
|
||||||
if (selected + width <= filelist_len - 1)
|
if (selected + width <= filelist_len - 1)
|
||||||
selected += width;
|
selected += width;
|
||||||
} else if (f->scfunc == do_right) {
|
} else if (f->scfunc == DO_RIGHT) {
|
||||||
if (selected < filelist_len - 1)
|
if (selected < filelist_len - 1)
|
||||||
selected++;
|
selected++;
|
||||||
} else if (f->scfunc == do_enter) {
|
} else if (f->scfunc == DO_ENTER) {
|
||||||
/* We can't move up from "/". */
|
/* We can't move up from "/". */
|
||||||
if (strcmp(filelist[selected], "/..") == 0) {
|
if (strcmp(filelist[selected], "/..") == 0) {
|
||||||
statusbar(_("Can't move up a directory"));
|
statusbar(_("Can't move up a directory"));
|
||||||
|
@ -355,7 +355,7 @@ char *do_browser(char *path, DIR *dir)
|
||||||
/* Start over again with the new path value. */
|
/* Start over again with the new path value. */
|
||||||
goto change_browser_directory;
|
goto change_browser_directory;
|
||||||
/* Abort the file browser. */
|
/* Abort the file browser. */
|
||||||
} else if (f->scfunc == do_exit) {
|
} else if (f->scfunc == DO_EXIT) {
|
||||||
abort = TRUE;
|
abort = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,32 +552,32 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
if (!*meta_key) {
|
if (!*meta_key) {
|
||||||
switch (*kbinput) {
|
switch (*kbinput) {
|
||||||
case ' ':
|
case ' ':
|
||||||
*kbinput = sc_seq_or(do_page_down, 0);
|
*kbinput = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
*kbinput = sc_seq_or(do_page_up, 0);
|
*kbinput = sc_seq_or(DO_PAGE_UP, 0);
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
*kbinput = sc_seq_or(do_help_void, 0);
|
*kbinput = sc_seq_or(DO_HELP_VOID, 0);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
/* Cancel equivalent to Exit here. */
|
/* Cancel equivalent to Exit here. */
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'e':
|
case 'e':
|
||||||
*kbinput = sc_seq_or(do_exit, 0);
|
*kbinput = sc_seq_or(DO_EXIT, 0);
|
||||||
break;
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'g':
|
case 'g':
|
||||||
*kbinput = sc_seq_or((void *) goto_dir_msg, 0);
|
*kbinput = sc_seq_or(GOTO_DIR_MSG, 0);
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
case 's':
|
case 's':
|
||||||
*kbinput = sc_seq_or(do_enter, 0);
|
*kbinput = sc_seq_or(DO_ENTER, 0);
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
case 'w':
|
case 'w':
|
||||||
*kbinput = sc_seq_or(do_search, 0);
|
*kbinput = sc_seq_or(DO_SEARCH, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -841,18 +841,18 @@ int filesearch_init(void)
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (s && s->scfunc == (void *) case_sens_msg) {
|
if (s && s->scfunc == CASE_SENS_MSG) {
|
||||||
TOGGLE(CASE_SENSITIVE);
|
TOGGLE(CASE_SENSITIVE);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (s && s->scfunc == (void *) backwards_msg) {
|
} else if (s && s->scfunc == BACKWARDS_MSG) {
|
||||||
TOGGLE(BACKWARDS_SEARCH);
|
TOGGLE(BACKWARDS_SEARCH);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
if (s && s->scfunc == (void *) regexp_msg) {
|
if (s && s->scfunc == REGEXP_MSG) {
|
||||||
TOGGLE(USE_REGEXP);
|
TOGGLE(USE_REGEXP);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
20
src/files.c
20
src/files.c
|
@ -780,14 +780,14 @@ void do_insertfile(
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
|
|
||||||
if (s && s->scfunc == (void *) new_buffer_msg) {
|
if (s && s->scfunc == NEW_BUFFER_MSG) {
|
||||||
/* Don't allow toggling if we're in view mode. */
|
/* Don't allow toggling if we're in view mode. */
|
||||||
if (!ISSET(VIEW_MODE))
|
if (!ISSET(VIEW_MODE))
|
||||||
TOGGLE(MULTIBUFFER);
|
TOGGLE(MULTIBUFFER);
|
||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (s && s->scfunc == (void *) ext_cmd_msg) {
|
if (s && s->scfunc == EXT_CMD_MSG) {
|
||||||
execute = !execute;
|
execute = !execute;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ void do_insertfile(
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
if (s && s->scfunc == (void *) to_files_msg) {
|
if (s && s->scfunc == TO_FILES_MSG) {
|
||||||
char *tmp = do_browse_from(answer);
|
char *tmp = do_browse_from(answer);
|
||||||
|
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
@ -1917,7 +1917,7 @@ bool do_writeout(bool exiting)
|
||||||
s = get_shortcut(currmenu, &i, &meta_key, &func_key);
|
s = get_shortcut(currmenu, &i, &meta_key, &func_key);
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
if (s && s->scfunc == (void *) to_files_msg) {
|
if (s && s->scfunc == TO_FILES_MSG) {
|
||||||
char *tmp = do_browse_from(answer);
|
char *tmp = do_browse_from(answer);
|
||||||
|
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
@ -1929,26 +1929,26 @@ bool do_writeout(bool exiting)
|
||||||
} else
|
} else
|
||||||
#endif /* !DISABLE_BROWSER */
|
#endif /* !DISABLE_BROWSER */
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (s && s->scfunc == (void *) dos_format_msg) {
|
if (s && s->scfunc == DOS_FORMAT_MSG) {
|
||||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||||
DOS_FILE;
|
DOS_FILE;
|
||||||
continue;
|
continue;
|
||||||
} else if (s && s->scfunc == (void *) mac_format_msg) {
|
} else if (s && s->scfunc == MAC_FORMAT_MSG) {
|
||||||
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
|
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
|
||||||
MAC_FILE;
|
MAC_FILE;
|
||||||
continue;
|
continue;
|
||||||
} else if (s && s->scfunc == (void *) backup_file_msg) {
|
} else if (s && s->scfunc == BACKUP_FILE_MSG) {
|
||||||
TOGGLE(BACKUP_FILE);
|
TOGGLE(BACKUP_FILE);
|
||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
if (s && s->scfunc == (void *) prepend_msg) {
|
if (s && s->scfunc == PREPEND_MSG) {
|
||||||
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
||||||
continue;
|
continue;
|
||||||
} else if (s && s->scfunc == (void *) append_msg) {
|
} else if (s && s->scfunc == APPEND_MSG) {
|
||||||
append = (append == APPEND) ? OVERWRITE : APPEND;
|
append = (append == APPEND) ? OVERWRITE : APPEND;
|
||||||
continue;
|
continue;
|
||||||
} else if (s && s->scfunc == do_help_void) {
|
} else if (s && s->scfunc == DO_HELP_VOID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
733
src/global.c
733
src/global.c
File diff suppressed because it is too large
Load Diff
26
src/help.c
26
src/help.c
|
@ -145,35 +145,35 @@ void do_help(void (*refresh_func)(void))
|
||||||
if (!f)
|
if (!f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (f->scfunc == total_refresh) {
|
if (f->scfunc == TOTAL_REFRESH) {
|
||||||
total_redraw();
|
total_redraw();
|
||||||
break;
|
break;
|
||||||
} else if (f->scfunc == do_page_up) {
|
} else if (f->scfunc == DO_PAGE_UP) {
|
||||||
if (line > editwinrows - 2)
|
if (line > editwinrows - 2)
|
||||||
line -= editwinrows - 2;
|
line -= editwinrows - 2;
|
||||||
else
|
else
|
||||||
line = 0;
|
line = 0;
|
||||||
} else if (f->scfunc == do_page_down) {
|
} else if (f->scfunc == DO_PAGE_DOWN) {
|
||||||
if (line + (editwinrows - 1) < last_line)
|
if (line + (editwinrows - 1) < last_line)
|
||||||
line += editwinrows - 2;
|
line += editwinrows - 2;
|
||||||
} else if (f->scfunc == do_up_void) {
|
} else if (f->scfunc == DO_UP_VOID) {
|
||||||
if (line > 0)
|
if (line > 0)
|
||||||
line--;
|
line--;
|
||||||
} else if (f->scfunc == do_down_void) {
|
} else if (f->scfunc == DO_DOWN_VOID) {
|
||||||
if (line + (editwinrows - 1) < last_line)
|
if (line + (editwinrows - 1) < last_line)
|
||||||
line++;
|
line++;
|
||||||
} else if (f->scfunc == do_first_line) {
|
} else if (f->scfunc == DO_FIRST_LINE) {
|
||||||
if (meta_key)
|
if (meta_key)
|
||||||
line = 0;
|
line = 0;
|
||||||
break;
|
break;
|
||||||
} else if (f->scfunc == do_last_line) {
|
} else if (f->scfunc == DO_LAST_LINE) {
|
||||||
if (meta_key) {
|
if (meta_key) {
|
||||||
if (line + (editwinrows - 1) < last_line)
|
if (line + (editwinrows - 1) < last_line)
|
||||||
line = last_line - (editwinrows - 1);
|
line = last_line - (editwinrows - 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Abort the help browser. */
|
/* Abort the help browser. */
|
||||||
} else if (f->scfunc == do_exit) {
|
} else if (f->scfunc == DO_EXIT) {
|
||||||
abort = TRUE;
|
abort = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ void help_init(void)
|
||||||
size_t endis_len = strlen(_("enable/disable"));
|
size_t endis_len = strlen(_("enable/disable"));
|
||||||
|
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if (s->scfunc == (void *) do_toggle)
|
if (s->scfunc == DO_TOGGLE)
|
||||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
|
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ void help_init(void)
|
||||||
/* And the toggles... */
|
/* And the toggles... */
|
||||||
if (currmenu == MMAIN)
|
if (currmenu == MMAIN)
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if (s->scfunc == (void *) do_toggle)
|
if (s->scfunc == DO_TOGGLE)
|
||||||
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
|
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
|
||||||
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
|
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
|
||||||
|
|
||||||
|
@ -507,15 +507,15 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||||
switch (*kbinput) {
|
switch (*kbinput) {
|
||||||
/* For consistency with the file browser. */
|
/* For consistency with the file browser. */
|
||||||
case ' ':
|
case ' ':
|
||||||
*kbinput = sc_seq_or(do_page_up, 0);
|
*kbinput = sc_seq_or(DO_PAGE_UP, 0);
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
*kbinput = sc_seq_or(do_page_down, 0);;
|
*kbinput = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||||
break;
|
break;
|
||||||
/* Cancel is equivalent to Exit here. */
|
/* Cancel is equivalent to Exit here. */
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'e':
|
case 'e':
|
||||||
*kbinput = sc_seq_or(do_exit, 0);;
|
*kbinput = sc_seq_or(DO_EXIT, 0);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
src/nano.c
19
src/nano.c
|
@ -67,6 +67,11 @@ filestruct *make_new_node(filestruct *prevnode)
|
||||||
newnode->next = NULL;
|
newnode->next = NULL;
|
||||||
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
|
newnode->lineno = (prevnode != NULL) ? prevnode->lineno + 1 : 1;
|
||||||
|
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
newnode->colors = NULL;
|
||||||
|
newnode->colorclean = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
return newnode;
|
return newnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,7 +1458,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||||
* for verbatim input, turn off prepending of wrapped
|
* for verbatim input, turn off prepending of wrapped
|
||||||
* text. */
|
* text. */
|
||||||
if (have_shortcut && (!have_shortcut || s == NULL || s->scfunc !=
|
if (have_shortcut && (!have_shortcut || s == NULL || s->scfunc !=
|
||||||
do_verbatim_input))
|
DO_VERBATIM_INPUT))
|
||||||
wrap_reset();
|
wrap_reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1488,26 +1493,26 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||||
default:
|
default:
|
||||||
/* If the function associated with this shortcut is
|
/* If the function associated with this shortcut is
|
||||||
* cutting or copying text, indicate this. */
|
* cutting or copying text, indicate this. */
|
||||||
if (s->scfunc == do_cut_text_void
|
if (s->scfunc == DO_CUT_TEXT_VOID
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|| s->scfunc == do_copy_text || s->scfunc ==
|
|| s->scfunc == DO_COPY_TEXT || s->scfunc ==
|
||||||
do_cut_till_end
|
DO_CUT_TILL_END
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
cut_copy = TRUE;
|
cut_copy = TRUE;
|
||||||
|
|
||||||
if (s->scfunc != NULL) {
|
if (s->scfunc != 0) {
|
||||||
const subnfunc *f = sctofunc((sc *) s);
|
const subnfunc *f = sctofunc((sc *) s);
|
||||||
*ran_func = TRUE;
|
*ran_func = TRUE;
|
||||||
if (ISSET(VIEW_MODE) && f && !f->viewok)
|
if (ISSET(VIEW_MODE) && f && !f->viewok)
|
||||||
print_view_warning();
|
print_view_warning();
|
||||||
else
|
else
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (s->scfunc == (void *) do_toggle)
|
if (s->scfunc == DO_TOGGLE)
|
||||||
do_toggle(s->toggle);
|
do_toggle(s->toggle);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
s->scfunc();
|
iso_me_harder_funcmap(s->scfunc);
|
||||||
}
|
}
|
||||||
*finished = TRUE;
|
*finished = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
227
src/nano.h
227
src/nano.h
|
@ -173,36 +173,6 @@ typedef enum {
|
||||||
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
|
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
|
||||||
} undo_type;
|
} undo_type;
|
||||||
|
|
||||||
/* Structure types. */
|
|
||||||
typedef struct filestruct {
|
|
||||||
char *data;
|
|
||||||
/* The text of this line. */
|
|
||||||
ssize_t lineno;
|
|
||||||
/* The number of this line. */
|
|
||||||
struct filestruct *next;
|
|
||||||
/* Next node. */
|
|
||||||
struct filestruct *prev;
|
|
||||||
/* Previous node. */
|
|
||||||
} filestruct;
|
|
||||||
|
|
||||||
typedef struct partition {
|
|
||||||
filestruct *fileage;
|
|
||||||
/* The top line of this portion of the file. */
|
|
||||||
filestruct *top_prev;
|
|
||||||
/* The line before the top line of this portion of the file. */
|
|
||||||
char *top_data;
|
|
||||||
/* The text before the beginning of the top line of this portion
|
|
||||||
* of the file. */
|
|
||||||
filestruct *filebot;
|
|
||||||
/* The bottom line of this portion of the file. */
|
|
||||||
filestruct *bot_next;
|
|
||||||
/* The line after the bottom line of this portion of the
|
|
||||||
* file. */
|
|
||||||
char *bot_data;
|
|
||||||
/* The text after the end of the bottom line of this portion of
|
|
||||||
* the file. */
|
|
||||||
} partition;
|
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
typedef struct colortype {
|
typedef struct colortype {
|
||||||
short fg;
|
short fg;
|
||||||
|
@ -251,6 +221,41 @@ typedef struct syntaxtype {
|
||||||
} syntaxtype;
|
} syntaxtype;
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
|
|
||||||
|
/* Structure types. */
|
||||||
|
typedef struct filestruct {
|
||||||
|
char *data;
|
||||||
|
/* The text of this line. */
|
||||||
|
ssize_t lineno;
|
||||||
|
/* The number of this line. */
|
||||||
|
struct filestruct *next;
|
||||||
|
/* Next node. */
|
||||||
|
struct filestruct *prev;
|
||||||
|
/* Previous node. */
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
|
colortype **colors; /* Will be a series of pointers to the colorstrings we're painting */
|
||||||
|
bool colorclean; /* Did we do something to the line which necessitates recalculating the colors */
|
||||||
|
#endif
|
||||||
|
} filestruct;
|
||||||
|
|
||||||
|
typedef struct partition {
|
||||||
|
filestruct *fileage;
|
||||||
|
/* The top line of this portion of the file. */
|
||||||
|
filestruct *top_prev;
|
||||||
|
/* The line before the top line of this portion of the file. */
|
||||||
|
char *top_data;
|
||||||
|
/* The text before the beginning of the top line of this portion
|
||||||
|
* of the file. */
|
||||||
|
filestruct *filebot;
|
||||||
|
/* The bottom line of this portion of the file. */
|
||||||
|
filestruct *bot_next;
|
||||||
|
/* The line after the bottom line of this portion of the
|
||||||
|
* file. */
|
||||||
|
char *bot_data;
|
||||||
|
/* The text after the end of the bottom line of this portion of
|
||||||
|
* the file. */
|
||||||
|
} partition;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
typedef struct undo {
|
typedef struct undo {
|
||||||
ssize_t lineno;
|
ssize_t lineno;
|
||||||
|
@ -380,7 +385,7 @@ typedef struct sc {
|
||||||
/* The actual sequence to check on the the type is determined */
|
/* The actual sequence to check on the the type is determined */
|
||||||
int menu;
|
int menu;
|
||||||
/* What list does this apply to */
|
/* What list does this apply to */
|
||||||
void (*scfunc)(void);
|
short scfunc;
|
||||||
/* The function we're going to run */
|
/* The function we're going to run */
|
||||||
int toggle;
|
int toggle;
|
||||||
/* If a toggle, what we're toggling */
|
/* If a toggle, what we're toggling */
|
||||||
|
@ -392,7 +397,7 @@ typedef struct sc {
|
||||||
} sc;
|
} sc;
|
||||||
|
|
||||||
typedef struct subnfunc {
|
typedef struct subnfunc {
|
||||||
void (*scfunc)(void);
|
short scfunc;
|
||||||
/* What function is this */
|
/* What function is this */
|
||||||
int menus;
|
int menus;
|
||||||
/* In what menus does this function applu */
|
/* In what menus does this function applu */
|
||||||
|
@ -696,6 +701,164 @@ typedef struct subnfunc {
|
||||||
#define UNDO_DEL_DEL (1<<0)
|
#define UNDO_DEL_DEL (1<<0)
|
||||||
#define UNDO_DEL_BACKSPACE (1<<1)
|
#define UNDO_DEL_BACKSPACE (1<<1)
|
||||||
|
|
||||||
|
/* Since in ISO C you can't pass around function pointers anymore,
|
||||||
|
let's make some integer macros for function names, and then I
|
||||||
|
can go cut my wrists after writing the big switch statement
|
||||||
|
that will necessitate. */
|
||||||
|
|
||||||
|
#define CASE_SENS_MSG 1
|
||||||
|
#define BACKWARDS_MSG 2
|
||||||
|
#define REGEXP_MSG 3
|
||||||
|
#define WHEREIS_NEXT_MSG 4
|
||||||
|
#define FIRST_FILE_MSG 5
|
||||||
|
#define LAST_FILE_MSG 6
|
||||||
|
#define GOTO_DIR_MSG 7
|
||||||
|
#define TOTAL_REFRESH 8
|
||||||
|
#define DO_HELP_VOID 9
|
||||||
|
#define DO_SEARCH 10
|
||||||
|
#define DO_PAGE_UP 11
|
||||||
|
#define DO_PAGE_DOWN 12
|
||||||
|
#define DO_UP_VOID 13
|
||||||
|
#define DO_LEFT 14
|
||||||
|
#define DO_DOWN_VOID 15
|
||||||
|
#define DO_RIGHT 16
|
||||||
|
#define DO_ENTER 17
|
||||||
|
#define DO_EXIT 18
|
||||||
|
#define NEW_BUFFER_MSG 19
|
||||||
|
#define EXT_CMD_MSG 20
|
||||||
|
#define TO_FILES_MSG 21
|
||||||
|
#define DOS_FORMAT_MSG 23
|
||||||
|
#define MAC_FORMAT_MSG 24
|
||||||
|
#define BACKUP_FILE_MSG 25
|
||||||
|
#define PREPEND_MSG 26
|
||||||
|
#define APPEND_MSG 27
|
||||||
|
#define DO_FIRST_LINE 28
|
||||||
|
#define DO_LAST_LINE 29
|
||||||
|
#define DO_TOGGLE 30
|
||||||
|
#define GOTOTEXT_MSG 31
|
||||||
|
#define NO_REPLACE_MSG 32
|
||||||
|
#define DO_BACKSPACE 33
|
||||||
|
#define DO_DELETE 34
|
||||||
|
#define DO_TAB 35
|
||||||
|
#define DO_VERBATIM_INPUT 36
|
||||||
|
#define SWITCH_TO_NEXT_BUFFER_VOID 37
|
||||||
|
#define SWITCH_TO_PREV_BUFFER_VOID 38
|
||||||
|
#define DO_END 39
|
||||||
|
#define DO_HOME 40
|
||||||
|
#define NEXT_HISTORY_MSG 41
|
||||||
|
#define PREV_HISTORY_MSG 42
|
||||||
|
#define DO_REDO 43
|
||||||
|
#define DO_UNDO 44
|
||||||
|
#define DO_WORDLINECHAR_COUNT 45
|
||||||
|
#define DO_FIND_BRACKET 46
|
||||||
|
#define DO_PREV_WORD_VOID 47
|
||||||
|
#define DO_SUSPEND_VOID 48
|
||||||
|
#define CANCEL_MSG 49
|
||||||
|
#define DO_WRITEOUT_VOID 50
|
||||||
|
#define DO_INSERTFILE_VOID 51
|
||||||
|
#define DO_CUT_TEXT_VOID 52
|
||||||
|
#define DO_UNCUT_TEXT 53
|
||||||
|
#define DO_CURSORPOS_VOID 54
|
||||||
|
#define DO_GOTOLINECOLUMN_VOID 55
|
||||||
|
#define DO_REPLACE 56
|
||||||
|
#define DO_JUSTIFY_VOID 57
|
||||||
|
#define DO_PARA_BEGIN_VOID 58
|
||||||
|
#define DO_PARA_END_VOID 59
|
||||||
|
#define DO_FULL_JUSTIFY 60
|
||||||
|
#define DO_MARK 61
|
||||||
|
#define DO_RESEARCH 62
|
||||||
|
#define DO_COPY_TEXT 63
|
||||||
|
#define DO_INDENT_VOID 64
|
||||||
|
#define DO_UNINDENT 65
|
||||||
|
#define DO_SCROLL_UP 66
|
||||||
|
#define DO_SCROLL_DOWN 67
|
||||||
|
#define DO_NEXT_WORD_VOID 68
|
||||||
|
#define DO_CUT_TILL_END 69
|
||||||
|
#define NANO_GOTODIR_MSG 70
|
||||||
|
#define NANO_LASTFILE_MSG 71
|
||||||
|
#define NANO_FIRSTFILE_MSG 72
|
||||||
|
#define INSERT_FILE_MSG 73
|
||||||
|
#define NANO_MULTIBUFFER_MSG 74
|
||||||
|
#define NANO_EXECUTE_MSG 75
|
||||||
|
#define NANO_BACKUP_MSG 76
|
||||||
|
#define NANO_PREPEND_MSG 77
|
||||||
|
#define NANO_APPEND_MSG 78
|
||||||
|
#define NANO_MAC_MSG 79
|
||||||
|
#define NANO_DOS_MSG 80
|
||||||
|
#define NANO_TOFILES_MSG 81
|
||||||
|
#define NANO_NEXT_HISTORY_MSG 82
|
||||||
|
#define NANO_PREV_HISTORY_MSG 83
|
||||||
|
#define NANO_REGEXP_MSG 84
|
||||||
|
#define NANO_REVERSE_MSG 85
|
||||||
|
#define NANO_CASE_MSG 86
|
||||||
|
#define NANO_SUSPEND_MSG 87
|
||||||
|
#define SUSPEND_MSG 88
|
||||||
|
#define NANO_REFRESH_MSG 89
|
||||||
|
#define REFRESH_MSG 90
|
||||||
|
#define NANO_WORDCOUNT_MSG 91
|
||||||
|
#define NANO_FULLJUSTIFY_MSG 92
|
||||||
|
#define FULLJSTIFY_MSG 93
|
||||||
|
#define XOFF_COMPLAINT 94
|
||||||
|
#define XON_COMPLAINT 95
|
||||||
|
#define NANO_CUT_TILL_END_MSG 96
|
||||||
|
#define NANO_BACKSPACE_MSG 97
|
||||||
|
#define NANO_DELETE_MSG 98
|
||||||
|
#define NANO_ENTER_MSG 99
|
||||||
|
#define NANO_TAB_MSG 100
|
||||||
|
#define NANO_VERBATIM_MSG 101
|
||||||
|
#define NANO_NEXTFILE_MSG 102
|
||||||
|
#define NANO_PREVFILE_MSG 103
|
||||||
|
#define NANO_SCROLLDOWN_MSG 104
|
||||||
|
#define NANO_SCROLLUP_MSG 105
|
||||||
|
#define NANO_BRACKET_MSG 106
|
||||||
|
#define NANO_PARAEND_MSG 107
|
||||||
|
#define END_OF_PAR_MSG 108
|
||||||
|
#define NANO_PARABEGIN_MSG 109
|
||||||
|
#define BEG_OF_PAR_MSG 110
|
||||||
|
#define NANO_END_MSG 111
|
||||||
|
#define NANO_HOME_MSG 112
|
||||||
|
#define NANO_NEXTLINE_MSG 113
|
||||||
|
#define NANO_PREVLINE_MSG 114
|
||||||
|
#define NANO_PREVWORD_MSG 115
|
||||||
|
#define NANO_NEXTWORD_MSG 116
|
||||||
|
#define NANO_BACK_MSG 117
|
||||||
|
#define NANO_FORWARD_MSG 118
|
||||||
|
#define NANO_REDO_MSG 119
|
||||||
|
#define NANO_UNDO_MSG 120
|
||||||
|
#define NANO_UNINDENT_MSG 121
|
||||||
|
#define NANO_INDENT_MSG 122
|
||||||
|
#define NANO_COPY_MSG 123
|
||||||
|
#define NANO_WHEREIS_NEXT_MSG 124
|
||||||
|
#define NANO_MARK_MSG 125
|
||||||
|
#define NANO_REPLACE_MSG 126
|
||||||
|
#define REPLACE_MSG 127
|
||||||
|
#define NANO_GOTOLINE_MSG 128
|
||||||
|
#define NANO_LASTLINE_MSG 129
|
||||||
|
#define NANO_FIRSTLINE_MSG 130
|
||||||
|
#define NANO_SPELL_MSG 131
|
||||||
|
#define DO_SPELL 132
|
||||||
|
#define NANO_CURSORPOS_MSG 133
|
||||||
|
#define NANO_UNCUT_MSG 134
|
||||||
|
#define GET_HELP_MSG 135
|
||||||
|
#define NANO_HELP_MSG 136
|
||||||
|
#define NANO_CANCEL_MSG 137
|
||||||
|
#define NANO_EXIT_MSG 138
|
||||||
|
#define EXIT_MSG 139
|
||||||
|
#define NANO_EXITBROWSER_MSG 140
|
||||||
|
#define NANO_WRITEOUT_MSG 141
|
||||||
|
#define NANO_DISABLED_MSG 142
|
||||||
|
#define NANO_INSERT_MSG 143
|
||||||
|
#define WHEREIS_MSG 144
|
||||||
|
#define NANO_WHEREIS_MSG 145
|
||||||
|
#define NANO_PREVPAGE_MSG 146
|
||||||
|
#define NANO_NEXTPAGE_MSG 147
|
||||||
|
#define NANO_CUT_MSG 148
|
||||||
|
#define DO_CUT_TEXT 149
|
||||||
|
#define DO_NEXT_WORD 150
|
||||||
|
#define DO_PREV_WORD 151
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#define VIEW TRUE
|
#define VIEW TRUE
|
||||||
|
|
56
src/prompt.c
56
src/prompt.c
|
@ -152,38 +152,38 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*have_shortcut) {
|
if (*have_shortcut) {
|
||||||
if (s->scfunc == do_tab || s->scfunc == do_enter)
|
if (s->scfunc == DO_TAB || s->scfunc == DO_ENTER)
|
||||||
;
|
;
|
||||||
else if (s->scfunc == total_refresh)
|
else if (s->scfunc == TOTAL_REFRESH)
|
||||||
total_statusbar_refresh(refresh_func);
|
total_statusbar_refresh(refresh_func);
|
||||||
else if (s->scfunc == (void *) do_cut_text) {
|
else if (s->scfunc == DO_CUT_TEXT) {
|
||||||
/* If we're using restricted mode, the filename
|
/* If we're using restricted mode, the filename
|
||||||
* isn't blank, and we're at the "Write File"
|
* isn't blank, and we're at the "Write File"
|
||||||
* prompt, disable Cut. */
|
* prompt, disable Cut. */
|
||||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||||
'\0' || currmenu != MWRITEFILE)
|
'\0' || currmenu != MWRITEFILE)
|
||||||
do_statusbar_cut_text();
|
do_statusbar_cut_text();
|
||||||
} else if (s->scfunc == do_right)
|
} else if (s->scfunc == DO_RIGHT)
|
||||||
do_statusbar_right();
|
do_statusbar_right();
|
||||||
else if (s->scfunc == do_left)
|
else if (s->scfunc == DO_LEFT)
|
||||||
do_statusbar_left();
|
do_statusbar_left();
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (s->scfunc == (void *) do_next_word)
|
else if (s->scfunc == DO_NEXT_WORD)
|
||||||
do_statusbar_next_word(FALSE);
|
do_statusbar_next_word(FALSE);
|
||||||
else if (s->scfunc == (void *) do_prev_word)
|
else if (s->scfunc == DO_PREV_WORD)
|
||||||
do_statusbar_prev_word(FALSE);
|
do_statusbar_prev_word(FALSE);
|
||||||
#endif
|
#endif
|
||||||
else if (s->scfunc == do_home)
|
else if (s->scfunc == DO_HOME)
|
||||||
do_statusbar_home();
|
do_statusbar_home();
|
||||||
else if (s->scfunc == do_end)
|
else if (s->scfunc == DO_END)
|
||||||
do_statusbar_end();
|
do_statusbar_end();
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (s->scfunc == do_find_bracket)
|
else if (s->scfunc == DO_FIND_BRACKET)
|
||||||
do_statusbar_find_bracket();
|
do_statusbar_find_bracket();
|
||||||
#endif
|
#endif
|
||||||
else if (s->scfunc == do_verbatim_input) {
|
else if (s->scfunc == DO_VERBATIM_INPUT) {
|
||||||
/* If we're using restricted mode, the filename
|
/* If we're using restricted mode, the filename
|
||||||
* isn't blank, and we're at the "Write File"
|
* isn't blank, and we're at the "Write File"
|
||||||
* prompt, disable verbatim input. */
|
* prompt, disable verbatim input. */
|
||||||
|
@ -201,18 +201,18 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||||
* to indicate that we're done. */
|
* to indicate that we're done. */
|
||||||
if (got_enter) {
|
if (got_enter) {
|
||||||
get_input(NULL, 1);
|
get_input(NULL, 1);
|
||||||
input = sc_seq_or(do_enter, 0);
|
input = sc_seq_or(DO_ENTER, 0);
|
||||||
*finished = TRUE;
|
*finished = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s->scfunc == do_delete) {
|
} else if (s->scfunc == DO_DELETE) {
|
||||||
/* If we're using restricted mode, the filename
|
/* If we're using restricted mode, the filename
|
||||||
* isn't blank, and we're at the "Write File"
|
* isn't blank, and we're at the "Write File"
|
||||||
* prompt, disable Delete. */
|
* prompt, disable Delete. */
|
||||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||||
'\0' || currmenu != MWRITEFILE)
|
'\0' || currmenu != MWRITEFILE)
|
||||||
do_statusbar_delete();
|
do_statusbar_delete();
|
||||||
} else if (s->scfunc == do_backspace) {
|
} else if (s->scfunc == DO_BACKSPACE) {
|
||||||
/* If we're using restricted mode, the filename
|
/* If we're using restricted mode, the filename
|
||||||
* isn't blank, and we're at the "Write File"
|
* isn't blank, and we're at the "Write File"
|
||||||
* prompt, disable Backspace. */
|
* prompt, disable Backspace. */
|
||||||
|
@ -227,10 +227,10 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||||
* associated functions. */
|
* associated functions. */
|
||||||
|
|
||||||
f = sctofunc((sc *) s);
|
f = sctofunc((sc *) s);
|
||||||
if (s->scfunc != NULL && s->execute == TRUE) {
|
if (s->scfunc != 0 && s->execute == TRUE) {
|
||||||
*ran_func = TRUE;
|
*ran_func = TRUE;
|
||||||
if (!ISSET(VIEW_MODE) || f->viewok)
|
if (!ISSET(VIEW_MODE) || f->viewok)
|
||||||
f->scfunc();
|
iso_me_harder_funcmap(f->scfunc);
|
||||||
}
|
}
|
||||||
*finished = TRUE;
|
*finished = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -979,19 +979,19 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||||
s = get_shortcut(currmenu, &kbinput, meta_key, func_key);
|
s = get_shortcut(currmenu, &kbinput, meta_key, func_key);
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
if (s->scfunc == (void *) cancel_msg || s->scfunc == do_enter)
|
if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
if (s && s->scfunc != do_tab)
|
if (s && s->scfunc != DO_TAB)
|
||||||
tabbed = FALSE;
|
tabbed = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (s && s->scfunc == do_tab) {
|
if (s && s->scfunc == DO_TAB) {
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
if (last_kbinput != sc_seq_or(do_tab, NANO_CONTROL_I))
|
if (last_kbinput != sc_seq_or(DO_TAB, NANO_CONTROL_I))
|
||||||
complete_len = strlen(answer);
|
complete_len = strlen(answer);
|
||||||
|
|
||||||
if (complete_len > 0) {
|
if (complete_len > 0) {
|
||||||
|
@ -1010,7 +1010,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||||
} else
|
} else
|
||||||
#endif /* !DISABLE_TABCOMP */
|
#endif /* !DISABLE_TABCOMP */
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (s && s->scfunc == (void *) prev_history_msg) {
|
if (s && s->scfunc == PREV_HISTORY_MSG) {
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
/* If we're scrolling up at the bottom of the
|
/* If we're scrolling up at the bottom of the
|
||||||
* history list and answer isn't blank, save answer
|
* history list and answer isn't blank, save answer
|
||||||
|
@ -1038,7 +1038,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||||
* statusbar prompt. */
|
* statusbar prompt. */
|
||||||
finished = FALSE;
|
finished = FALSE;
|
||||||
}
|
}
|
||||||
} else if (s && s->scfunc == (void *) next_history_msg) {
|
} else if (s && s->scfunc == NEXT_HISTORY_MSG) {
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
/* Get the newer search from the history list and
|
/* Get the newer search from the history list and
|
||||||
* save it in answer. If there is no newer search,
|
* save it in answer. If there is no newer search,
|
||||||
|
@ -1071,7 +1071,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
if (s && s->scfunc == do_help_void) {
|
if (s && s->scfunc == DO_HELP_VOID) {
|
||||||
update_statusbar_line(answer, statusbar_x);
|
update_statusbar_line(answer, statusbar_x);
|
||||||
|
|
||||||
/* This key has a shortcut list entry when it's used to
|
/* This key has a shortcut list entry when it's used to
|
||||||
|
@ -1116,7 +1116,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||||
* we've finished putting in an answer, reset the statusbar cursor
|
* we've finished putting in an answer, reset the statusbar cursor
|
||||||
* position too. */
|
* position too. */
|
||||||
if (s) {
|
if (s) {
|
||||||
if (s->scfunc == (void *) cancel_msg || s->scfunc == do_enter ||
|
if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER ||
|
||||||
ran_func) {
|
ran_func) {
|
||||||
statusbar_x = old_statusbar_x;
|
statusbar_x = old_statusbar_x;
|
||||||
statusbar_pww = old_pww;
|
statusbar_pww = old_pww;
|
||||||
|
@ -1203,9 +1203,9 @@ int do_prompt(bool allow_tabs,
|
||||||
|
|
||||||
/* If we left the prompt via Cancel or Enter, set the return value
|
/* If we left the prompt via Cancel or Enter, set the return value
|
||||||
* properly. */
|
* properly. */
|
||||||
if (s && s->scfunc == (void *) cancel_msg)
|
if (s && s->scfunc == CANCEL_MSG)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
else if (s && s->scfunc == do_enter)
|
else if (s && s->scfunc == DO_ENTER)
|
||||||
retval = (*answer == '\0') ? -2 : 0;
|
retval = (*answer == '\0') ? -2 : 0;
|
||||||
|
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
@ -1313,7 +1313,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
||||||
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
||||||
|
|
||||||
if (s && s->scfunc == (void *) cancel_msg)
|
if (s && s->scfunc == CANCEL_MSG)
|
||||||
ok = -1;
|
ok = -1;
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
else if (kbinput == KEY_MOUSE) {
|
else if (kbinput == KEY_MOUSE) {
|
||||||
|
@ -1345,7 +1345,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_MOUSE */
|
#endif /* !DISABLE_MOUSE */
|
||||||
else if (s && s->scfunc == total_refresh) {
|
else if (s && s->scfunc == TOTAL_REFRESH) {
|
||||||
total_redraw();
|
total_redraw();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -743,7 +743,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||||
#endif
|
#endif
|
||||||
const sc *get_shortcut(int menu, int *kbinput, bool
|
const sc *get_shortcut(int menu, int *kbinput, bool
|
||||||
*meta_key, bool *func_key);
|
*meta_key, bool *func_key);
|
||||||
const sc *first_sc_for(int menu, void *func);
|
const sc *first_sc_for(int menu, short func);
|
||||||
void blank_line(WINDOW *win, int y, int x, int n);
|
void blank_line(WINDOW *win, int y, int x, int n);
|
||||||
void blank_titlebar(void);
|
void blank_titlebar(void);
|
||||||
void blank_topbar(void);
|
void blank_topbar(void);
|
||||||
|
@ -783,7 +783,7 @@ int strtomenu(char *input);
|
||||||
void assign_keyinfo(sc *s);
|
void assign_keyinfo(sc *s);
|
||||||
void xon_complaint(void);
|
void xon_complaint(void);
|
||||||
void xoff_complaint(void);
|
void xoff_complaint(void);
|
||||||
int sc_seq_or (void *func, int defaultval);
|
int sc_seq_or (short func, int defaultval);
|
||||||
void do_suspend_void(void);
|
void do_suspend_void(void);
|
||||||
|
|
||||||
const char *cancel_msg;
|
const char *cancel_msg;
|
||||||
|
@ -814,6 +814,7 @@ const char *prepend_msg;
|
||||||
const char *backup_file_msg;
|
const char *backup_file_msg;
|
||||||
const char *gototext_msg;
|
const char *gototext_msg;
|
||||||
const char *new_buffer_msg;
|
const char *new_buffer_msg;
|
||||||
|
void iso_me_harder_funcmap(short func);
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
const char *regexp_msg;
|
const char *regexp_msg;
|
||||||
|
|
|
@ -427,7 +427,7 @@ void parse_keybinding(char *ptr)
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n",
|
fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n",
|
||||||
&newsc, &newsc->scfunc, menu);
|
&newsc, newsc->scfunc, menu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ static void check_vitals_mapped(void)
|
||||||
subnfunc *f;
|
subnfunc *f;
|
||||||
int v;
|
int v;
|
||||||
#define VITALS 5
|
#define VITALS 5
|
||||||
void *vitals[VITALS] = { do_exit, do_exit, (void *) cancel_msg, (void *) cancel_msg, (void *) cancel_msg };
|
short vitals[VITALS] = { DO_EXIT, DO_EXIT, CANCEL_MSG, CANCEL_MSG, CANCEL_MSG };
|
||||||
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
||||||
|
|
||||||
for (v = 0; v < VITALS; v++) {
|
for (v = 0; v < VITALS; v++) {
|
||||||
|
|
16
src/search.c
16
src/search.c
|
@ -137,7 +137,7 @@ int search_init(bool replacing, bool use_answer)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char *buf;
|
char *buf;
|
||||||
sc *s;
|
sc *s;
|
||||||
void *func = NULL;
|
char func = 0;
|
||||||
bool meta_key = FALSE, func_key = FALSE;
|
bool meta_key = FALSE, func_key = FALSE;
|
||||||
static char *backupstring = NULL;
|
static char *backupstring = NULL;
|
||||||
/* The search string we'll be using. */
|
/* The search string we'll be using. */
|
||||||
|
@ -235,26 +235,26 @@ int search_init(bool replacing, bool use_answer)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
} else if (func == (void *) case_sens_msg) {
|
} else if (func == CASE_SENS_MSG) {
|
||||||
TOGGLE(CASE_SENSITIVE);
|
TOGGLE(CASE_SENSITIVE);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (func == (void *) backwards_msg) {
|
} else if (func == BACKWARDS_MSG) {
|
||||||
TOGGLE(BACKWARDS_SEARCH);
|
TOGGLE(BACKWARDS_SEARCH);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
} else if (func == (void *) regexp_msg) {
|
} else if (func == REGEXP_MSG) {
|
||||||
TOGGLE(USE_REGEXP);
|
TOGGLE(USE_REGEXP);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
} else if (func == (void *) do_replace ||
|
} else if (func == DO_REPLACE ||
|
||||||
func == (void *) no_replace_msg) {
|
func == NO_REPLACE_MSG) {
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
return -2; /* Call the opposite search function. */
|
return -2; /* Call the opposite search function. */
|
||||||
} else if (func == do_gotolinecolumn_void) {
|
} else if (func == DO_GOTOLINECOLUMN_VOID) {
|
||||||
do_gotolinecolumn(openfile->current->lineno,
|
do_gotolinecolumn(openfile->current->lineno,
|
||||||
openfile->placewewant + 1, TRUE, TRUE, FALSE,
|
openfile->placewewant + 1, TRUE, TRUE, FALSE,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
@ -1021,7 +1021,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||||
|
|
||||||
|
|
||||||
s = get_shortcut(currmenu, &i, &meta_key, &func_key);
|
s = get_shortcut(currmenu, &i, &meta_key, &func_key);
|
||||||
if (s && s->scfunc == (void *) gototext_msg) {
|
if (s && s->scfunc == GOTOTEXT_MSG) {
|
||||||
/* Keep answer up on the statusbar. */
|
/* Keep answer up on the statusbar. */
|
||||||
search_init(TRUE, TRUE);
|
search_init(TRUE, TRUE);
|
||||||
|
|
||||||
|
|
|
@ -2220,7 +2220,7 @@ void do_justify(bool full_justify)
|
||||||
&finished, FALSE);
|
&finished, FALSE);
|
||||||
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
||||||
|
|
||||||
if (s && s->scfunc == do_uncut_text) {
|
if (s && s->scfunc == DO_UNCUT_TEXT) {
|
||||||
/* Splice the justify buffer back into the file, but only if we
|
/* Splice the justify buffer back into the file, but only if we
|
||||||
* actually justified something. */
|
* actually justified something. */
|
||||||
if (first_par_line != NULL) {
|
if (first_par_line != NULL) {
|
||||||
|
|
110
src/winio.c
110
src/winio.c
|
@ -489,36 +489,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
if (retval != ERR) {
|
if (retval != ERR) {
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case NANO_CONTROL_8:
|
case NANO_CONTROL_8:
|
||||||
retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) :
|
retval = ISSET(REBIND_DELETE) ? sc_seq_or(DO_DELETE, 0) :
|
||||||
sc_seq_or(do_backspace, 0);
|
sc_seq_or(DO_BACKSPACE, 0);
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
#ifdef KEY_SDOWN
|
#ifdef KEY_SDOWN
|
||||||
/* ncurses and Slang don't support KEY_SDOWN. */
|
/* ncurses and Slang don't support KEY_SDOWN. */
|
||||||
case KEY_SDOWN:
|
case KEY_SDOWN:
|
||||||
#endif
|
#endif
|
||||||
retval = sc_seq_or((void *) do_down_void, *kbinput);
|
retval = sc_seq_or(DO_DOWN_VOID, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
#ifdef KEY_SUP
|
#ifdef KEY_SUP
|
||||||
/* ncurses and Slang don't support KEY_SUP. */
|
/* ncurses and Slang don't support KEY_SUP. */
|
||||||
case KEY_SUP:
|
case KEY_SUP:
|
||||||
#endif
|
#endif
|
||||||
retval = sc_seq_or((void *) do_up_void, *kbinput);
|
retval = sc_seq_or(DO_UP_VOID, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_LEFT:
|
case KEY_LEFT:
|
||||||
#ifdef KEY_SLEFT
|
#ifdef KEY_SLEFT
|
||||||
/* Slang doesn't support KEY_SLEFT. */
|
/* Slang doesn't support KEY_SLEFT. */
|
||||||
case KEY_SLEFT:
|
case KEY_SLEFT:
|
||||||
#endif
|
#endif
|
||||||
retval = sc_seq_or((void *) do_left, *kbinput);
|
retval = sc_seq_or(DO_LEFT, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
#ifdef KEY_SRIGHT
|
#ifdef KEY_SRIGHT
|
||||||
/* Slang doesn't support KEY_SRIGHT. */
|
/* Slang doesn't support KEY_SRIGHT. */
|
||||||
case KEY_SRIGHT:
|
case KEY_SRIGHT:
|
||||||
#endif
|
#endif
|
||||||
retval = sc_seq_or((void *) do_right, *kbinput);
|
retval = sc_seq_or(DO_RIGHT, *kbinput);
|
||||||
break;
|
break;
|
||||||
#ifdef KEY_SHOME
|
#ifdef KEY_SHOME
|
||||||
/* HP-UX 10-11 and Slang don't support KEY_SHOME. */
|
/* HP-UX 10-11 and Slang don't support KEY_SHOME. */
|
||||||
|
@ -526,36 +526,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
#endif
|
#endif
|
||||||
case KEY_A1: /* Home (7) on numeric keypad with
|
case KEY_A1: /* Home (7) on numeric keypad with
|
||||||
* NumLock off. */
|
* NumLock off. */
|
||||||
retval = sc_seq_or((void *) do_home, *kbinput);
|
retval = sc_seq_or(DO_HOME, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
retval = sc_seq_or((void *) do_backspace, *kbinput);
|
retval = sc_seq_or(DO_BACKSPACE, *kbinput);
|
||||||
break;
|
break;
|
||||||
#ifdef KEY_SDC
|
#ifdef KEY_SDC
|
||||||
/* Slang doesn't support KEY_SDC. */
|
/* Slang doesn't support KEY_SDC. */
|
||||||
case KEY_SDC:
|
case KEY_SDC:
|
||||||
if (ISSET(REBIND_DELETE))
|
if (ISSET(REBIND_DELETE))
|
||||||
retval = sc_seq_or((void *) do_delete, *kbinput);
|
retval = sc_seq_or(DO_DELETE, *kbinput);
|
||||||
else
|
else
|
||||||
retval = sc_seq_or((void *) do_backspace, *kbinput);
|
retval = sc_seq_or(DO_BACKSPACE, *kbinput);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEY_SIC
|
#ifdef KEY_SIC
|
||||||
/* Slang doesn't support KEY_SIC. */
|
/* Slang doesn't support KEY_SIC. */
|
||||||
case KEY_SIC:
|
case KEY_SIC:
|
||||||
retval = sc_seq_or((void *) do_insertfile_void, *kbinput);
|
retval = sc_seq_or(DO_INSERTFILE_VOID, *kbinput);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case KEY_C3: /* PageDown (4) on numeric keypad with
|
case KEY_C3: /* PageDown (4) on numeric keypad with
|
||||||
* NumLock off. */
|
* NumLock off. */
|
||||||
retval = sc_seq_or((void *) do_page_down, *kbinput);
|
retval = sc_seq_or(DO_PAGE_DOWN, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_A3: /* PageUp (9) on numeric keypad with
|
case KEY_A3: /* PageUp (9) on numeric keypad with
|
||||||
* NumLock off. */
|
* NumLock off. */
|
||||||
retval = sc_seq_or((void *) do_page_up, *kbinput);
|
retval = sc_seq_or(DO_PAGE_UP, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_ENTER:
|
case KEY_ENTER:
|
||||||
retval = sc_seq_or((void *) do_enter, *kbinput);
|
retval = sc_seq_or(DO_ENTER, *kbinput);
|
||||||
break;
|
break;
|
||||||
case KEY_B2: /* Center (5) on numeric keypad with
|
case KEY_B2: /* Center (5) on numeric keypad with
|
||||||
* NumLock off. */
|
* NumLock off. */
|
||||||
|
@ -567,7 +567,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
|
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
|
||||||
case KEY_SEND:
|
case KEY_SEND:
|
||||||
#endif
|
#endif
|
||||||
retval = sc_seq_or((void *) do_end, *kbinput);
|
retval = sc_seq_or(DO_END, *kbinput);
|
||||||
break;
|
break;
|
||||||
#ifdef KEY_BEG
|
#ifdef KEY_BEG
|
||||||
/* Slang doesn't support KEY_BEG. */
|
/* Slang doesn't support KEY_BEG. */
|
||||||
|
@ -583,7 +583,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
/* Slang doesn't support KEY_SCANCEL. */
|
/* Slang doesn't support KEY_SCANCEL. */
|
||||||
case KEY_SCANCEL:
|
case KEY_SCANCEL:
|
||||||
#endif
|
#endif
|
||||||
retval = first_sc_for(currmenu, (void *) cancel_msg)->seq;
|
retval = first_sc_for(currmenu, CANCEL_MSG)->seq;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEY_SBEG
|
#ifdef KEY_SBEG
|
||||||
|
@ -596,13 +596,13 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||||
#ifdef KEY_SSUSPEND
|
#ifdef KEY_SSUSPEND
|
||||||
/* Slang doesn't support KEY_SSUSPEND. */
|
/* Slang doesn't support KEY_SSUSPEND. */
|
||||||
case KEY_SSUSPEND:
|
case KEY_SSUSPEND:
|
||||||
retval = sc_seq_or(do_suspend_void, 0);
|
retval = sc_seq_or(DO_SUSPEND_VOID, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEY_SUSPEND
|
#ifdef KEY_SUSPEND
|
||||||
/* Slang doesn't support KEY_SUSPEND. */
|
/* Slang doesn't support KEY_SUSPEND. */
|
||||||
case KEY_SUSPEND:
|
case KEY_SUSPEND:
|
||||||
retval = sc_seq_or(do_suspend_void, 0);
|
retval = sc_seq_or(DO_SUSPEND_VOID, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef PDCURSES
|
#ifdef PDCURSES
|
||||||
|
@ -750,15 +750,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
retval = KEY_B2;
|
retval = KEY_B2;
|
||||||
break;
|
break;
|
||||||
case 'F': /* Esc O F == End on xterm/Terminal. */
|
case 'F': /* Esc O F == End on xterm/Terminal. */
|
||||||
retval = sc_seq_or(do_end, 0);
|
retval = sc_seq_or(DO_END, 0);
|
||||||
break;
|
break;
|
||||||
case 'H': /* Esc O H == Home on xterm/Terminal. */
|
case 'H': /* Esc O H == Home on xterm/Terminal. */
|
||||||
retval = sc_seq_or(do_home, 0);;
|
retval = sc_seq_or(DO_HOME, 0);;
|
||||||
break;
|
break;
|
||||||
case 'M': /* Esc O M == Enter on numeric keypad with
|
case 'M': /* Esc O M == Enter on numeric keypad with
|
||||||
* NumLock off on VT100/VT220/VT320/xterm/
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
* rxvt/Eterm. */
|
* rxvt/Eterm. */
|
||||||
retval = sc_seq_or(do_home, 0);;
|
retval = sc_seq_or(DO_HOME, 0);;
|
||||||
break;
|
break;
|
||||||
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach
|
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach
|
||||||
* console. */
|
* console. */
|
||||||
|
@ -823,7 +823,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
case 'n': /* Esc O n == Delete (.) on numeric keypad
|
case 'n': /* Esc O n == Delete (.) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* xterm/rxvt/Eterm/Terminal. */
|
* xterm/rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_delete, 0);;
|
retval = sc_seq_or(DO_DELETE, 0);;
|
||||||
break;
|
break;
|
||||||
case 'o': /* Esc O o == '/' on numeric keypad with
|
case 'o': /* Esc O o == '/' on numeric keypad with
|
||||||
* NumLock off on VT100/VT220/VT320/xterm/
|
* NumLock off on VT100/VT220/VT320/xterm/
|
||||||
|
@ -833,27 +833,27 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
case 'p': /* Esc O p == Insert (0) on numeric keypad
|
case 'p': /* Esc O p == Insert (0) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||||
break;
|
break;
|
||||||
case 'q': /* Esc O q == End (1) on numeric keypad
|
case 'q': /* Esc O q == End (1) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_end, 0);;
|
retval = sc_seq_or(DO_END, 0);;
|
||||||
break;
|
break;
|
||||||
case 'r': /* Esc O r == Down (2) on numeric keypad
|
case 'r': /* Esc O r == Down (2) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_down_void, 0);;
|
retval = sc_seq_or(DO_DOWN_VOID, 0);;
|
||||||
break;
|
break;
|
||||||
case 's': /* Esc O s == PageDown (3) on numeric
|
case 's': /* Esc O s == PageDown (3) on numeric
|
||||||
* keypad with NumLock off on VT100/VT220/
|
* keypad with NumLock off on VT100/VT220/
|
||||||
* VT320/rxvt/Eterm/Terminal. */
|
* VT320/rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_page_down, 0);;
|
retval = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||||
break;
|
break;
|
||||||
case 't': /* Esc O t == Left (4) on numeric keypad
|
case 't': /* Esc O t == Left (4) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_left, 0);;
|
retval = sc_seq_or(DO_LEFT, 0);;
|
||||||
break;
|
break;
|
||||||
case 'u': /* Esc O u == Center (5) on numeric keypad
|
case 'u': /* Esc O u == Center (5) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
|
@ -863,22 +863,22 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
case 'v': /* Esc O v == Right (6) on numeric keypad
|
case 'v': /* Esc O v == Right (6) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_right, 0);
|
retval = sc_seq_or(DO_RIGHT, 0);
|
||||||
break;
|
break;
|
||||||
case 'w': /* Esc O w == Home (7) on numeric keypad
|
case 'w': /* Esc O w == Home (7) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_home, 0);;
|
retval = sc_seq_or(DO_HOME, 0);
|
||||||
break;
|
break;
|
||||||
case 'x': /* Esc O x == Up (8) on numeric keypad
|
case 'x': /* Esc O x == Up (8) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_up_void, 0);;
|
retval = sc_seq_or(DO_UP_VOID, 0);
|
||||||
break;
|
break;
|
||||||
case 'y': /* Esc O y == PageUp (9) on numeric keypad
|
case 'y': /* Esc O y == PageUp (9) on numeric keypad
|
||||||
* with NumLock off on VT100/VT220/VT320/
|
* with NumLock off on VT100/VT220/VT320/
|
||||||
* rxvt/Eterm/Terminal. */
|
* rxvt/Eterm/Terminal. */
|
||||||
retval = sc_seq_or(do_up, 0);;
|
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -972,7 +972,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
break;
|
break;
|
||||||
default: /* Esc [ 1 ~ == Home on
|
default: /* Esc [ 1 ~ == Home on
|
||||||
* VT320/Linux console. */
|
* VT320/Linux console. */
|
||||||
retval = sc_seq_or(do_home, 0);;
|
retval = sc_seq_or(DO_HOME, 0);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1023,40 +1023,40 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
default: /* Esc [ 2 ~ == Insert on
|
default: /* Esc [ 2 ~ == Insert on
|
||||||
* VT220/VT320/Linux console/
|
* VT220/VT320/Linux console/
|
||||||
* xterm/Terminal. */
|
* xterm/Terminal. */
|
||||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
||||||
* Linux console/xterm/Terminal. */
|
* Linux console/xterm/Terminal. */
|
||||||
retval = sc_seq_or(do_delete, 0);;
|
retval = sc_seq_or(DO_DELETE, 0);;
|
||||||
break;
|
break;
|
||||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
|
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
|
||||||
* console/xterm. */
|
* console/xterm. */
|
||||||
retval = sc_seq_or(do_end, 0);;
|
retval = sc_seq_or(DO_END, 0);;
|
||||||
break;
|
break;
|
||||||
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
||||||
* Linux console/xterm/Terminal;
|
* Linux console/xterm/Terminal;
|
||||||
* Esc [ 5 ^ == PageUp on Eterm. */
|
* Esc [ 5 ^ == PageUp on Eterm. */
|
||||||
retval = sc_seq_or(do_page_up, 0);;
|
retval = sc_seq_or(DO_PAGE_UP, 0);;
|
||||||
break;
|
break;
|
||||||
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
||||||
* Linux console/xterm/Terminal;
|
* Linux console/xterm/Terminal;
|
||||||
* Esc [ 6 ^ == PageDown on Eterm. */
|
* Esc [ 6 ^ == PageDown on Eterm. */
|
||||||
retval = sc_seq_or(do_page_down, 0);;
|
retval = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||||
break;
|
break;
|
||||||
case '7': /* Esc [ 7 ~ == Home on rxvt. */
|
case '7': /* Esc [ 7 ~ == Home on rxvt. */
|
||||||
retval = sc_seq_or(do_home, 0);
|
retval = sc_seq_or(DO_HOME, 0);
|
||||||
break;
|
break;
|
||||||
case '8': /* Esc [ 8 ~ == End on rxvt. */
|
case '8': /* Esc [ 8 ~ == End on rxvt. */
|
||||||
retval = sc_seq_or(do_end, 0);
|
retval = sc_seq_or(DO_END, 0);
|
||||||
break;
|
break;
|
||||||
case '9': /* Esc [ 9 == Delete on Mach console. */
|
case '9': /* Esc [ 9 == Delete on Mach console. */
|
||||||
retval = sc_seq_or(do_delete, 0);;
|
retval = sc_seq_or(DO_DELETE, 0);;
|
||||||
break;
|
break;
|
||||||
case '@': /* Esc [ @ == Insert on Mach console. */
|
case '@': /* Esc [ @ == Insert on Mach console. */
|
||||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||||
break;
|
break;
|
||||||
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
|
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
|
||||||
* console/FreeBSD console/Mach console/
|
* console/FreeBSD console/Mach console/
|
||||||
|
@ -1079,23 +1079,23 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
break;
|
break;
|
||||||
case 'F': /* Esc [ F == End on FreeBSD
|
case 'F': /* Esc [ F == End on FreeBSD
|
||||||
* console/Eterm. */
|
* console/Eterm. */
|
||||||
retval = sc_seq_or(do_end, 0);
|
retval = sc_seq_or(DO_END, 0);
|
||||||
break;
|
break;
|
||||||
case 'G': /* Esc [ G == PageDown on FreeBSD
|
case 'G': /* Esc [ G == PageDown on FreeBSD
|
||||||
* console. */
|
* console. */
|
||||||
retval = sc_seq_or(do_page_down, 0);
|
retval = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||||
break;
|
break;
|
||||||
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
|
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
|
||||||
* console/Mach console/Eterm. */
|
* console/Mach console/Eterm. */
|
||||||
retval = sc_seq_or(do_home, 0);
|
retval = sc_seq_or(DO_HOME, 0);
|
||||||
break;
|
break;
|
||||||
case 'I': /* Esc [ I == PageUp on FreeBSD
|
case 'I': /* Esc [ I == PageUp on FreeBSD
|
||||||
* console. */
|
* console. */
|
||||||
retval = sc_seq_or(do_page_up, 0);
|
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||||
break;
|
break;
|
||||||
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD
|
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD
|
||||||
* console. */
|
* console. */
|
||||||
retval = sc_seq_or(do_insertfile_void, 0);
|
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);
|
||||||
break;
|
break;
|
||||||
case 'M': /* Esc [ M == F1 on FreeBSD console. */
|
case 'M': /* Esc [ M == F1 on FreeBSD console. */
|
||||||
retval = KEY_F(1);
|
retval = KEY_F(1);
|
||||||
|
@ -1143,10 +1143,10 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
retval = KEY_F(8);
|
retval = KEY_F(8);
|
||||||
break;
|
break;
|
||||||
case 'U': /* Esc [ U == PageDown on Mach console. */
|
case 'U': /* Esc [ U == PageDown on Mach console. */
|
||||||
retval = sc_seq_or(do_page_down, 0);
|
retval = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||||
break;
|
break;
|
||||||
case 'V': /* Esc [ V == PageUp on Mach console. */
|
case 'V': /* Esc [ V == PageUp on Mach console. */
|
||||||
retval = sc_seq_or(do_page_up, 0);
|
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||||
break;
|
break;
|
||||||
case 'W': /* Esc [ W == F11 on FreeBSD console. */
|
case 'W': /* Esc [ W == F11 on FreeBSD console. */
|
||||||
retval = KEY_F(11);
|
retval = KEY_F(11);
|
||||||
|
@ -1155,7 +1155,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||||
retval = KEY_F(12);
|
retval = KEY_F(12);
|
||||||
break;
|
break;
|
||||||
case 'Y': /* Esc [ Y == End on Mach console. */
|
case 'Y': /* Esc [ Y == End on Mach console. */
|
||||||
retval = sc_seq_or(do_end, 0);
|
retval = sc_seq_or(DO_END, 0);
|
||||||
break;
|
break;
|
||||||
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
|
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
|
||||||
retval = KEY_F(14);
|
retval = KEY_F(14);
|
||||||
|
@ -1212,13 +1212,13 @@ int get_escape_seq_abcd(int kbinput)
|
||||||
{
|
{
|
||||||
switch (tolower(kbinput)) {
|
switch (tolower(kbinput)) {
|
||||||
case 'a':
|
case 'a':
|
||||||
return sc_seq_or(do_up_void, 0);;
|
return sc_seq_or(DO_UP_VOID, 0);;
|
||||||
case 'b':
|
case 'b':
|
||||||
return sc_seq_or(do_down_void, 0);;
|
return sc_seq_or(DO_DOWN_VOID, 0);;
|
||||||
case 'c':
|
case 'c':
|
||||||
return sc_seq_or(do_right, 0);;
|
return sc_seq_or(DO_RIGHT, 0);;
|
||||||
case 'd':
|
case 'd':
|
||||||
return sc_seq_or(do_left, 0);;
|
return sc_seq_or(DO_LEFT, 0);;
|
||||||
default:
|
default:
|
||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
@ -1709,7 +1709,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||||
|
|
||||||
/* And put back the equivalent key. */
|
/* And put back the equivalent key. */
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
const sc *s = first_sc_for(currmenu, (void *) f->scfunc);
|
const sc *s = first_sc_for(currmenu, f->scfunc);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
unget_kbinput(s->seq, s->type == META, FALSE);
|
unget_kbinput(s->seq, s->type == META, FALSE);
|
||||||
}
|
}
|
||||||
|
@ -1738,7 +1738,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||||
* wheel is equivalent to moving down three lines. */
|
* wheel is equivalent to moving down three lines. */
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
|
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
|
||||||
sc_seq_or(do_up_void, 0) : sc_seq_or(do_down_void, 0);, FALSE,
|
sc_seq_or(do_up_void, 0) : sc_seq_or(DO_DOWN_VOID, 0);, FALSE,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue