From 576bf331effcc0a2db5bdaa5f01846cbbfe1df1c Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 12 Jul 2004 03:10:30 +0000 Subject: [PATCH] various changes to cut down on binary size: per DB's patch, add new N_() macro to mark strings that aren't translated immediately and convert nano to use it where needed, overhaul the shortcut list and toggle list initialization code for efficiency, and replace rcfile_msg() with rcfile_error(); also add a few minor miscellaneous cleanups by DB and myself git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1852 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 20 ++ src/files.c | 49 +-- src/global.c | 961 +++++++++++++++++++++++++-------------------------- src/nano.c | 6 +- src/nano.h | 3 + src/proto.h | 17 +- src/rcfile.c | 85 ++--- src/search.c | 10 +- src/winio.c | 26 +- 9 files changed, 587 insertions(+), 590 deletions(-) diff --git a/ChangeLog b/ChangeLog index c35b1819..2c9f66d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,18 @@ CVS code - descriptive. (DLR) - Remove unused global variable search_offscreen. (David Benbennick) + - Add new N_() macro to mark strings that aren't translated + immediately, and convert nano to use it in cases where the + same translated string is stored in a const char* and used + more than once. (David Benbennick) DLR: Do this for the + toggles list for consistency with the shortcut list. + - Overhaul the shortcut list and toggle list initialization + code for efficiency. Changes to shortcut_init() and + toggle_init(). (David Benbennick) DLR: Move "Cancel" to just + after "Get Help" in the file browser list, for consistency + with all the other lists, have the replace list accept all the + same function keys as the search list, and clarify a few + shortcut descriptions. - files.c: close_open_file() - Tweak to no longer rely on the return values of @@ -32,6 +44,8 @@ CVS code - shortcut_init() - Fix erroneous #ifdef so that nano compiles with --disable-justify again. (DLR; found by Mike Frysinger) + thanks_for_all_the_fish() + - Delete topwin, edit, and bottomwin. (David Benbennick) - nano.c: do_justify() - Add on_next_line flag, used to indicate when we've moved to @@ -47,6 +61,12 @@ CVS code - used in the actual functions. (DLR) - Remove unused declaration of temp_opt. (David Benbennick) - rcfile.c: + rcfile_msg() + - Removed along with the related static int errors, and replaced + with calls to rcfile_error(). (David Benbennick) + - Removed the reference to "starting nano" in the statusbar + message, as it may be called when we exit if the history file + can't be saved. (DLR) parse_rcfile() - Have whitespace display default to off instead of on. (Mike Frysinger) diff --git a/src/files.c b/src/files.c index 019114c0..d7910607 100644 --- a/src/files.c +++ b/src/files.c @@ -555,7 +555,7 @@ void do_insertfile(int loading_file) } else { #endif realname = real_dir_from_tilde(answer); - i = open_file(realname, 1, loading_file); + i = open_file(realname, TRUE, loading_file); #ifndef NANO_SMALL } #endif @@ -848,7 +848,8 @@ void load_open_file(void) /* restore full file position: line number, x-coordinate, y- coordinate, place we want */ - do_gotopos(open_files->file_lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant); + do_gotopos(open_files->file_lineno, open_files->file_current_x, + open_files->file_current_y, open_files->file_placewewant); /* update the titlebar */ clearok(topwin, FALSE); @@ -1821,33 +1822,33 @@ int do_writeout(int exiting) const char *formatstr, *backupstr; if (ISSET(MAC_FILE)) - formatstr = _(" [Mac Format]"); + formatstr = N_(" [Mac Format]"); else if (ISSET(DOS_FILE)) - formatstr = _(" [DOS Format]"); + formatstr = N_(" [DOS Format]"); else formatstr = ""; if (ISSET(BACKUP_FILE)) - backupstr = _(" [Backup]"); + backupstr = N_(" [Backup]"); else backupstr = ""; /* Be nice to the translation folks. */ if (ISSET(MARK_ISSET) && !exiting) { if (append == 2) - msg = _("Prepend Selection to File"); + msg = N_("Prepend Selection to File"); else if (append == 1) - msg = _("Append Selection to File"); + msg = N_("Append Selection to File"); else - msg = _("Write Selection to File"); + msg = N_("Write Selection to File"); } else #endif /* !NANO_SMALL */ if (append == 2) - msg = _("File Name to Prepend to"); + msg = N_("File Name to Prepend to"); else if (append == 1) - msg = _("File Name to Append to"); + msg = N_("File Name to Append to"); else - msg = _("File Name to Write"); + msg = N_("File Name to Write"); /* If we're using restricted mode, the filename isn't blank, * and we're at the "Write File" prompt, disable tab @@ -1855,9 +1856,9 @@ int do_writeout(int exiting) i = statusq(!ISSET(RESTRICTED) || filename[0] == '\0' ? TRUE : FALSE, writefile_list, #ifndef NANO_SMALL - ans, NULL, "%s%s%s", msg, formatstr, backupstr + ans, NULL, "%s%s%s", _(msg), formatstr, backupstr #else - filename, "%s", msg + filename, "%s", _(msg) #endif ); @@ -2953,7 +2954,8 @@ void load_history(void) if (errno != ENOENT) { /* Don't save history when we quit. */ UNSET(HISTORYLOG); - rcfile_error(_("Unable to open ~/.nano_history file: %s"), strerror(errno)); + rcfile_error(N_("Unable to open ~/.nano_history file: %s"), + strerror(errno)); } free(nanohist); } else { @@ -2986,8 +2988,8 @@ void save_history(void) historytype *h; /* don't save unchanged or empty histories */ - if (!((search_history.count || replace_history.count) && - ISSET(HISTORY_CHANGED) && !ISSET(VIEW_MODE))) + if ((search_history.count == 0 && replace_history.count == 0) || + !ISSET(HISTORY_CHANGED) || ISSET(VIEW_MODE)) return; if (homenv != NULL) { @@ -3003,7 +3005,8 @@ void save_history(void) if (homenv != NULL || userage != NULL) { hist = fopen(nanohist, "wb"); if (hist == NULL) { - rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno)); + rcfile_error(N_("Unable to write ~/.nano_history file: %s"), + strerror(errno)); } else { /* set rw only by owner for security ?? */ chmod(nanohist, S_IRUSR | S_IWUSR); @@ -3012,19 +3015,25 @@ void save_history(void) h->data = charealloc(h->data, strlen(h->data) + 2); strcat(h->data, "\n"); if (fputs(h->data, hist) == EOF) { - rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno)); + rcfile_error( + N_("Unable to write ~/.nano_history file: %s"), + strerror(errno)); goto come_from; } } if (fputs("\n", hist) == EOF) { - rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno)); + rcfile_error( + N_("Unable to write ~/.nano_history file: %s"), + strerror(errno)); goto come_from; } for (h = replace_history.tail; h->prev; h = h->prev) { h->data = charealloc(h->data, strlen(h->data) + 2); strcat(h->data, "\n"); if (fputs(h->data, hist) == EOF) { - rcfile_msg(_("Unable to write ~/.nano_history file: %s"), strerror(errno)); + rcfile_error( + N_("Unable to write ~/.nano_history file: %s"), + strerror(errno)); goto come_from; } } diff --git a/src/global.c b/src/global.c index 9697cea8..466abcef 100644 --- a/src/global.c +++ b/src/global.c @@ -201,9 +201,9 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc, } s->ctrlval = ctrlval; - s->desc = desc; + s->desc = _(desc); #ifndef DISABLE_HELP - s->help = help; + s->help = _(help); #endif s->metaval = metaval; s->funcval = funcval; @@ -213,252 +213,119 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc, s->next = NULL; } -#ifndef NANO_SMALL -/* Create one new toggle structure, at the end of the toggles linked - * list. */ -void toggle_init_one(int val, const char *desc, long flag) -{ - toggle *u; - - if (toggles == NULL) { - toggles = (toggle *)nmalloc(sizeof(toggle)); - u = toggles; - } else { - for (u = toggles; u->next != NULL; u = u->next) - ; - u->next = (toggle *)nmalloc(sizeof(toggle)); - u = u->next; - } - - u->val = val; - u->desc = desc; - u->flag = flag; - u->next = NULL; -} - -void toggle_init(void) +void shortcut_init(int unjustify) { - char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg, - *toggle_nohelp_msg, *toggle_cuttoend_msg, - *toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg, - *toggle_backup_msg, *toggle_smooth_msg, *toggle_smarthome_msg; -#ifndef DISABLE_MOUSE - char *toggle_mouse_msg; -#endif -#ifndef DISABLE_WRAPPING - char *toggle_wrap_msg; -#endif -#ifdef ENABLE_COLOR - char *toggle_syntax_msg; -#endif -#ifdef ENABLE_MULTIBUFFER - char *toggle_multibuffer_msg; + const char *get_help_msg = N_("Get Help"); + const char *exit_msg = N_("Exit"); + const char *prev_page_msg = N_("Prev Page"); + const char *next_page_msg = N_("Next Page"); + const char *replace_msg = N_("Replace"); + const char *go_to_line_msg = N_("Go To Line"); + const char *cancel_msg = N_("Cancel"); + const char *first_line_msg = N_("First Line"); + const char *last_line_msg = N_("Last Line"); +#ifndef NANO_SMALL + const char *case_sens_msg = N_("Case Sens"); + const char *direction_msg = N_("Direction"); +#ifdef HAVE_REGEX_H + const char *regexp_msg = N_("Regexp"); #endif -#ifdef ENABLE_NANORC - char *toggle_whitespace_msg; + const char *history_msg = N_("History"); +#endif /* !NANO_SMALL */ +#ifndef DISABLE_BROWSER + const char *to_files_msg = N_("To Files"); #endif - /* There is no need to reinitialize the toggles. They can't - change. */ - if (toggles != NULL) - return; - - toggle_const_msg = _("Constant cursor position"); - toggle_autoindent_msg = _("Auto indent"); - toggle_suspend_msg = _("Suspend"); - toggle_nohelp_msg = _("Help mode"); -#ifndef DISABLE_MOUSE - toggle_mouse_msg = _("Mouse support"); -#endif - toggle_cuttoend_msg = _("Cut to end"); - toggle_noconvert_msg = _("No conversion from DOS/Mac format"); - toggle_dos_msg = _("Writing file in DOS format"); - toggle_mac_msg = _("Writing file in Mac format"); - toggle_backup_msg = _("Backing up file"); - toggle_smooth_msg = _("Smooth scrolling"); - toggle_smarthome_msg = _("Smart home key"); -#ifndef DISABLE_WRAPPING - toggle_wrap_msg = _("Auto line wrap"); -#endif -#ifdef ENABLE_COLOR - toggle_syntax_msg = _("Color syntax highlighting"); -#endif +#ifndef DISABLE_HELP + const char *nano_help_msg = N_("Invoke the help menu"); + const char *nano_exit_msg = #ifdef ENABLE_MULTIBUFFER - toggle_multibuffer_msg = _("Multiple file buffers"); -#endif -#ifdef ENABLE_NANORC - toggle_whitespace_msg = _("Whitespace display"); -#endif - - toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP); + N_("Close currently loaded file/Exit from nano") +#else + N_("Exit from nano") +#endif + ; + const char *nano_writeout_msg = N_("Write the current file to disk"); + const char *nano_justify_msg = N_("Justify the current paragraph"); + const char *nano_insert_msg = + N_("Insert another file into the current one"); + const char *nano_whereis_msg = N_("Search for text within the editor"); + const char *nano_prevpage_msg = N_("Move to the previous screen"); + const char *nano_nextpage_msg = N_("Move to the next screen"); + const char *nano_cut_msg = + N_("Cut the current line and store it in the cutbuffer"); + const char *nano_uncut_msg = + N_("Uncut from the cutbuffer into the current line"); + const char *nano_cursorpos_msg = N_("Show the position of the cursor"); + const char *nano_spell_msg = N_("Invoke the spell checker, if available"); + const char *nano_goto_msg = N_("Go to a specific line number"); + const char *nano_replace_msg = N_("Replace text within the editor"); + const char *nano_prevline_msg = N_("Move to the previous line"); + const char *nano_nextline_msg = N_("Move to the next line"); + const char *nano_forward_msg = N_("Move forward one character"); + const char *nano_back_msg = N_("Move back one character"); + const char *nano_home_msg = N_("Move to the beginning of the current line"); + const char *nano_end_msg = N_("Move to the end of the current line"); + const char *nano_refresh_msg = N_("Refresh (redraw) the current screen"); + const char *nano_mark_msg = N_("Mark text at the current cursor location"); + const char *nano_delete_msg = N_("Delete the character under the cursor"); + const char *nano_backspace_msg = + N_("Delete the character to the left of the cursor"); + const char *nano_tab_msg = N_("Insert a tab character"); + const char *nano_enter_msg = + N_("Insert a carriage return at the cursor position"); + const char *nano_nextword_msg = N_("Move forward one word"); + const char *nano_prevword_msg = N_("Move backward one word"); + const char *nano_verbatim_msg = N_("Insert character(s) verbatim"); #ifdef ENABLE_MULTIBUFFER - /* If we're using restricted mode, the multibuffer toggle is - * disabled. It's useless since inserting files is disabled. */ - if (!ISSET(RESTRICTED)) - toggle_init_one(TOGGLE_MULTIBUFFER_KEY, toggle_multibuffer_msg, MULTIBUFFER); -#endif - toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE); - toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT); -#ifndef DISABLE_WRAPPING - toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP); -#endif - toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END); - /* If we're using restricted mode, the suspend toggle is disabled. - * It's useless since suspending is disabled. */ - if (!ISSET(RESTRICTED)) - toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND); -#ifndef DISABLE_MOUSE - toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE); -#endif - /* If we're using restricted mode, the no-conversion, DOS format, - * Mac format, and backup toggles are disabled. The first, second, - * and third are useless since inserting files is disabled, and the - * fourth is useless since backups are disabled. */ - if (!ISSET(RESTRICTED)) { - toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT); - toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE); - toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE); - toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE); - } - toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL); - toggle_init_one(TOGGLE_SMARTHOME_KEY, toggle_smarthome_msg, SMART_HOME); -#ifdef ENABLE_COLOR - toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX); -#endif -#ifdef ENABLE_NANORC - toggle_init_one(TOGGLE_WHITESPACE_KEY, toggle_whitespace_msg, WHITESPACE_DISPLAY); -#endif -} - -#ifdef DEBUG -/* Deallocate all of the toggles. */ -void free_toggles(void) -{ - while (toggles != NULL) { - toggle *pt = toggles; /* Think "previous toggle" */ - - toggles = toggles->next; - free(pt); - } -} + const char *nano_openprev_msg = N_("Switch to previous file buffer"); + const char *nano_opennext_msg = N_("Switch to next file buffer"); +#endif +#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H) + const char *nano_bracket_msg = N_("Find other bracket"); +#endif + const char *nano_whereis_next_msg = N_("Repeat last search"); + const char *nano_cancel_msg = N_("Cancel the current function"); + const char *nano_firstline_msg = N_("Go to the first line of the file"); + const char *nano_lastline_msg = N_("Go to the last line of the file"); + const char *nano_parabegin_msg = + N_("Go to the beginning of the current paragraph"); + const char *nano_paraend_msg = + N_("Go to the end of the current paragraph"); + const char *nano_fulljustify_msg = N_("Justify the entire file"); +#ifndef NANO_SMALL + const char *nano_case_msg = + N_("Make the current search/replace case (in)sensitive"); + const char *nano_reverse_msg = + N_("Make the current search/replace go backwards"); +#ifdef HAVE_REGEX_H + const char *nano_regexp_msg = N_("Use regular expressions"); #endif + const char *nano_editstr_msg = + N_("Edit the previous search/replace strings"); #endif /* !NANO_SMALL */ -/* Deallocate the given shortcut. */ -void free_shortcutage(shortcut **shortcutage) -{ - assert(shortcutage != NULL); - while (*shortcutage != NULL) { - shortcut *ps = *shortcutage; - *shortcutage = (*shortcutage)->next; - free(ps); - } -} - -void shortcut_init(int unjustify) -{ -#ifndef DISABLE_HELP - const char *nano_help_msg = "", *nano_writeout_msg = - "", *nano_exit_msg = "", *nano_goto_msg = - "", *nano_justify_msg = "", *nano_replace_msg = - "", *nano_insert_msg = "", *nano_whereis_msg = - "", *nano_whereis_next_msg = "", *nano_prevpage_msg = - "", *nano_nextpage_msg = "", *nano_cut_msg = - "", *nano_uncut_msg = "", *nano_cursorpos_msg = - "", *nano_spell_msg = "", *nano_prevline_msg = - "", *nano_nextline_msg = "", *nano_forward_msg = - "", *nano_back_msg = "", *nano_home_msg = - "", *nano_end_msg = "", *nano_firstline_msg = - "", *nano_lastline_msg = "", *nano_refresh_msg = - "", *nano_mark_msg = "", *nano_delete_msg = - "", *nano_backspace_msg = "", *nano_tab_msg = - "", *nano_enter_msg = "", *nano_prevword_msg = - "", *nano_nextword_msg = "", *nano_verbatim_msg = - "", *nano_cancel_msg = "", *nano_unjustify_msg = - "", *nano_append_msg = "", *nano_prepend_msg = - "", *nano_tofiles_msg = "", *nano_gotodir_msg = - "", *nano_case_msg = "", *nano_reverse_msg = - "", *nano_execute_msg = "", *nano_dos_msg = - "", *nano_mac_msg = "", *nano_backup_msg = - "", *nano_editstr_msg = "", *nano_parabegin_msg = - "", *nano_paraend_msg = "", *nano_fulljustify_msg = ""; - -#ifdef ENABLE_MULTIBUFFER - const char *nano_openprev_msg = "", *nano_opennext_msg = - "", *nano_multibuffer_msg = ""; +#ifndef DISABLE_BROWSER + const char *nano_tofiles_msg = N_("Go to file browser"); #endif -#ifdef HAVE_REGEX_H - const char *nano_regexp_msg = "", *nano_bracket_msg = ""; +#ifndef NANO_SMALL + const char *nano_dos_msg = N_("Write file out in DOS format"); + const char *nano_mac_msg = N_("Write file out in Mac format"); #endif - - nano_help_msg = _("Invoke the help menu"); - nano_writeout_msg = _("Write the current file to disk"); -#ifdef ENABLE_MULTIBUFFER - nano_exit_msg = _("Close current file buffer/Exit from nano"); -#else - nano_exit_msg = _("Exit from nano"); -#endif - nano_goto_msg = _("Go to a specific line number"); - nano_justify_msg = _("Justify the current paragraph"); - nano_unjustify_msg = _("Unjustify after a justify"); - nano_replace_msg = _("Replace text within the editor"); - nano_insert_msg = _("Insert another file into the current one"); - nano_whereis_msg = _("Search for text within the editor"); - nano_whereis_next_msg = _("Repeat last search"); - nano_prevpage_msg = _("Move to the previous screen"); - nano_nextpage_msg = _("Move to the next screen"); - nano_cut_msg = _("Cut the current line and store it in the cutbuffer"); - nano_uncut_msg = _("Uncut from the cutbuffer into the current line"); - nano_cursorpos_msg = _("Show the position of the cursor"); - nano_spell_msg = _("Invoke the spell checker, if available"); - nano_prevline_msg = _("Move to the previous line"); - nano_nextline_msg = _("Move to the next line"); - nano_forward_msg = _("Move forward one character"); - nano_back_msg = _("Move back one character"); - nano_home_msg = _("Move to the beginning of the current line"); - nano_end_msg = _("Move to the end of the current line"); - nano_firstline_msg = _("Go to the first line of the file"); - nano_lastline_msg = _("Go to the last line of the file"); - nano_refresh_msg = _("Refresh (redraw) the current screen"); - nano_mark_msg = _("Mark text at the current cursor location"); - nano_delete_msg = _("Delete the character under the cursor"); - nano_backspace_msg = - _("Delete the character to the left of the cursor"); - nano_tab_msg = _("Insert a tab character"); - nano_enter_msg = _("Insert a carriage return at the cursor position"); - nano_prevword_msg = _("Move backward one word"); - nano_nextword_msg = _("Move forward one word"); - nano_verbatim_msg = _("Insert character(s) verbatim"); - nano_enter_msg = _("Insert a carriage return at the cursor position"); - nano_case_msg = - _("Make the current search or replace case (in)sensitive"); - nano_tofiles_msg = _("Go to file browser"); - nano_execute_msg = _("Execute external command"); - nano_gotodir_msg = _("Go to directory"); - nano_cancel_msg = _("Cancel the current function"); - nano_append_msg = _("Append to the current file"); - nano_prepend_msg = _("Prepend to the current file"); - nano_reverse_msg = _("Search backwards"); - nano_dos_msg = _("Write file out in DOS format"); - nano_mac_msg = _("Write file out in Mac format"); - nano_backup_msg = _("Back up original file when saving"); - nano_editstr_msg = _("Edit the previous search/replace strings"); - nano_parabegin_msg = _("Go to the beginning of the current paragraph"); - nano_paraend_msg = _("Go to the end of the current paragraph"); - nano_fulljustify_msg = _("Justify the entire file"); -#ifdef HAVE_REGEX_H - nano_regexp_msg = _("Use regular expressions"); - nano_bracket_msg = _("Find other bracket"); + const char *nano_append_msg = N_("Append to the current file"); + const char *nano_prepend_msg = N_("Prepend to the current file"); +#ifndef NANO_SMALL + const char *nano_backup_msg = N_("Back up original file when saving"); + const char *nano_execute_msg = N_("Execute external command"); #endif -#ifdef ENABLE_MULTIBUFFER - nano_openprev_msg = _("Switch to previous file buffer"); - nano_opennext_msg = _("Switch to next file buffer"); - nano_multibuffer_msg = _("Toggle insert into new file buffer"); +#if defined(ENABLE_MULTIBUFFER) && !defined(NANO_SMALL) + const char *nano_multibuffer_msg = N_("Insert into new buffer"); +#endif +#ifndef DISABLE_BROWSER + const char *nano_gotodir_msg = N_("Go to directory"); #endif #endif /* !DISABLE_HELP */ - free_shortcutage(&main_list); - /* The following macro is to be used in calling sc_init_one(). The * point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is * defined, when the 4th one should not be there. */ @@ -468,10 +335,12 @@ void shortcut_init(int unjustify) # define IFHELP(help, nextvar) nextvar #endif + free_shortcutage(&main_list); + /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -482,26 +351,26 @@ void shortcut_init(int unjustify) #ifdef ENABLE_MULTIBUFFER if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL)) /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"), + sc_init_one(&main_list, NANO_EXIT_KEY, N_("Close"), IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, do_exit); else #endif /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"), + sc_init_one(&main_list, NANO_EXIT_KEY, exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, do_exit); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"), - IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY, - NANO_NO_KEY, NOVIEW, do_writeout_void); + sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"), + IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY, + NANO_NO_KEY, NOVIEW, do_writeout_void); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"), - IFHELP(nano_justify_msg, NANO_NO_KEY), - NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW, + sc_init_one(&main_list, NANO_JUSTIFY_KEY, N_("Justify"), + IFHELP(nano_justify_msg, NANO_NO_KEY), + NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW, #ifndef DISABLE_JUSTIFY do_justify_void #else @@ -515,9 +384,9 @@ void shortcut_init(int unjustify) * it allows reading from or writing to files not specified on the * command line. */ /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), - IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY, - NANO_NO_KEY, + sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"), + IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY, + NANO_NO_KEY, #ifdef ENABLE_MULTIBUFFER VIEW #else @@ -526,46 +395,46 @@ void shortcut_init(int unjustify) , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"), - IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY, - NANO_NO_KEY, VIEW, do_search); + sc_init_one(&main_list, NANO_WHEREIS_KEY, N_("Where Is"), + IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY, + NANO_NO_KEY, VIEW, do_search); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"), - IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, - NANO_NO_KEY, VIEW, do_page_up); + sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg, + IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, + NANO_NO_KEY, VIEW, do_page_up); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"), - IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, - NANO_NO_KEY, VIEW, do_page_down); + sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg, + IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, + NANO_NO_KEY, VIEW, do_page_down); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"), - IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY, - NANO_NO_KEY, NOVIEW, do_cut_text); + sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"), + IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY, + NANO_NO_KEY, NOVIEW, do_cut_text); if (unjustify) /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"), - IFHELP(nano_unjustify_msg, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY, + sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"), + IFHELP(NULL, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY, NANO_NO_KEY, NOVIEW, 0); else /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"), + sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"), IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY, NANO_NO_KEY, NOVIEW, do_uncut_text); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"), - IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY, - NANO_NO_KEY, VIEW, do_cursorpos_void); + sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"), + IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY, + NANO_NO_KEY, VIEW, do_cursorpos_void); /* If we're using restricted mode, spell checking is disabled * because it allows reading from or writing to files not specified * on the command line. */ /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"), + sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"), IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY, NANO_NO_KEY, NOVIEW, #ifndef DISABLE_SPELLER @@ -573,45 +442,45 @@ void shortcut_init(int unjustify) #endif nano_disabled_msg); - sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"), - IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, - NANO_NO_KEY, VIEW, do_gotoline_void); + sc_init_one(&main_list, NANO_GOTO_KEY, go_to_line_msg, + IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, + NANO_NO_KEY, VIEW, do_gotoline_void); - sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"), - IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY, - NANO_NO_KEY, NOVIEW, do_replace); + sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg, + IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY, + NANO_NO_KEY, NOVIEW, do_replace); - sc_init_one(&main_list, NANO_PREVLINE_KEY, _("Prev Line"), - IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_up); + sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"), + IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_up); - sc_init_one(&main_list, NANO_NEXTLINE_KEY, _("Next Line"), - IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_down); + sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"), + IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_down); - sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"), - IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_right_void); + sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"), + IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_right_void); - sc_init_one(&main_list, NANO_BACK_KEY, _("Back"), - IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_left_void); + sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"), + IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_left_void); - sc_init_one(&main_list, NANO_HOME_KEY, _("Home"), - IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_home); + sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"), + IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_home); - sc_init_one(&main_list, NANO_END_KEY, _("End"), - IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_end); + sc_init_one(&main_list, NANO_END_KEY, N_("End"), + IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_end); - sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"), - IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, total_refresh); + sc_init_one(&main_list, NANO_REFRESH_KEY, N_("Refresh"), + IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, total_refresh); - sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"), - IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY), - NANO_NO_KEY, NANO_NO_KEY, NOVIEW, + sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"), + IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY), + NANO_NO_KEY, NANO_NO_KEY, NOVIEW, #ifndef NANO_SMALL do_mark #else @@ -619,63 +488,63 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"), - IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_delete); + sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"), + IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_delete); - sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"), - IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_backspace); + sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace"), + IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_backspace); - sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"), - IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_tab); + sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"), + IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_tab); - sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"), - IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_enter); + sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"), + IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_enter); #ifndef NANO_SMALL - sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"), - IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_next_word); + sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"), + IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_next_word); - sc_init_one(&main_list, NANO_NO_KEY, _("Prev Word"), - IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_prev_word); + sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"), + IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_prev_word); #endif - sc_init_one(&main_list, NANO_NO_KEY, _("Verbatim Input"), - IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_verbatim_input); + sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"), + IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_verbatim_input); #ifdef ENABLE_MULTIBUFFER - sc_init_one(&main_list, NANO_NO_KEY, _("Previous File"), - IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY, - NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void); + sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"), + IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY, + NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void); - sc_init_one(&main_list, NANO_NO_KEY, _("Next File"), - IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY, - NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void); + sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"), + IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY, + NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void); #endif #ifndef NANO_SMALL #ifdef HAVE_REGEX_H - sc_init_one(&main_list, NANO_NO_KEY, _("Find Other Bracket"), - IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_find_bracket); + sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"), + IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_find_bracket); #endif - sc_init_one(&main_list, NANO_NO_KEY, _("Where Is Next"), - IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), - NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research); + sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"), + IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), + NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research); #endif free_shortcutage(&whereis_list); - sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -684,79 +553,79 @@ void shortcut_init(int unjustify) ); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"), - IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, - NANO_NO_KEY, VIEW, do_first_line); + sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg, + IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, + NANO_NO_KEY, VIEW, do_first_line); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"), - IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, - NANO_NO_KEY, VIEW, do_last_line); + sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg, + IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, + NANO_NO_KEY, VIEW, do_last_line); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"), - IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, - NANO_NO_KEY, VIEW, do_replace); + sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, replace_msg, + IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, + NANO_NO_KEY, VIEW, do_replace); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), - IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, - NANO_NO_KEY, VIEW, do_gotoline_void); + sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg, + IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, + NANO_NO_KEY, VIEW, do_gotoline_void); #ifndef DISABLE_JUSTIFY /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, _("Beg of Par"), - IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_para_begin); + sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, N_("Beg of Par"), + IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_para_begin); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_PARAEND_KEY, _("End of Par"), - IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_para_end); + sc_init_one(&whereis_list, NANO_PARAEND_KEY, N_("End of Par"), + IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_para_end); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, _("FullJstify"), - IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, NOVIEW, do_full_justify); + sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, N_("FullJstify"), + IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, NOVIEW, do_full_justify); #endif #ifndef NANO_SMALL /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_NO_KEY, _("Case Sens"), - IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg, + IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_NO_KEY, _("Direction"), - IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg, + IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #ifdef HAVE_REGEX_H /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_NO_KEY, _("Regexp"), - IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg, + IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif #ifndef NANO_SMALL /* Translators: try to keep this string under 10 characters long */ - sc_init_one(&whereis_list, NANO_HISTORY_KEY, _("History"), - IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&whereis_list, NANO_HISTORY_KEY, history_msg, + IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif #endif /* !NANO_SMALL */ free_shortcutage(&replace_list); - sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -764,52 +633,52 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"), - IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_first_line); + sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg, + IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, + NANO_NO_KEY, VIEW, do_first_line); - sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"), - IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_last_line); + sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg, + IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, + NANO_NO_KEY, VIEW, do_last_line); /* Translators: try to keep this string under 12 characters long */ - sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"), - IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, - NANO_NO_KEY, VIEW, do_search); + sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, N_("No Replace"), + IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, + NANO_NO_KEY, VIEW, do_search); - sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), - IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, - NANO_NO_KEY, VIEW, do_gotoline_void); + sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg, + IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, + NANO_NO_KEY, VIEW, do_gotoline_void); #ifndef NANO_SMALL - sc_init_one(&replace_list, NANO_NO_KEY, _("Case Sens"), - IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg, + IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&replace_list, NANO_NO_KEY, _("Direction"), - IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list, NANO_NO_KEY, direction_msg, + IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #ifdef HAVE_REGEX_H - sc_init_one(&replace_list, NANO_NO_KEY, _("Regexp"), - IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg, + IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif - sc_init_one(&replace_list, NANO_HISTORY_KEY, _("History"), - IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list, NANO_HISTORY_KEY, history_msg, + IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif /* !NANO_SMALL */ free_shortcutage(&replace_list_2); - sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -817,29 +686,29 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"), - IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_first_line); + sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg, + IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_first_line); - sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"), - IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_last_line); + sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg, + IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_last_line); #ifndef NANO_SMALL - sc_init_one(&replace_list_2, NANO_HISTORY_KEY, _("History"), - IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&replace_list_2, NANO_HISTORY_KEY, history_msg, + IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif free_shortcutage(&goto_list); - sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&goto_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -847,47 +716,47 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&goto_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"), - IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_first_line); + sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, first_line_msg, + IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_first_line); - sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"), - IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, do_last_line); + sc_init_one(&goto_list, NANO_LASTLINE_KEY, last_line_msg, + IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, do_last_line); #ifndef DISABLE_HELP free_shortcutage(&help_list); - sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"), - IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg, + IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"), - IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg, + IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&help_list, NANO_PREVLINE_KEY, _("Prev Line"), - IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"), + IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&help_list, NANO_NEXTLINE_KEY, _("Next Line"), - IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"), + IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"), - IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg, + IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, + NANO_NO_KEY, VIEW, 0); #endif free_shortcutage(&writefile_list); - sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -895,12 +764,16 @@ void shortcut_init(int unjustify) #endif ); + sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); + #ifndef DISABLE_BROWSER /* If we're using restricted mode, the file browser is disabled. * It's useless since inserting files is disabled. */ /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"), + sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg, IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); #endif @@ -914,46 +787,42 @@ void shortcut_init(int unjustify) * backups are disabled. */ /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_NO_KEY, _("DOS Format"), + sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"), IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_NO_KEY, _("Mac Format"), + sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"), IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); #endif /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_NO_KEY, _("Append"), + sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"), IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_NO_KEY, _("Prepend"), + sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"), IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); #ifndef NANO_SMALL /* Translators: try to keep this string under 16 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&writefile_list, NANO_NO_KEY, _("Backup File"), + sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"), IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); #endif - sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); - free_shortcutage(&insertfile_list); - sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -961,7 +830,7 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"), + sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg, IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, 0); @@ -969,7 +838,7 @@ void shortcut_init(int unjustify) /* If we're using restricted mode, the file browser is disabled. * It's useless since inserting files is disabled. */ if (!ISSET(RESTRICTED)) - sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"), + sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg, IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); #endif @@ -979,7 +848,7 @@ void shortcut_init(int unjustify) * It's useless since inserting files is disabled. */ /* Translators: try to keep this string under 22 characters long */ if (!ISSET(RESTRICTED)) - sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"), + sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, N_("Execute Command"), IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0); @@ -997,9 +866,9 @@ void shortcut_init(int unjustify) #ifndef DISABLE_SPELLER free_shortcutage(&spell_list); - sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -1007,17 +876,17 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif #ifndef NANO_SMALL free_shortcutage(&extcmd_list); - sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -1025,17 +894,17 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif #ifndef DISABLE_BROWSER free_shortcutage(&browser_list); - sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -1043,28 +912,28 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&browser_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"), - IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg, + IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, + NANO_NO_KEY, VIEW, 0); - sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"), - IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg, + IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, + NANO_NO_KEY, VIEW, 0); /* Translators: try to keep this string under 22 characters long */ - sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"), - IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&browser_list, NANO_GOTO_KEY, N_("Go To Dir"), + IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, + NANO_NO_KEY, VIEW, 0); free_shortcutage(&gotodir_list); - sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"), - IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, - NANO_NO_KEY, VIEW, + sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg, + IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, + NANO_NO_KEY, VIEW, #ifndef DISABLE_HELP do_help #else @@ -1072,9 +941,9 @@ void shortcut_init(int unjustify) #endif ); - sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"), - IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, - NANO_NO_KEY, VIEW, 0); + sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg, + IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, + NANO_NO_KEY, VIEW, 0); #endif #if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) @@ -1085,14 +954,120 @@ void shortcut_init(int unjustify) #endif } +/* Deallocate the given shortcut. */ +void free_shortcutage(shortcut **shortcutage) +{ + assert(shortcutage != NULL); + while (*shortcutage != NULL) { + shortcut *ps = *shortcutage; + *shortcutage = (*shortcutage)->next; + free(ps); + } +} + +#ifndef NANO_SMALL +/* Create one new toggle structure, at the end of the toggles linked + * list. */ +void toggle_init_one(int val, const char *desc, long flag) +{ + toggle *u; + + if (toggles == NULL) { + toggles = nmalloc(sizeof(toggle)); + u = toggles; + } else { + for (u = toggles; u->next != NULL; u = u->next) + ; + u->next = nmalloc(sizeof(toggle)); + u = u->next; + } + + u->val = val; + u->desc = _(desc); + u->flag = flag; + u->next = NULL; +} + +void toggle_init(void) +{ + /* There is no need to reinitialize the toggles. They can't + * change. */ + if (toggles != NULL) + return; + + toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP); +#ifdef ENABLE_MULTIBUFFER + /* If we're using restricted mode, the multibuffer toggle is + * disabled. It's useless since inserting files is disabled. */ + if (!ISSET(RESTRICTED)) + toggle_init_one(TOGGLE_MULTIBUFFER_KEY, N_("Multiple file buffers"), + MULTIBUFFER); +#endif + toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"), + CONSTUPDATE); + toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), AUTOINDENT); +#ifndef DISABLE_WRAPPING + toggle_init_one(TOGGLE_WRAP_KEY, N_("Auto line wrap"), NO_WRAP); +#endif + toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END); + /* If we're using restricted mode, the suspend toggle is disabled. + * It's useless since suspending is disabled. */ + if (!ISSET(RESTRICTED)) + toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND); +#ifndef DISABLE_MOUSE + toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE); +#endif + /* If we're using restricted mode, the no-conversion, DOS format, + * Mac format, and backup toggles are disabled. The first, second, + * and third are useless since inserting files is disabled, and the + * fourth is useless since backups are disabled. */ + if (!ISSET(RESTRICTED)) { + toggle_init_one(TOGGLE_NOCONVERT_KEY, + N_("No conversion from DOS/Mac format"), NO_CONVERT); + toggle_init_one(TOGGLE_DOS_KEY, N_("Writing file in DOS format"), + DOS_FILE); + toggle_init_one(TOGGLE_MAC_KEY, N_("Writing file in Mac format"), + MAC_FILE); + toggle_init_one(TOGGLE_BACKUP_KEY, N_("File backups"), BACKUP_FILE); + } + toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL); + toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME); +#ifdef ENABLE_COLOR + toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"), + COLOR_SYNTAX); +#endif +#ifdef ENABLE_NANORC + toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"), + WHITESPACE_DISPLAY); +#endif +} + +#ifdef DEBUG +/* Deallocate all of the toggles. */ +void free_toggles(void) +{ + while (toggles != NULL) { + toggle *pt = toggles; /* Think "previous toggle". */ + + toggles = toggles->next; + free(pt); + } +} +#endif +#endif /* !NANO_SMALL */ + /* This function is called just before calling exit(). Practically, the * only effect is to cause a segmentation fault if the various data * structures got bolloxed earlier. Thus, we don't bother having this * function unless debugging is turned on. */ #ifdef DEBUG -/* added by SPK for memory cleanup, gracefully return our malloc()s */ +/* Added by SPK for memory cleanup; gracefully return our malloc()s. */ void thanks_for_all_the_fish(void) { + delwin(topwin); + delwin(edit); + delwin(bottomwin); + #ifndef DISABLE_JUSTIFY if (quotestr != NULL) free(quotestr); diff --git a/src/nano.c b/src/nano.c index b9a51171..b33aeaae 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1797,7 +1797,7 @@ const char *do_alt_speller(char *tempfile_name) #endif free_filestruct(fileage); global_init(TRUE); - open_file(tempfile_name, 0, 1); + open_file(tempfile_name, FALSE, TRUE); #ifndef NANO_SMALL } @@ -3504,7 +3504,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Main: open file\n"); #endif - open_file(filename, 0, 0); + open_file(filename, FALSE, FALSE); #ifdef ENABLE_MULTIBUFFER /* If we're using multibuffers and more than one file is specified on the command line, load them all and switch to the first one @@ -3516,7 +3516,7 @@ int main(int argc, char *argv[]) add_open_file(TRUE); new_file(); filename = mallocstrcpy(filename, argv[optind]); - open_file(filename, 0, 0); + open_file(filename, FALSE, FALSE); load_file(FALSE); } open_nextfile_void(); diff --git a/src/nano.h b/src/nano.h index db5678a6..34dbc755 100644 --- a/src/nano.h +++ b/src/nano.h @@ -76,6 +76,9 @@ # define _(string) (string) # define P_(singular, plural, number) (number == 1 ? singular : plural) #endif +#define gettext_noop(string) (string) +#define N_(string) gettext_noop(string) + /* Mark a string that will be sent to gettext later. */ #include #include diff --git a/src/proto.h b/src/proto.h index 3aef035f..2a428df0 100644 --- a/src/proto.h +++ b/src/proto.h @@ -219,12 +219,6 @@ char *do_browse_from(const char *inpath); /* Public functions in global.c */ size_t length_of_list(const shortcut *s); -void sc_init_one(shortcut **shortcutage, int key, const char *desc, -#ifndef DISABLE_HELP - const char *help, -#endif - int metaval, int funcval, int miscval, int view, void - (*func)(void)); #ifndef NANO_SMALL void toggle_init_one(int val, const char *desc, long flag); void toggle_init(void); @@ -232,8 +226,14 @@ void toggle_init(void); void free_toggles(void); #endif #endif -void free_shortcutage(shortcut **shortcutage); +void sc_init_one(shortcut **shortcutage, int key, const char *desc, +#ifndef DISABLE_HELP + const char *help, +#endif + int metaval, int funcval, int miscval, int view, void + (*func)(void)); void shortcut_init(int unjustify); +void free_shortcutage(shortcut **shortcutage); #ifdef DEBUG void thanks_for_all_the_fish(void); #endif @@ -365,7 +365,6 @@ void enable_flow_control(void); /* Public functions in rcfile.c */ #ifdef ENABLE_NANORC void rcfile_error(const char *msg, ...); -void rcfile_msg(const char *msg, ...); char *parse_next_word(char *ptr); char *parse_argument(char *ptr); #ifdef ENABLE_COLOR @@ -555,7 +554,7 @@ void total_refresh(void); void display_main_list(void); void do_cursorpos(int constant); void do_cursorpos_void(void); -int line_len(const char *ptr); +size_t line_len(const char *ptr); void do_help(void); void do_replace_highlight(int highlight_flag, const char *word); #ifdef DEBUG diff --git a/src/rcfile.c b/src/rcfile.c index e25fd259..09c96cf8 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -100,7 +100,6 @@ const static rcoption rcopts[] = { {NULL, 0} }; -static int errors = 0; static int lineno = 0; static char *nanorc; @@ -115,26 +114,12 @@ void rcfile_error(const char *msg, ...) fprintf(stderr, _("Error in %s on line %d: "), nanorc, lineno); va_start(ap, msg); - vfprintf(stderr, msg, ap); + vfprintf(stderr, _(msg), ap); va_end(ap); - fprintf(stderr, _("\nPress return to continue starting nano\n")); + fprintf(stderr, _("\nPress Return to continue\n")); - while (getchar() != '\n'); -} - -/* Just print the error (one of many, perhaps) but don't abort, yet. */ -void rcfile_msg(const char *msg, ...) -{ - va_list ap; - - if (!errors) { - errors = 1; - fprintf(stderr, "\n"); - } - va_start(ap, msg); - vfprintf(stderr, msg, ap); - va_end(ap); - fprintf(stderr, "\n"); + while (getchar() != '\n') + ; } /* Parse the next word from the string. Returns NULL if we hit EOL. */ @@ -183,7 +168,7 @@ char *parse_argument(char *ptr) ptr = NULL; else *ptr++ = '\0'; - rcfile_error(_("Argument %s has unterminated \""), ptr_bak); + rcfile_error(N_("Argument %s has unterminated \""), ptr_bak); } else { *last_quote = '\0'; ptr = last_quote + 1; @@ -225,7 +210,7 @@ int colortoint(const char *colorname, int *bright) else if (!strcasecmp(colorname, "black")) mcolor = COLOR_BLACK; else { - rcfile_error(_("Color %s not understood.\n" + rcfile_error(N_("Color %s not understood.\n" "Valid colors are \"green\", \"red\", \"blue\", \n" "\"white\", \"yellow\", \"cyan\", \"magenta\" and \n" "\"black\", with the optional prefix \"bright\" \n" @@ -264,7 +249,7 @@ int nregcomp(regex_t *preg, const char *regex, int eflags) char *str = charalloc(len); regerror(rc, preg, str, len); - rcfile_error(_("Bad regex \"%s\": %s"), regex, str); + rcfile_error(N_("Bad regex \"%s\": %s"), regex, str); free(str); } return rc != 0; @@ -284,7 +269,8 @@ void parse_syntax(char *ptr) return; if (*ptr != '"') { - rcfile_error(_("Regex strings must begin and end with a \" character\n")); + rcfile_error( + N_("Regex strings must begin and end with a \" character\n")); return; } ptr++; @@ -293,7 +279,7 @@ void parse_syntax(char *ptr) ptr = parse_next_regex(ptr); if (ptr == NULL) { - rcfile_error(_("Missing syntax name")); + rcfile_error(N_("Missing syntax name")); return; } @@ -362,7 +348,7 @@ void parse_colors(char *ptr) ptr = parse_next_word(ptr); if (ptr == NULL) { - rcfile_error(_("Missing color name")); + rcfile_error(N_("Missing color name")); return; } @@ -371,7 +357,8 @@ void parse_colors(char *ptr) strtok(fgstr, ","); bgcolorname = strtok(NULL, ","); if (!strncasecmp(bgcolorname, "bright", 6)) { - rcfile_error(_("Background color %s cannot be bright"), bgcolorname); + rcfile_error(N_("Background color %s cannot be bright"), + bgcolorname); return; } bg = colortoint(bgcolorname, &bright); @@ -385,7 +372,7 @@ void parse_colors(char *ptr) return; if (syntaxes == NULL) { - rcfile_error(_("Cannot add a color directive without a syntax line")); + rcfile_error(N_("Cannot add a color directive without a syntax line")); return; } @@ -414,7 +401,8 @@ void parse_colors(char *ptr) } if (*ptr != '"') { - rcfile_error(_("Regex strings must begin and end with a \" character\n")); + rcfile_error( + N_("Regex strings must begin and end with a \" character\n")); ptr = parse_next_regex(ptr); continue; } @@ -452,16 +440,16 @@ void parse_colors(char *ptr) if (expectend) { if (ptr == NULL || strncasecmp(ptr, "end=", 4)) { - rcfile_error(_ - ("\"start=\" requires a corresponding \"end=\"")); + rcfile_error( + N_("\"start=\" requires a corresponding \"end=\"")); return; } ptr += 4; if (*ptr != '"') { - rcfile_error(_ - ("Regex strings must begin and end with a \" character\n")); + rcfile_error( + N_("Regex strings must begin and end with a \" character\n")); continue; } ptr++; @@ -525,7 +513,7 @@ void parse_rcfile(FILE *rcstream) parse_colors(ptr); #endif /* ENABLE_COLOR */ else { - rcfile_msg(_("Command %s not understood"), keyword); + rcfile_error(N_("Command %s not understood"), keyword); continue; } @@ -564,9 +552,9 @@ void parse_rcfile(FILE *rcstream) #endif ) { if (*ptr == '\n' || *ptr == '\0') { - rcfile_error(_ - ("Option %s requires an argument"), - rcopts[i].name); + rcfile_error( + N_("Option %s requires an argument"), + rcopts[i].name); continue; } option = ptr; @@ -590,8 +578,9 @@ void parse_rcfile(FILE *rcstream) * errors. */ j = (int)strtol(option, &first_error, 10); if (errno == ERANGE || *option == '\0' || *first_error != '\0') - rcfile_error(_("Requested fill size %d invalid"), - j); + rcfile_error( + N_("Requested fill size %d invalid"), + j); else wrap_at = j; } else @@ -602,7 +591,8 @@ void parse_rcfile(FILE *rcstream) whitespace = mallocstrcpy(NULL, option); ws_len = strlen(whitespace); if (ws_len != 2 || (ws_len == 2 && (is_cntrl_char(whitespace[0]) || is_cntrl_char(whitespace[1])))) { - rcfile_error(_("Two non-control characters required")); + rcfile_error( + N_("Two non-control characters required")); free(whitespace); whitespace = NULL; } @@ -612,14 +602,16 @@ void parse_rcfile(FILE *rcstream) if (!strcasecmp(rcopts[i].name, "punct")) { punct = mallocstrcpy(NULL, option); if (strchr(punct, '\t') != NULL || strchr(punct, ' ') != NULL) { - rcfile_error(_("Non-tab and non-space characters required")); + rcfile_error( + N_("Non-tab and non-space characters required")); free(punct); punct = NULL; } } else if (!strcasecmp(rcopts[i].name, "brackets")) { brackets = mallocstrcpy(NULL, option); if (strchr(brackets, '\t') != NULL || strchr(brackets, ' ') != NULL) { - rcfile_error(_("Non-tab and non-space characters required")); + rcfile_error( + N_("Non-tab and non-space characters required")); free(brackets); brackets = NULL; } @@ -645,8 +637,8 @@ void parse_rcfile(FILE *rcstream) * errors. */ j = (int)strtol(option, &first_error, 10); if (errno == ERANGE || *option == '\0' || *first_error != '\0') - rcfile_error(_("Requested tab size %d invalid"), - j); + rcfile_error(N_("Requested tab size %d invalid"), + j); else tabsize = j; } @@ -668,9 +660,6 @@ void parse_rcfile(FILE *rcstream) } } free(buf); - if (errors) - rcfile_error(_("Errors found in .nanorc file")); - return; } @@ -705,7 +694,7 @@ void do_rcfile(void) endpwent(); if (userage == NULL) { - rcfile_error(_("I can't find my home directory! Wah!")); + rcfile_error(N_("I can't find my home directory! Wah!")); SET(NO_RCFILE); } else { nanorc = charealloc(nanorc, strlen(userage->pw_dir) + 9); @@ -725,7 +714,7 @@ void do_rcfile(void) if ((rcstream = fopen(nanorc, "r")) == NULL) { /* Don't complain about the file not existing */ if (errno != ENOENT) { - rcfile_error(_("Unable to open ~/.nanorc file, %s"), + rcfile_error(N_("Unable to open ~/.nanorc file, %s"), strerror(errno)); SET(NO_RCFILE); } diff --git a/src/search.c b/src/search.c index 0a0c8917..590b677f 100644 --- a/src/search.c +++ b/src/search.c @@ -361,7 +361,8 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct /* Search for a string. */ void do_search(void) { - int old_pww = placewewant, i, fileptr_x = current_x, didfind; + size_t old_pww = placewewant, i, fileptr_x = current_x; + int didfind; filestruct *fileptr = current; #ifndef DISABLE_WRAPPING @@ -428,7 +429,8 @@ void do_search(void) /* Search for the next string without prompting. */ void do_research(void) { - int old_pww = placewewant, fileptr_x = current_x, didfind; + size_t old_pww = placewewant, fileptr_x = current_x; + int didfind; filestruct *fileptr = current; #ifndef DISABLE_WRAPPING @@ -583,7 +585,7 @@ char *replace_line(const char *needle) int do_replace_loop(const char *needle, const filestruct *real_current, size_t *real_current_x, int wholewords) { - int old_pww = placewewant, replaceall = 0, numreplaced = -1; + int old_pww = placewewant, replaceall = FALSE, numreplaced = -1; size_t current_x_save = current_x; const filestruct *current_save = current; #ifdef HAVE_REGEX_H @@ -677,7 +679,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current, int length_change; if (i == 2) - replaceall = 1; + replaceall = TRUE; copy = replace_line(needle); diff --git a/src/winio.c b/src/winio.c index 72cc5d68..080f47d2 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2945,9 +2945,9 @@ void display_main_list(void) bottombars(main_list); } -/* If constant is FALSE, the user typed ^C so we unconditionally display - * the cursor position. Otherwise, we display it only if the character - * position changed, and DISABLE_CURPOS is not set. +/* If constant is FALSE, the user typed Ctrl-C, so we unconditionally + * display the cursor position. Otherwise, we display it only if the + * character position changed and DISABLE_CURPOS is not set. * * If constant is TRUE and DISABLE_CURPOS is set, we unset it and update * old_i and old_totsize. That way, we leave the current statusbar @@ -3007,9 +3007,9 @@ void do_cursorpos_void(void) } /* Calculate the next line of help_text, starting at ptr. */ -int line_len(const char *ptr) +size_t line_len(const char *ptr) { - int j = 0; + size_t j = 0; while (*ptr != '\n' && *ptr != '\0' && j < COLS - 5) { ptr++; @@ -3288,14 +3288,14 @@ void do_credits(void) }; const char *xlcredits[XLCREDIT_LEN] = { - "The nano text editor", - "version", - "Brought to you by:", - "Special thanks to:", - "The Free Software Foundation", - "For ncurses:", - "and anyone else we forgot...", - "Thank you for using nano!" + N_("The nano text editor"), + N_("version"), + N_("Brought to you by:"), + N_("Special thanks to:"), + N_("The Free Software Foundation"), + N_("For ncurses:"), + N_("and anyone else we forgot..."), + N_("Thank you for using nano!") }; curs_set(0); -- 2.39.5