mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-20 15:01:58 +00:00
Move the inline spellchecking code from collectWords() to the row drawing routine. The text row is spell checked only if changed!
Now inline SpellChecker is faster than ever. Now, I honestly think that we blow out all the competitors (thunderbird, OO, MSWord, etc) :-) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30970 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b3d7fce1b2
commit
0cc197d3c1
@ -3015,8 +3015,6 @@ void Paragraph::locateWord(pos_type & from, pos_type & to,
|
||||
void Paragraph::collectWords()
|
||||
{
|
||||
pos_type n = size();
|
||||
WordLangTuple wl;
|
||||
docstring_list suggestions;
|
||||
for (pos_type pos = 0; pos < n; ++pos) {
|
||||
if (isWordSeparator(pos))
|
||||
continue;
|
||||
@ -3026,11 +3024,6 @@ void Paragraph::collectWords()
|
||||
docstring word = asString(from, pos, AS_STR_NONE);
|
||||
d->words_.insert(word);
|
||||
}
|
||||
if (lyxrc.spellcheck_continuously
|
||||
&& spellCheck(from, pos, wl, suggestions)) {
|
||||
for (size_t i = 0; i != suggestions.size(); ++i)
|
||||
d->words_.insert(suggestions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "Text.h"
|
||||
#include "TextClass.h"
|
||||
#include "VSpace.h"
|
||||
#include "WordLangTuple.h"
|
||||
|
||||
#include "insets/InsetText.h"
|
||||
|
||||
@ -50,9 +51,11 @@
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
#include <cstdlib>
|
||||
#include "support/docstring_list.h"
|
||||
#include "support/lassert.h"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -2093,6 +2096,16 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
|
||||
row.setCrc(pm.computeRowSignature(row, bparams));
|
||||
bool row_has_changed = row.changed();
|
||||
|
||||
// Take this opportunity to spellcheck the row contents.
|
||||
if (row_has_changed && lyxrc.spellcheck_continuously) {
|
||||
WordLangTuple wl;
|
||||
// dummy variable, not used.
|
||||
static docstring_list suggestions;
|
||||
pos_type from = row.pos();
|
||||
pos_type to = row.endpos();
|
||||
text_->getPar(pit).spellCheck(from, to, wl, suggestions, false);
|
||||
}
|
||||
|
||||
// Don't paint the row if a full repaint has not been requested
|
||||
// and if it has not changed.
|
||||
if (!pi.full_repaint && !row_has_changed) {
|
||||
|
Loading…
Reference in New Issue
Block a user