tweaks: shorten the name of two record elements
Exclude the confusing, pleonastic 'sc' abbreviation from their names.
Этот коммит содержится в:
родитель
e55227f65f
Коммит
ffebd31cbb
184
src/global.c
184
src/global.c
@ -254,7 +254,7 @@ size_t length_of_list(int menu)
|
|||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|
||||||
for (f = allfuncs; f != NULL; f = f->next)
|
for (f = allfuncs; f != NULL; f = f->next)
|
||||||
if ((f->menus & menu) && first_sc_for(menu, f->scfunc) != NULL)
|
if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
@ -337,7 +337,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
|
|||||||
tailfunc = f;
|
tailfunc = f;
|
||||||
|
|
||||||
f->next = NULL;
|
f->next = NULL;
|
||||||
f->scfunc = func;
|
f->func = func;
|
||||||
f->menus = menus;
|
f->menus = menus;
|
||||||
f->desc = desc;
|
f->desc = desc;
|
||||||
f->viewok = viewok;
|
f->viewok = viewok;
|
||||||
@ -371,7 +371,7 @@ void add_to_sclist(int menus, const char *scstring, const int keycode,
|
|||||||
|
|
||||||
/* Fill in the data. */
|
/* Fill in the data. */
|
||||||
s->menus = menus;
|
s->menus = menus;
|
||||||
s->scfunc = func;
|
s->func = func;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
s->toggle = toggle;
|
s->toggle = toggle;
|
||||||
if (toggle)
|
if (toggle)
|
||||||
@ -391,7 +391,7 @@ const sc *first_sc_for(int menu, void (*func)(void))
|
|||||||
const sc *s;
|
const sc *s;
|
||||||
|
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if ((s->menus & menu) && s->scfunc == func)
|
if ((s->menus & menu) && s->func == func)
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -420,7 +420,7 @@ functionptrtype func_from_key(int *kbinput)
|
|||||||
const sc *s = get_shortcut(kbinput);
|
const sc *s = get_shortcut(kbinput);
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
return s->scfunc;
|
return s->func;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1364,8 +1364,8 @@ void shortcut_init(void)
|
|||||||
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
||||||
{
|
{
|
||||||
for (sc *s = sclist; s != NULL; s = s->next)
|
for (sc *s = sclist; s != NULL; s = s->next)
|
||||||
if (s->scfunc == oldfunc)
|
if (s->func == oldfunc)
|
||||||
s->scfunc = newfunc;
|
s->func = newfunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_lint_or_format_shortcuts(void)
|
void set_lint_or_format_shortcuts(void)
|
||||||
@ -1390,20 +1390,20 @@ void set_spell_shortcuts(void)
|
|||||||
void execute(const sc *shortcut)
|
void execute(const sc *shortcut)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
if (shortcut->scfunc == implant)
|
if (shortcut->func == implant)
|
||||||
/* Insert the corresponding string into the keyboard buffer. */
|
/* Insert the corresponding string into the keyboard buffer. */
|
||||||
for (int i = strlen(shortcut->expansion); i > 0; i--)
|
for (int i = strlen(shortcut->expansion); i > 0; i--)
|
||||||
put_back(shortcut->expansion[i - 1]);
|
put_back(shortcut->expansion[i - 1]);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
shortcut->scfunc();
|
shortcut->func();
|
||||||
}
|
}
|
||||||
|
|
||||||
const subnfunc *sctofunc(const sc *s)
|
const subnfunc *sctofunc(const sc *s)
|
||||||
{
|
{
|
||||||
subnfunc *f = allfuncs;
|
subnfunc *f = allfuncs;
|
||||||
|
|
||||||
while (f != NULL && f->scfunc != s->scfunc)
|
while (f != NULL && f->func != s->func)
|
||||||
f = f->next;
|
f = f->next;
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@ -1472,207 +1472,207 @@ sc *strtosc(const char *input)
|
|||||||
|
|
||||||
#ifdef ENABLE_HELP
|
#ifdef ENABLE_HELP
|
||||||
if (!strcasecmp(input, "help"))
|
if (!strcasecmp(input, "help"))
|
||||||
s->scfunc = do_help_void;
|
s->func = do_help_void;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!strcasecmp(input, "cancel"))
|
if (!strcasecmp(input, "cancel"))
|
||||||
s->scfunc = do_cancel;
|
s->func = do_cancel;
|
||||||
else if (!strcasecmp(input, "exit"))
|
else if (!strcasecmp(input, "exit"))
|
||||||
s->scfunc = do_exit;
|
s->func = do_exit;
|
||||||
else if (!strcasecmp(input, "discardbuffer"))
|
else if (!strcasecmp(input, "discardbuffer"))
|
||||||
s->scfunc = discard_buffer;
|
s->func = discard_buffer;
|
||||||
else if (!strcasecmp(input, "writeout"))
|
else if (!strcasecmp(input, "writeout"))
|
||||||
s->scfunc = do_writeout_void;
|
s->func = do_writeout_void;
|
||||||
else if (!strcasecmp(input, "savefile"))
|
else if (!strcasecmp(input, "savefile"))
|
||||||
s->scfunc = do_savefile;
|
s->func = do_savefile;
|
||||||
else if (!strcasecmp(input, "insert"))
|
else if (!strcasecmp(input, "insert"))
|
||||||
s->scfunc = do_insertfile_void;
|
s->func = do_insertfile_void;
|
||||||
else if (!strcasecmp(input, "whereis"))
|
else if (!strcasecmp(input, "whereis"))
|
||||||
s->scfunc = do_search_forward;
|
s->func = do_search_forward;
|
||||||
else if (!strcasecmp(input, "wherewas"))
|
else if (!strcasecmp(input, "wherewas"))
|
||||||
s->scfunc = do_search_backward;
|
s->func = do_search_backward;
|
||||||
else if (!strcasecmp(input, "searchagain"))
|
else if (!strcasecmp(input, "searchagain"))
|
||||||
s->scfunc = do_research;
|
s->func = do_research;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (!strcasecmp(input, "findprevious"))
|
else if (!strcasecmp(input, "findprevious"))
|
||||||
s->scfunc = do_findprevious;
|
s->func = do_findprevious;
|
||||||
else if (!strcasecmp(input, "findnext"))
|
else if (!strcasecmp(input, "findnext"))
|
||||||
s->scfunc = do_findnext;
|
s->func = do_findnext;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcasecmp(input, "replace"))
|
else if (!strcasecmp(input, "replace"))
|
||||||
s->scfunc = do_replace;
|
s->func = do_replace;
|
||||||
else if (!strcasecmp(input, "cut"))
|
else if (!strcasecmp(input, "cut"))
|
||||||
s->scfunc = do_cut_text_void;
|
s->func = do_cut_text_void;
|
||||||
else if (!strcasecmp(input, "uncut"))
|
else if (!strcasecmp(input, "uncut"))
|
||||||
s->scfunc = do_uncut_text;
|
s->func = do_uncut_text;
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (!strcasecmp(input, "cutrestoffile"))
|
else if (!strcasecmp(input, "cutrestoffile"))
|
||||||
s->scfunc = do_cut_till_eof;
|
s->func = do_cut_till_eof;
|
||||||
else if (!strcasecmp(input, "copytext"))
|
else if (!strcasecmp(input, "copytext"))
|
||||||
s->scfunc = do_copy_text;
|
s->func = do_copy_text;
|
||||||
else if (!strcasecmp(input, "mark"))
|
else if (!strcasecmp(input, "mark"))
|
||||||
s->scfunc = do_mark;
|
s->func = do_mark;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
else if (!strcasecmp(input, "tospell") ||
|
else if (!strcasecmp(input, "tospell") ||
|
||||||
!strcasecmp(input, "speller"))
|
!strcasecmp(input, "speller"))
|
||||||
s->scfunc = do_spell;
|
s->func = do_spell;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
else if (!strcasecmp(input, "linter"))
|
else if (!strcasecmp(input, "linter"))
|
||||||
s->scfunc = do_linter;
|
s->func = do_linter;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcasecmp(input, "curpos"))
|
else if (!strcasecmp(input, "curpos"))
|
||||||
s->scfunc = do_cursorpos_void;
|
s->func = do_cursorpos_void;
|
||||||
else if (!strcasecmp(input, "gotoline"))
|
else if (!strcasecmp(input, "gotoline"))
|
||||||
s->scfunc = do_gotolinecolumn_void;
|
s->func = do_gotolinecolumn_void;
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
else if (!strcasecmp(input, "justify"))
|
else if (!strcasecmp(input, "justify"))
|
||||||
s->scfunc = do_justify_void;
|
s->func = do_justify_void;
|
||||||
else if (!strcasecmp(input, "fulljustify"))
|
else if (!strcasecmp(input, "fulljustify"))
|
||||||
s->scfunc = do_full_justify;
|
s->func = do_full_justify;
|
||||||
else if (!strcasecmp(input, "beginpara"))
|
else if (!strcasecmp(input, "beginpara"))
|
||||||
s->scfunc = do_para_begin_void;
|
s->func = do_para_begin_void;
|
||||||
else if (!strcasecmp(input, "endpara"))
|
else if (!strcasecmp(input, "endpara"))
|
||||||
s->scfunc = do_para_end_void;
|
s->func = do_para_end_void;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMMENT
|
#ifdef ENABLE_COMMENT
|
||||||
else if (!strcasecmp(input, "comment"))
|
else if (!strcasecmp(input, "comment"))
|
||||||
s->scfunc = do_comment;
|
s->func = do_comment;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_WORDCOMPLETION
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
else if (!strcasecmp(input, "complete"))
|
else if (!strcasecmp(input, "complete"))
|
||||||
s->scfunc = complete_a_word;
|
s->func = complete_a_word;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (!strcasecmp(input, "indent"))
|
else if (!strcasecmp(input, "indent"))
|
||||||
s->scfunc = do_indent;
|
s->func = do_indent;
|
||||||
else if (!strcasecmp(input, "unindent"))
|
else if (!strcasecmp(input, "unindent"))
|
||||||
s->scfunc = do_unindent;
|
s->func = do_unindent;
|
||||||
else if (!strcasecmp(input, "scrollup"))
|
else if (!strcasecmp(input, "scrollup"))
|
||||||
s->scfunc = do_scroll_up;
|
s->func = do_scroll_up;
|
||||||
else if (!strcasecmp(input, "scrolldown"))
|
else if (!strcasecmp(input, "scrolldown"))
|
||||||
s->scfunc = do_scroll_down;
|
s->func = do_scroll_down;
|
||||||
else if (!strcasecmp(input, "cutwordleft"))
|
else if (!strcasecmp(input, "cutwordleft"))
|
||||||
s->scfunc = do_cut_prev_word;
|
s->func = do_cut_prev_word;
|
||||||
else if (!strcasecmp(input, "cutwordright"))
|
else if (!strcasecmp(input, "cutwordright"))
|
||||||
s->scfunc = do_cut_next_word;
|
s->func = do_cut_next_word;
|
||||||
else if (!strcasecmp(input, "findbracket"))
|
else if (!strcasecmp(input, "findbracket"))
|
||||||
s->scfunc = do_find_bracket;
|
s->func = do_find_bracket;
|
||||||
else if (!strcasecmp(input, "wordcount"))
|
else if (!strcasecmp(input, "wordcount"))
|
||||||
s->scfunc = do_wordlinechar_count;
|
s->func = do_wordlinechar_count;
|
||||||
else if (!strcasecmp(input, "recordmacro"))
|
else if (!strcasecmp(input, "recordmacro"))
|
||||||
s->scfunc = record_macro;
|
s->func = record_macro;
|
||||||
else if (!strcasecmp(input, "runmacro"))
|
else if (!strcasecmp(input, "runmacro"))
|
||||||
s->scfunc = run_macro;
|
s->func = run_macro;
|
||||||
else if (!strcasecmp(input, "undo"))
|
else if (!strcasecmp(input, "undo"))
|
||||||
s->scfunc = do_undo;
|
s->func = do_undo;
|
||||||
else if (!strcasecmp(input, "redo"))
|
else if (!strcasecmp(input, "redo"))
|
||||||
s->scfunc = do_redo;
|
s->func = do_redo;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcasecmp(input, "left") ||
|
else if (!strcasecmp(input, "left") ||
|
||||||
!strcasecmp(input, "back"))
|
!strcasecmp(input, "back"))
|
||||||
s->scfunc = do_left;
|
s->func = do_left;
|
||||||
else if (!strcasecmp(input, "right") ||
|
else if (!strcasecmp(input, "right") ||
|
||||||
!strcasecmp(input, "forward"))
|
!strcasecmp(input, "forward"))
|
||||||
s->scfunc = do_right;
|
s->func = do_right;
|
||||||
else if (!strcasecmp(input, "up") ||
|
else if (!strcasecmp(input, "up") ||
|
||||||
!strcasecmp(input, "prevline"))
|
!strcasecmp(input, "prevline"))
|
||||||
s->scfunc = do_up_void;
|
s->func = do_up_void;
|
||||||
else if (!strcasecmp(input, "down") ||
|
else if (!strcasecmp(input, "down") ||
|
||||||
!strcasecmp(input, "nextline"))
|
!strcasecmp(input, "nextline"))
|
||||||
s->scfunc = do_down_void;
|
s->func = do_down_void;
|
||||||
else if (!strcasecmp(input, "prevword"))
|
else if (!strcasecmp(input, "prevword"))
|
||||||
s->scfunc = do_prev_word_void;
|
s->func = do_prev_word_void;
|
||||||
else if (!strcasecmp(input, "nextword"))
|
else if (!strcasecmp(input, "nextword"))
|
||||||
s->scfunc = do_next_word_void;
|
s->func = do_next_word_void;
|
||||||
else if (!strcasecmp(input, "home"))
|
else if (!strcasecmp(input, "home"))
|
||||||
s->scfunc = do_home;
|
s->func = do_home;
|
||||||
else if (!strcasecmp(input, "end"))
|
else if (!strcasecmp(input, "end"))
|
||||||
s->scfunc = do_end;
|
s->func = do_end;
|
||||||
else if (!strcasecmp(input, "prevblock"))
|
else if (!strcasecmp(input, "prevblock"))
|
||||||
s->scfunc = do_prev_block;
|
s->func = do_prev_block;
|
||||||
else if (!strcasecmp(input, "nextblock"))
|
else if (!strcasecmp(input, "nextblock"))
|
||||||
s->scfunc = do_next_block;
|
s->func = do_next_block;
|
||||||
else if (!strcasecmp(input, "pageup") ||
|
else if (!strcasecmp(input, "pageup") ||
|
||||||
!strcasecmp(input, "prevpage"))
|
!strcasecmp(input, "prevpage"))
|
||||||
s->scfunc = do_page_up;
|
s->func = do_page_up;
|
||||||
else if (!strcasecmp(input, "pagedown") ||
|
else if (!strcasecmp(input, "pagedown") ||
|
||||||
!strcasecmp(input, "nextpage"))
|
!strcasecmp(input, "nextpage"))
|
||||||
s->scfunc = do_page_down;
|
s->func = do_page_down;
|
||||||
else if (!strcasecmp(input, "firstline"))
|
else if (!strcasecmp(input, "firstline"))
|
||||||
s->scfunc = to_first_line;
|
s->func = to_first_line;
|
||||||
else if (!strcasecmp(input, "lastline"))
|
else if (!strcasecmp(input, "lastline"))
|
||||||
s->scfunc = to_last_line;
|
s->func = to_last_line;
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
else if (!strcasecmp(input, "prevbuf"))
|
else if (!strcasecmp(input, "prevbuf"))
|
||||||
s->scfunc = switch_to_prev_buffer;
|
s->func = switch_to_prev_buffer;
|
||||||
else if (!strcasecmp(input, "nextbuf"))
|
else if (!strcasecmp(input, "nextbuf"))
|
||||||
s->scfunc = switch_to_next_buffer;
|
s->func = switch_to_next_buffer;
|
||||||
#endif
|
#endif
|
||||||
else if (!strcasecmp(input, "verbatim"))
|
else if (!strcasecmp(input, "verbatim"))
|
||||||
s->scfunc = do_verbatim_input;
|
s->func = do_verbatim_input;
|
||||||
else if (!strcasecmp(input, "tab"))
|
else if (!strcasecmp(input, "tab"))
|
||||||
s->scfunc = do_tab;
|
s->func = do_tab;
|
||||||
else if (!strcasecmp(input, "enter"))
|
else if (!strcasecmp(input, "enter"))
|
||||||
s->scfunc = do_enter;
|
s->func = do_enter;
|
||||||
else if (!strcasecmp(input, "delete"))
|
else if (!strcasecmp(input, "delete"))
|
||||||
s->scfunc = do_delete;
|
s->func = do_delete;
|
||||||
else if (!strcasecmp(input, "backspace"))
|
else if (!strcasecmp(input, "backspace"))
|
||||||
s->scfunc = do_backspace;
|
s->func = do_backspace;
|
||||||
else if (!strcasecmp(input, "refresh"))
|
else if (!strcasecmp(input, "refresh"))
|
||||||
s->scfunc = total_refresh;
|
s->func = total_refresh;
|
||||||
else if (!strcasecmp(input, "suspend"))
|
else if (!strcasecmp(input, "suspend"))
|
||||||
s->scfunc = do_suspend_void;
|
s->func = do_suspend_void;
|
||||||
else if (!strcasecmp(input, "casesens"))
|
else if (!strcasecmp(input, "casesens"))
|
||||||
s->scfunc = case_sens_void;
|
s->func = case_sens_void;
|
||||||
else if (!strcasecmp(input, "regexp"))
|
else if (!strcasecmp(input, "regexp"))
|
||||||
s->scfunc = regexp_void;
|
s->func = regexp_void;
|
||||||
else if (!strcasecmp(input, "backwards"))
|
else if (!strcasecmp(input, "backwards"))
|
||||||
s->scfunc = backwards_void;
|
s->func = backwards_void;
|
||||||
else if (!strcasecmp(input, "flipreplace"))
|
else if (!strcasecmp(input, "flipreplace"))
|
||||||
s->scfunc = flip_replace;
|
s->func = flip_replace;
|
||||||
else if (!strcasecmp(input, "flipgoto") ||
|
else if (!strcasecmp(input, "flipgoto") ||
|
||||||
!strcasecmp(input, "gototext")) /* Deprecated. Remove end of 2018. */
|
!strcasecmp(input, "gototext")) /* Deprecated. Remove end of 2018. */
|
||||||
s->scfunc = flip_goto;
|
s->func = flip_goto;
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
else if (!strcasecmp(input, "prevhistory"))
|
else if (!strcasecmp(input, "prevhistory"))
|
||||||
s->scfunc = get_history_older_void;
|
s->func = get_history_older_void;
|
||||||
else if (!strcasecmp(input, "nexthistory"))
|
else if (!strcasecmp(input, "nexthistory"))
|
||||||
s->scfunc = get_history_newer_void;
|
s->func = get_history_newer_void;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (!strcasecmp(input, "dosformat"))
|
else if (!strcasecmp(input, "dosformat"))
|
||||||
s->scfunc = dos_format_void;
|
s->func = dos_format_void;
|
||||||
else if (!strcasecmp(input, "macformat"))
|
else if (!strcasecmp(input, "macformat"))
|
||||||
s->scfunc = mac_format_void;
|
s->func = mac_format_void;
|
||||||
else if (!strcasecmp(input, "append"))
|
else if (!strcasecmp(input, "append"))
|
||||||
s->scfunc = append_void;
|
s->func = append_void;
|
||||||
else if (!strcasecmp(input, "prepend"))
|
else if (!strcasecmp(input, "prepend"))
|
||||||
s->scfunc = prepend_void;
|
s->func = prepend_void;
|
||||||
else if (!strcasecmp(input, "backup"))
|
else if (!strcasecmp(input, "backup"))
|
||||||
s->scfunc = backup_file_void;
|
s->func = backup_file_void;
|
||||||
else if (!strcasecmp(input, "flipexecute"))
|
else if (!strcasecmp(input, "flipexecute"))
|
||||||
s->scfunc = flip_execute;
|
s->func = flip_execute;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
else if (!strcasecmp(input, "flipnewbuffer"))
|
else if (!strcasecmp(input, "flipnewbuffer"))
|
||||||
s->scfunc = flip_newbuffer;
|
s->func = flip_newbuffer;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_BROWSER
|
#ifdef ENABLE_BROWSER
|
||||||
else if (!strcasecmp(input, "tofiles") ||
|
else if (!strcasecmp(input, "tofiles") ||
|
||||||
!strcasecmp(input, "browser"))
|
!strcasecmp(input, "browser"))
|
||||||
s->scfunc = to_files_void;
|
s->func = to_files_void;
|
||||||
else if (!strcasecmp(input, "gotodir"))
|
else if (!strcasecmp(input, "gotodir"))
|
||||||
s->scfunc = goto_dir_void;
|
s->func = goto_dir_void;
|
||||||
else if (!strcasecmp(input, "firstfile"))
|
else if (!strcasecmp(input, "firstfile"))
|
||||||
s->scfunc = to_first_file;
|
s->func = to_first_file;
|
||||||
else if (!strcasecmp(input, "lastfile"))
|
else if (!strcasecmp(input, "lastfile"))
|
||||||
s->scfunc = to_last_file;
|
s->func = to_last_file;
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
s->scfunc = do_toggle_void;
|
s->func = do_toggle_void;
|
||||||
if (!strcasecmp(input, "nohelp"))
|
if (!strcasecmp(input, "nohelp"))
|
||||||
s->toggle = NO_HELP;
|
s->toggle = NO_HELP;
|
||||||
else if (!strcasecmp(input, "constupdate"))
|
else if (!strcasecmp(input, "constupdate"))
|
||||||
|
@ -471,7 +471,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 == do_toggle_void)
|
if (s->func == do_toggle_void)
|
||||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8;
|
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -504,7 +504,7 @@ void help_init(void)
|
|||||||
if ((s->menus & currmenu) == 0)
|
if ((s->menus & currmenu) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s->scfunc == f->scfunc) {
|
if (s->func == f->func) {
|
||||||
scsfound++;
|
scsfound++;
|
||||||
/* Make the first column narrower (6) than the second (10),
|
/* Make the first column narrower (6) than the second (10),
|
||||||
* but allow it to spill into the second, for "M-Space". */
|
* but allow it to spill into the second, for "M-Space". */
|
||||||
|
18
src/nano.c
18
src/nano.c
@ -1717,20 +1717,20 @@ int do_input(bool allow_funcs)
|
|||||||
|
|
||||||
/* If the function associated with this shortcut is
|
/* If the function associated with this shortcut is
|
||||||
* cutting or copying text, remember this. */
|
* cutting or copying text, remember this. */
|
||||||
if (shortcut->scfunc == do_cut_text_void
|
if (shortcut->func == do_cut_text_void
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|| shortcut->scfunc == do_copy_text
|
|| shortcut->func == do_copy_text
|
||||||
|| shortcut->scfunc == do_cut_till_eof
|
|| shortcut->func == do_cut_till_eof
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
retain_cuts = TRUE;
|
retain_cuts = TRUE;
|
||||||
|
|
||||||
#ifdef ENABLE_WORDCOMPLETION
|
#ifdef ENABLE_WORDCOMPLETION
|
||||||
if (shortcut->scfunc != complete_a_word)
|
if (shortcut->func != complete_a_word)
|
||||||
pletion_line = NULL;
|
pletion_line = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (shortcut->scfunc == do_toggle_void) {
|
if (shortcut->func == do_toggle_void) {
|
||||||
do_toggle(shortcut->toggle);
|
do_toggle(shortcut->toggle);
|
||||||
if (shortcut->toggle != CUT_FROM_CURSOR)
|
if (shortcut->toggle != CUT_FROM_CURSOR)
|
||||||
retain_cuts = TRUE;
|
retain_cuts = TRUE;
|
||||||
@ -1771,16 +1771,16 @@ int do_input(bool allow_funcs)
|
|||||||
/* If the cursor moved to another line and this was not caused
|
/* If the cursor moved to another line and this was not caused
|
||||||
* by adding characters to the buffer, clear the prepend flag. */
|
* by adding characters to the buffer, clear the prepend flag. */
|
||||||
if (openfile->current->next != was_next &&
|
if (openfile->current->next != was_next &&
|
||||||
shortcut->scfunc != do_tab &&
|
shortcut->func != do_tab &&
|
||||||
shortcut->scfunc != do_verbatim_input)
|
shortcut->func != do_verbatim_input)
|
||||||
wrap_reset();
|
wrap_reset();
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
if (f && !f->viewok && !refresh_needed)
|
if (f && !f->viewok && !refresh_needed)
|
||||||
check_the_multis(openfile->current);
|
check_the_multis(openfile->current);
|
||||||
#endif
|
#endif
|
||||||
if (!refresh_needed && (shortcut->scfunc == do_delete ||
|
if (!refresh_needed && (shortcut->func == do_delete ||
|
||||||
shortcut->scfunc == do_backspace))
|
shortcut->func == do_backspace))
|
||||||
update_line(openfile->current, openfile->current_x);
|
update_line(openfile->current, openfile->current_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ typedef struct sc {
|
|||||||
/* The integer that, together with meta, identifies the keystroke. */
|
/* The integer that, together with meta, identifies the keystroke. */
|
||||||
int menus;
|
int menus;
|
||||||
/* Which menus this applies to. */
|
/* Which menus this applies to. */
|
||||||
void (*scfunc)(void);
|
void (*func)(void);
|
||||||
/* The function we're going to run. */
|
/* The function we're going to run. */
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
int toggle;
|
int toggle;
|
||||||
@ -449,7 +449,7 @@ typedef struct sc {
|
|||||||
} sc;
|
} sc;
|
||||||
|
|
||||||
typedef struct subnfunc {
|
typedef struct subnfunc {
|
||||||
void (*scfunc)(void);
|
void (*func)(void);
|
||||||
/* The actual function to call. */
|
/* The actual function to call. */
|
||||||
int menus;
|
int menus;
|
||||||
/* In what menus this function applies. */
|
/* In what menus this function applies. */
|
||||||
|
38
src/prompt.c
38
src/prompt.c
@ -129,41 +129,41 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shortcut) {
|
if (shortcut) {
|
||||||
if (shortcut->scfunc == do_tab || shortcut->scfunc == do_enter)
|
if (shortcut->func == do_tab || shortcut->func == do_enter)
|
||||||
;
|
;
|
||||||
else if (shortcut->scfunc == do_left)
|
else if (shortcut->func == do_left)
|
||||||
do_statusbar_left();
|
do_statusbar_left();
|
||||||
else if (shortcut->scfunc == do_right)
|
else if (shortcut->func == do_right)
|
||||||
do_statusbar_right();
|
do_statusbar_right();
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
else if (shortcut->scfunc == do_prev_word_void)
|
else if (shortcut->func == do_prev_word_void)
|
||||||
do_statusbar_prev_word();
|
do_statusbar_prev_word();
|
||||||
else if (shortcut->scfunc == do_next_word_void)
|
else if (shortcut->func == do_next_word_void)
|
||||||
do_statusbar_next_word();
|
do_statusbar_next_word();
|
||||||
#endif
|
#endif
|
||||||
else if (shortcut->scfunc == do_home)
|
else if (shortcut->func == do_home)
|
||||||
do_statusbar_home();
|
do_statusbar_home();
|
||||||
else if (shortcut->scfunc == do_end)
|
else if (shortcut->func == do_end)
|
||||||
do_statusbar_end();
|
do_statusbar_end();
|
||||||
/* When in restricted mode at the "Write File" prompt and the
|
/* When in restricted mode at the "Write File" prompt and the
|
||||||
* filename isn't blank, disallow any input and deletion. */
|
* filename isn't blank, disallow any input and deletion. */
|
||||||
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
else if (ISSET(RESTRICTED) && currmenu == MWRITEFILE &&
|
||||||
openfile->filename[0] != '\0' &&
|
openfile->filename[0] != '\0' &&
|
||||||
(shortcut->scfunc == do_verbatim_input ||
|
(shortcut->func == do_verbatim_input ||
|
||||||
shortcut->scfunc == do_cut_text_void ||
|
shortcut->func == do_cut_text_void ||
|
||||||
shortcut->scfunc == do_uncut_text ||
|
shortcut->func == do_uncut_text ||
|
||||||
shortcut->scfunc == do_delete ||
|
shortcut->func == do_delete ||
|
||||||
shortcut->scfunc == do_backspace))
|
shortcut->func == do_backspace))
|
||||||
;
|
;
|
||||||
else if (shortcut->scfunc == do_verbatim_input)
|
else if (shortcut->func == do_verbatim_input)
|
||||||
do_statusbar_verbatim_input();
|
do_statusbar_verbatim_input();
|
||||||
else if (shortcut->scfunc == do_cut_text_void)
|
else if (shortcut->func == do_cut_text_void)
|
||||||
do_statusbar_cut_text();
|
do_statusbar_cut_text();
|
||||||
else if (shortcut->scfunc == do_delete)
|
else if (shortcut->func == do_delete)
|
||||||
do_statusbar_delete();
|
do_statusbar_delete();
|
||||||
else if (shortcut->scfunc == do_backspace)
|
else if (shortcut->func == do_backspace)
|
||||||
do_statusbar_backspace();
|
do_statusbar_backspace();
|
||||||
else if (shortcut->scfunc == do_uncut_text) {
|
else if (shortcut->func == do_uncut_text) {
|
||||||
if (cutbuffer != NULL)
|
if (cutbuffer != NULL)
|
||||||
do_statusbar_uncut_text();
|
do_statusbar_uncut_text();
|
||||||
} else {
|
} else {
|
||||||
@ -172,10 +172,10 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
|||||||
* and setting finished to TRUE to indicatethat we're done after
|
* and setting finished to TRUE to indicatethat we're done after
|
||||||
* running or trying to run their associated functions. */
|
* running or trying to run their associated functions. */
|
||||||
f = sctofunc(shortcut);
|
f = sctofunc(shortcut);
|
||||||
if (shortcut->scfunc != NULL) {
|
if (shortcut->func != NULL) {
|
||||||
*ran_func = TRUE;
|
*ran_func = TRUE;
|
||||||
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
|
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
|
||||||
f->scfunc != do_gotolinecolumn_void)
|
f->func != do_gotolinecolumn_void)
|
||||||
execute(shortcut);
|
execute(shortcut);
|
||||||
}
|
}
|
||||||
*finished = TRUE;
|
*finished = TRUE;
|
||||||
|
16
src/rcfile.c
16
src/rcfile.c
@ -421,7 +421,7 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
* otherwise it is the name of a function. */
|
* otherwise it is the name of a function. */
|
||||||
if (*funcptr == '"') {
|
if (*funcptr == '"') {
|
||||||
newsc = nmalloc(sizeof(sc));
|
newsc = nmalloc(sizeof(sc));
|
||||||
newsc->scfunc = implant;
|
newsc->func = implant;
|
||||||
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
|
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
newsc->toggle = 0;
|
newsc->toggle = 0;
|
||||||
@ -447,17 +447,17 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
|
|
||||||
/* Tally up the menus where the function exists. */
|
/* Tally up the menus where the function exists. */
|
||||||
for (f = allfuncs; f != NULL; f = f->next)
|
for (f = allfuncs; f != NULL; f = f->next)
|
||||||
if (f->scfunc == newsc->scfunc)
|
if (f->func == newsc->func)
|
||||||
mask = mask | f->menus;
|
mask = mask | f->menus;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Handle the special case of the toggles. */
|
/* Handle the special case of the toggles. */
|
||||||
if (newsc->scfunc == do_toggle_void)
|
if (newsc->func == do_toggle_void)
|
||||||
mask = MMAIN;
|
mask = MMAIN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now limit the given menu to those where the function exists. */
|
/* Now limit the given menu to those where the function exists. */
|
||||||
if (is_universal(newsc->scfunc))
|
if (is_universal(newsc->func))
|
||||||
menu = menu & MMOST;
|
menu = menu & MMOST;
|
||||||
else
|
else
|
||||||
menu = menu & mask;
|
menu = menu & mask;
|
||||||
@ -486,9 +486,9 @@ void parse_binding(char *ptr, bool dobind)
|
|||||||
if (dobind) {
|
if (dobind) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If this is a toggle, copy its sequence number. */
|
/* If this is a toggle, copy its sequence number. */
|
||||||
if (newsc->scfunc == do_toggle_void) {
|
if (newsc->func == do_toggle_void) {
|
||||||
for (s = sclist; s != NULL; s = s->next)
|
for (s = sclist; s != NULL; s = s->next)
|
||||||
if (s->scfunc == do_toggle_void && s->toggle == newsc->toggle)
|
if (s->func == do_toggle_void && s->toggle == newsc->toggle)
|
||||||
newsc->ordinal = s->ordinal;
|
newsc->ordinal = s->ordinal;
|
||||||
} else
|
} else
|
||||||
newsc->ordinal = 0;
|
newsc->ordinal = 0;
|
||||||
@ -891,8 +891,8 @@ static void check_vitals_mapped(void)
|
|||||||
|
|
||||||
for (v = 0; v < VITALS; v++) {
|
for (v = 0; v < VITALS; v++) {
|
||||||
for (f = allfuncs; f != NULL; f = f->next) {
|
for (f = allfuncs; f != NULL; f = f->next) {
|
||||||
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
|
if (f->func == vitals[v] && f->menus & inmenus[v]) {
|
||||||
const sc *s = first_sc_for(inmenus[v], f->scfunc);
|
const sc *s = first_sc_for(inmenus[v], f->func);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
fprintf(stderr, _("Fatal error: no keys mapped for function "
|
fprintf(stderr, _("Fatal error: no keys mapped for function "
|
||||||
"\"%s\". Exiting.\n"), f->desc);
|
"\"%s\". Exiting.\n"), f->desc);
|
||||||
|
@ -1660,7 +1660,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
|||||||
for (f = allfuncs; f != NULL; f = f->next) {
|
for (f = allfuncs; f != NULL; f = f->next) {
|
||||||
if ((f->menus & currmenu) == 0)
|
if ((f->menus & currmenu) == 0)
|
||||||
continue;
|
continue;
|
||||||
if (first_sc_for(currmenu, f->scfunc) == NULL)
|
if (first_sc_for(currmenu, f->func) == NULL)
|
||||||
continue;
|
continue;
|
||||||
/* Tick off an actually shown shortcut. */
|
/* Tick off an actually shown shortcut. */
|
||||||
j -= 1;
|
j -= 1;
|
||||||
@ -1670,7 +1670,7 @@ int get_mouseinput(int *mouse_y, int *mouse_x, bool allow_shortcuts)
|
|||||||
|
|
||||||
/* And put the corresponding key into the keyboard buffer. */
|
/* And put the corresponding key into the keyboard buffer. */
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
const sc *s = first_sc_for(currmenu, f->scfunc);
|
const sc *s = first_sc_for(currmenu, f->func);
|
||||||
unget_kbinput(s->keycode, s->meta);
|
unget_kbinput(s->keycode, s->meta);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -2255,7 +2255,7 @@ void bottombars(int menu)
|
|||||||
if ((f->menus & menu) == 0)
|
if ((f->menus & menu) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s = first_sc_for(menu, f->scfunc);
|
s = first_sc_for(menu, f->func);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user