X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fspellchecker.C;h=04a578affd791a636bf98aca837ba5c9bff223dd;hb=a69e7a45780e94f4330a91facfe35126c678e34e;hp=623668c5f456237f815ea5ddb93cc0c1ae2aca60;hpb=42a571c8c100a48cb92f4feaa8461ac8a9cb5c74;p=lyx.git diff --git a/src/spellchecker.C b/src/spellchecker.C index 623668c5f4..04a578affd 100644 --- a/src/spellchecker.C +++ b/src/spellchecker.C @@ -12,6 +12,10 @@ #include +#ifdef __GNUG__ +#pragma implementation +#endif + #include #include #include @@ -34,6 +38,10 @@ #endif #ifdef HAVE_SYS_SELECT_H +# ifdef HAVE_STRINGS_H + // is needed at least on AIX because FD_ZERO uses bzero(). +# include +# endif #include #endif @@ -50,8 +58,9 @@ #include "lyx_gui_misc.h" #include "debug.h" #include "support/lstrings.h" +#include "encoding.h" - +using std::reverse; using std::endl; // Spellchecker status @@ -327,13 +336,17 @@ void create_ispell_pipe(BufferParams const & params, string const & lang) argv[argc++] = tmp; } if (lyxrc.isp_use_input_encoding && - params.inputenc != "default") { + params.inputenc != "default") { + string enc = (params.inputenc == "auto") + ? params.language_info->encoding()->LatexName() + : params.inputenc; + string::size_type n = enc.length(); tmp = new char[3]; string("-T").copy(tmp, 2); tmp[2] = '\0'; argv[argc++] = tmp; // Input encoding - tmp = new char[params.inputenc.length() + 1]; - params.inputenc.copy(tmp, params.inputenc.length()); - tmp[params.inputenc.length()] = '\0'; + tmp = new char[n + 1]; + enc.copy(tmp, n); + tmp[n] = '\0'; argv[argc++] = tmp; } @@ -534,7 +547,8 @@ void ShowSpellChecker(BufferView * bv) if (fd_form_spell_check == 0) { fd_form_spell_check = create_form_form_spell_check(); // Make sure pressing the close box does not kill LyX. (RvdK) - fl_set_form_atclose(fd_form_spell_check->form_spell_check, IgnoreCloseBoxCB, 0); + fl_set_form_atclose(fd_form_spell_check->form_spell_check, + CancelCloseBoxCB, 0); } // Clear form @@ -662,7 +676,7 @@ bool RunSpellChecker(BufferView * bv) "Check /usr/lib/ispell or set another\n" "dictionary in the Spellchecker Options menu."), "", ""); fclose(out); - return true; + return false; } // Put ispell in terse mode to improve speed