mirror of https://github.com/odrling/Aegisub
Close the spell checker after all lines have been checked rather than only once there are no errors remaining. Closes #1442.
Originally committed to SVN as r6410.
This commit is contained in:
parent
3af57cdbcd
commit
04cc422391
|
@ -56,6 +56,9 @@ DialogSpellChecker::DialogSpellChecker(agi::Context *context)
|
|||
: wxDialog(context->parent, -1, _("Spell Checker"))
|
||||
, context(context)
|
||||
, spellchecker(SpellCheckerFactory::GetSpellChecker())
|
||||
, start_line(0)
|
||||
, active_line(0)
|
||||
, has_looped(false)
|
||||
{
|
||||
SetIcon(BitmapToIcon(GETIMAGE(spellcheck_toolbutton_24)));
|
||||
|
||||
|
@ -203,16 +206,21 @@ void DialogSpellChecker::OnClose(wxCommandEvent&) {
|
|||
}
|
||||
|
||||
bool DialogSpellChecker::FindNext() {
|
||||
AssDialogue *active_line = context->selectionController->GetActiveLine();
|
||||
AssDialogue *real_active_line = context->selectionController->GetActiveLine();
|
||||
// User has changed the active line; restart search from this position
|
||||
if (real_active_line != active_line) {
|
||||
active_line = real_active_line;
|
||||
has_looped = false;
|
||||
start_line = active_line;
|
||||
}
|
||||
|
||||
int start_pos = context->editBox->GetReverseUnicodePosition(context->editBox->GetCurrentPos());
|
||||
int commit_id = -1;
|
||||
|
||||
if (CheckLine(active_line, start_pos, &commit_id))
|
||||
return true;
|
||||
|
||||
AssDialogue *start_line = active_line;
|
||||
std::list<AssEntry*>::iterator it = find(context->ass->Line.begin(), context->ass->Line.end(), active_line);
|
||||
bool has_looped = false;
|
||||
|
||||
// Note that it is deliberate that the start line is checked twice, as if
|
||||
// the cursor is past the first misspelled word in the current line, that
|
||||
|
@ -298,4 +306,3 @@ void DialogSpellChecker::SetWord(wxString const& word) {
|
|||
|
||||
add_button->Enable(spellchecker->CanAddWord(word));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,16 +58,20 @@ class DialogSpellChecker : public wxDialog {
|
|||
wxArrayString dictionary_lang_codes;
|
||||
|
||||
int word_start; ///< Start index of the current misspelled word
|
||||
int word_end; ///< End index of the current misspelled word
|
||||
int word_end; ///< End index of the current misspelled word
|
||||
|
||||
wxTextCtrl *orig_word; ///< The word being corrected
|
||||
wxTextCtrl *orig_word; ///< The word being corrected
|
||||
wxTextCtrl *replace_word; ///< The replacement that will be used if "Replace" is clicked
|
||||
wxListBox *suggest_list; ///< The list of suggested replacements
|
||||
wxListBox *suggest_list; ///< The list of suggested replacements
|
||||
|
||||
wxComboBox *language; ///< The list of available languages
|
||||
wxButton *add_button; ///< Add word to currently active dictionary
|
||||
wxComboBox *language; ///< The list of available languages
|
||||
wxButton *add_button; ///< Add word to currently active dictionary
|
||||
wxCheckBox *skip_comments; ///< Skip over commented lines
|
||||
|
||||
AssDialogue *start_line; ///< The first line checked
|
||||
AssDialogue *active_line; ///< The most recently checked line
|
||||
bool has_looped; ///< Has the search already looped from the end to beginning?
|
||||
|
||||
/// Find the next misspelled word and close the dialog if there are none
|
||||
/// @return Are there any more misspelled words?
|
||||
bool FindNext();
|
||||
|
|
Loading…
Reference in New Issue