From: Chris Allegretta Date: Sat, 30 Aug 2008 21:00:00 +0000 (+0000) Subject: * global.c, help.c, browser.c, files.c, proto.h: Fix several compipation... X-Git-Tag: v2.1.5~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1d77823f79591765af41d661b8158626d24e098e;p=nano.git * global.c, help.c, browser.c, files.c, proto.h: Fix several compipation and programmatic issues with --disable-help, especially that do-writeout was treating ^G the same as ^M. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4317 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index e2301aa1..8e2f72fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,13 +2,15 @@ * configure.ac, color.c, rcfile.c, utils.c: 1st attempt at supporting systems which don't support GNU-style word boundaries. New function fixbounds() to translate from GNU-style to BSD-style, autoconf option GNU_WORDBOUNDS. + * nano-regress: New perl script to check for some of the more obvious issues with compilation + issues with certain configure options. + * global.c, help.c, browser.c, files.c, proto.h: Fix several compipation and programmatic + issues with --disable-help, especially that do-writeout was treating ^G the same as ^M. 2008-08-28 Chris Allegretta * configure.ac, rcfile.c: Add support for an alternate rcfilename at configure time. Maybe this should become a command line option some day, but I don't see the need currently. Start of fix for Savannah bug #24128: Add nanorc support to win32 platform. - * nano-regress: New perl script to check for some of the more obvious issues with compilation - issues with certain configure options. 2008-08-21 Chris Allegretta * text.c: Change error messages where we may possibly get into a bad state and urge diff --git a/src/browser.c b/src/browser.c index b7521472..40710123 100644 --- a/src/browser.c +++ b/src/browser.c @@ -173,8 +173,8 @@ char *do_browser(char *path, DIR *dir) total_redraw(); } else if (f->scfunc == do_help_void) { #ifndef DISABLE_HELP - do_browser_help(); - curs_set(0); + do_browser_help(); + curs_set(0); #else nano_disabled_msg(); #endif @@ -558,7 +558,9 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key) *kbinput = sc_seq_or(do_page_up, 0); break; case '?': +#ifndef DISABLE_HELP *kbinput = sc_seq_or(do_help_void, 0); +#endif break; /* Cancel equivalent to Exit here. */ case 'E': diff --git a/src/files.c b/src/files.c index 258864ca..f1444b55 100644 --- a/src/files.c +++ b/src/files.c @@ -1948,6 +1948,8 @@ bool do_writeout(bool exiting) } else if (s && s->scfunc == (void *) append_msg) { append = (append == APPEND) ? OVERWRITE : APPEND; continue; + } else if (s && s->scfunc == do_help_void) { + continue; } #ifdef DEBUG diff --git a/src/global.c b/src/global.c index 0cece9c2..dd25914b 100644 --- a/src/global.c +++ b/src/global.c @@ -237,7 +237,7 @@ void add_to_funcs(void *func, int menus, const char *desc, const char *help, f->menus = menus; f->desc = desc; f->viewok = viewok; -#ifndef NANO_TINY +#ifndef DISABLE_HELP f->help = help; f->blank_after = blank_after; #endif @@ -483,6 +483,9 @@ void shortcut_init(bool unjustify) const char *insert_file_msg = N_("Insert File"); const char *go_to_line_msg = N_("Go To Line"); +#ifndef DISABLE_JUSTIFY + const char *nano_justify_msg = N_("Justify the current paragraph"); +#endif #ifndef DISABLE_HELP /* TRANSLATORS: The next long series of strings are shortcut descriptions; * they are best kept shorter than 56 characters, but may be longer. */ @@ -497,9 +500,6 @@ void shortcut_init(bool unjustify) ; const char *nano_writeout_msg = N_("Write the current file to disk"); -#ifndef DISABLE_JUSTIFY - const char *nano_justify_msg = N_("Justify the current paragraph"); -#endif const char *nano_insert_msg = N_("Insert another file into the current one"); const char *nano_whereis_msg = @@ -642,10 +642,8 @@ void shortcut_init(bool unjustify) free(f); } -#ifndef DISABLE_HELP - add_to_funcs(do_help_void, MALL, get_help_msg, nano_help_msg, + add_to_funcs(do_help_void, MALL, get_help_msg, IFSCHELP(nano_help_msg), FALSE, VIEW); -#endif add_to_funcs((void *) cancel_msg, (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), @@ -723,7 +721,7 @@ void shortcut_init(bool unjustify) #ifndef DISABLE_SPELLER if (!ISSET(RESTRICTED)) /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(do_spell, MMAIN, N_("To Spell"), nano_spell_msg, + add_to_funcs(do_spell, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg), TRUE, NOVIEW); #endif @@ -758,25 +756,25 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs(do_mark, MMAIN, N_("Mark Text"), - nano_mark_msg, FALSE, VIEW); + IFSCHELP(nano_mark_msg), FALSE, VIEW); add_to_funcs(do_research, (MMAIN|MBROWSER), whereis_next_msg, - nano_whereis_next_msg, TRUE, VIEW); + IFSCHELP(nano_whereis_next_msg), TRUE, VIEW); add_to_funcs(do_copy_text, MMAIN, N_("Copy Text"), - nano_copy_msg, FALSE, NOVIEW); + IFSCHELP(nano_copy_msg), FALSE, NOVIEW); add_to_funcs(do_indent_void, MMAIN, N_("Indent Text"), - nano_indent_msg, FALSE, NOVIEW); + IFSCHELP(nano_indent_msg), FALSE, NOVIEW); add_to_funcs(do_unindent, MMAIN, N_("Unindent Text"), - nano_unindent_msg, FALSE, NOVIEW); + IFSCHELP(nano_unindent_msg), FALSE, NOVIEW); add_to_funcs(do_undo, MMAIN, N_("Undo"), - nano_undo_msg, FALSE, NOVIEW); + IFSCHELP(nano_undo_msg), FALSE, NOVIEW); add_to_funcs(do_redo, MMAIN, N_("Redo"), - nano_redo_msg, TRUE, NOVIEW); + IFSCHELP(nano_redo_msg), TRUE, NOVIEW); #endif @@ -796,10 +794,10 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs(do_next_word_void, MMAIN, N_("Next Word"), - nano_nextword_msg, FALSE, VIEW); + IFSCHELP(nano_nextword_msg), FALSE, VIEW); add_to_funcs(do_prev_word_void, MMAIN, N_("Prev Word"), - nano_prevword_msg, FALSE, VIEW); + IFSCHELP(nano_prevword_msg), FALSE, VIEW); #endif add_to_funcs(do_up_void, (MMAIN|MHELP|MBROWSER), N_("Prev Line"), @@ -816,21 +814,21 @@ void shortcut_init(bool unjustify) #ifndef DISABLE_JUSTIFY add_to_funcs(do_para_begin_void, (MMAIN|MWHEREIS), beg_of_par_msg, - nano_parabegin_msg, FALSE, VIEW); + IFSCHELP(nano_parabegin_msg), FALSE, VIEW); add_to_funcs(do_para_end_void, (MMAIN|MWHEREIS), end_of_par_msg, - nano_paraend_msg, FALSE, VIEW); + IFSCHELP(nano_paraend_msg), FALSE, VIEW); #endif #ifndef NANO_TINY add_to_funcs(do_find_bracket, MMAIN, _("Find Other Bracket"), - nano_bracket_msg, FALSE, VIEW); + IFSCHELP(nano_bracket_msg), FALSE, VIEW); add_to_funcs(do_scroll_up, MMAIN, N_("Scroll Up"), - nano_scrollup_msg, FALSE, VIEW); + IFSCHELP(nano_scrollup_msg), FALSE, VIEW); add_to_funcs(do_scroll_down, MMAIN, N_("Scroll Down"), - nano_scrolldown_msg, FALSE, VIEW); + IFSCHELP(nano_scrolldown_msg), FALSE, VIEW); #endif #ifdef ENABLE_MULTIBUFFER @@ -872,7 +870,7 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs(do_cut_till_end, MMAIN, N_("CutTillEnd"), - nano_cut_till_end_msg, TRUE, NOVIEW); + IFSCHELP(nano_cut_till_end_msg), TRUE, NOVIEW); #endif add_to_funcs(xon_complaint, MMAIN, "", "", FALSE, VIEW); @@ -880,12 +878,12 @@ void shortcut_init(bool unjustify) #ifndef DISABLE_JUSTIFY add_to_funcs(do_full_justify, (MMAIN|MWHEREIS), fulljstify_msg, - nano_fulljustify_msg, FALSE, NOVIEW); + IFSCHELP(nano_fulljustify_msg), FALSE, NOVIEW); #endif #ifndef NANO_TINY add_to_funcs(do_wordlinechar_count, MMAIN, N_("Word Count"), - nano_wordcount_msg, FALSE, VIEW); + IFSCHELP(nano_wordcount_msg), FALSE, VIEW); #endif add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, @@ -897,11 +895,11 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs((void *) case_sens_msg, (MWHEREIS|MREPLACE|MWHEREISFILE), - case_sens_msg, nano_case_msg, FALSE, VIEW); + case_sens_msg, IFSCHELP(nano_case_msg), FALSE, VIEW); add_to_funcs((void *) backwards_msg, (MWHEREIS|MREPLACE|MWHEREISFILE), - backwards_msg, nano_reverse_msg, FALSE, VIEW); + backwards_msg, IFSCHELP(nano_reverse_msg), FALSE, VIEW); #endif #ifdef HAVE_REGEX_H @@ -913,11 +911,11 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY add_to_funcs((void *) prev_history_msg, (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), - prev_history_msg, nano_prev_history_msg, FALSE, VIEW); + prev_history_msg, IFSCHELP(nano_prev_history_msg), FALSE, VIEW); add_to_funcs((void *) next_history_msg, (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), - next_history_msg, nano_next_history_msg, FALSE, VIEW); + next_history_msg, IFSCHELP(nano_next_history_msg), FALSE, VIEW); #endif add_to_funcs((void *) no_replace_msg, MREPLACE, @@ -930,7 +928,7 @@ void shortcut_init(bool unjustify) if (!ISSET(RESTRICTED)) add_to_funcs((void *) to_files_msg, (MGOTOLINE|MINSERTFILE), - to_files_msg, nano_tofiles_msg, FALSE, VIEW); + to_files_msg, IFSCHELP(nano_tofiles_msg), FALSE, VIEW); #endif #ifndef NANO_TINY @@ -942,23 +940,23 @@ void shortcut_init(bool unjustify) * backups are disabled. */ if (!ISSET(RESTRICTED)) add_to_funcs((void *) dos_format_msg, MWRITEFILE, - dos_format_msg, nano_dos_msg, FALSE, NOVIEW); + dos_format_msg, IFSCHELP(nano_dos_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) add_to_funcs((void *) mac_format_msg, MWRITEFILE, - mac_format_msg, nano_mac_msg, FALSE, NOVIEW); + mac_format_msg, IFSCHELP(nano_mac_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) add_to_funcs((void *) append_msg, MWRITEFILE, - append_msg, nano_append_msg, FALSE, NOVIEW); + append_msg, IFSCHELP(nano_append_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) add_to_funcs((void *) prepend_msg, MWRITEFILE, - prepend_msg, nano_prepend_msg, FALSE, NOVIEW); + prepend_msg, IFSCHELP(nano_prepend_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) add_to_funcs((void *) backup_file_msg, MWRITEFILE, - backup_file_msg, nano_backup_msg, FALSE, NOVIEW); + backup_file_msg, IFSCHELP(nano_backup_msg), FALSE, NOVIEW); #endif #ifndef NANO_TINY @@ -966,14 +964,14 @@ void shortcut_init(bool unjustify) * It's useless since inserting files is disabled. */ if (!ISSET(RESTRICTED)) add_to_funcs((void *) ext_cmd_msg, MINSERTFILE, - ext_cmd_msg, nano_execute_msg, FALSE, NOVIEW); + ext_cmd_msg, IFSCHELP(nano_execute_msg), FALSE, NOVIEW); #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)) add_to_funcs((void *) new_buffer_msg, MINSERTFILE, - new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW); + new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif add_to_funcs((void *) insert_file_msg, MEXTCMD, @@ -981,7 +979,7 @@ void shortcut_init(bool unjustify) #ifdef ENABLE_MULTIBUFFER add_to_funcs((void *) new_buffer_msg, MEXTCMD, - new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW); + new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif #endif @@ -994,22 +992,20 @@ void shortcut_init(bool unjustify) add_to_funcs((void *) first_file_msg, (MBROWSER|MWHEREISFILE), - first_file_msg, nano_firstfile_msg, FALSE, VIEW); + first_file_msg, IFSCHELP(nano_firstfile_msg), FALSE, VIEW); add_to_funcs((void *) last_file_msg, (MBROWSER|MWHEREISFILE), - last_file_msg, nano_lastfile_msg, FALSE, VIEW); + last_file_msg, IFSCHELP(nano_lastfile_msg), FALSE, VIEW); add_to_funcs((void *) goto_dir_msg, MBROWSER, - goto_dir_msg, nano_gotodir_msg, FALSE, VIEW); + goto_dir_msg, IFSCHELP(nano_gotodir_msg), FALSE, VIEW); #endif currmenu = MMAIN; -#ifndef NANO_TINY add_to_sclist(MALL, "^G", do_help_void, 0, TRUE); add_to_sclist(MALL, "F1", do_help_void, 0, TRUE); -#endif add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", do_exit, 0, TRUE); add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", do_exit, 0, TRUE); add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0, TRUE); diff --git a/src/help.c b/src/help.c index adcaab0c..f1f03979 100644 --- a/src/help.c +++ b/src/help.c @@ -201,12 +201,6 @@ void do_help(void (*refresh_func)(void)) help_text = NULL; } -/* Start the help browser for the edit window. */ -void do_help_void(void) -{ - do_help(&edit_refresh); -} - #ifndef DISABLE_BROWSER /* Start the help browser for the file browser. */ void do_browser_help(void) @@ -552,3 +546,18 @@ size_t help_line_len(const char *ptr) } #endif /* !DISABLE_HELP */ + +/* Start the help browser for the edit window. */ +void do_help_void(void) +{ + +#ifndef DISABLE_HELP + /* Start the help browser for the edit window. */ + do_help(&edit_refresh); +#else + if (currmenu == MMAIN) + nano_disabled_msg(); + else + beep(); +#endif +} diff --git a/src/proto.h b/src/proto.h index a2c89309..731e8cf0 100644 --- a/src/proto.h +++ b/src/proto.h @@ -343,12 +343,12 @@ void thanks_for_all_the_fish(void); #endif /* All functions in help.c. */ -#ifndef DISABLE_HELP -void do_help(void (*refresh_func)(void)); -void do_help_void(void); #ifndef DISABLE_BROWSER void do_browser_help(void); #endif +void do_help_void(void); +#ifndef DISABLE_HELP +void do_help(void (*refresh_func)(void)); void help_init(void); void parse_help_input(int *kbinput, bool *meta_key, bool *func_key); size_t help_line_len(const char *ptr); diff --git a/src/winio.c b/src/winio.c index cd699c45..9660f791 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1697,7 +1697,12 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) for (; j > 0; j--) { if (f->next != NULL) f = f->next; - while (f->next != NULL && ((f->menus & currmenu) == 0 || strlen(f->help) == 0)) + + while (f->next != NULL && ((f->menus & currmenu) == 0 +#ifndef DISABLE_HELP + || strlen(f->help) == 0 +#endif + )) f = f->next; }