detect end of paragraph and use it as word separator to correct the word count in tables - thanks, JMarc

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36659 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stephan Witt 2010-12-02 16:50:12 +00:00
parent 1ed5b98873
commit 7f9d85e285

View File

@ -184,6 +184,7 @@ int countWords(DocIterator const & from, DocIterator const & to)
{ {
int count = 0; int count = 0;
bool inword = false; bool inword = false;
for (DocIterator dit = from ; dit != to ; ) { for (DocIterator dit = from ; dit != to ; ) {
if (!dit.inTexted()) { if (!dit.inTexted()) {
dit.forwardPos(); dit.forwardPos();
@ -192,9 +193,11 @@ int countWords(DocIterator const & from, DocIterator const & to)
Paragraph const & par = dit.paragraph(); Paragraph const & par = dit.paragraph();
pos_type const pos = dit.pos(); pos_type const pos = dit.pos();
// Copied and adapted from isWordSeparator() in Paragraph // Copied and adapted from isWordSeparator() in Paragraph
if (pos != dit.lastpos() && !par.isDeleted(pos)) { if (pos == dit.lastpos()) {
inword = false;
} else if (!par.isDeleted(pos)) {
Inset const * ins = par.getInset(pos); Inset const * ins = par.getInset(pos);
if (ins && !ins->producesOutput()) { if (ins && !ins->producesOutput()) {
//skip this inset //skip this inset