Angus Leeming wrote: > This bug report > http://bugzilla.lyx.org/show_bug.cgi?id=1876 > > says that LyX 1.4.x will not spell check the very first word of the > document if the cursor is placed at the beginning of that paragraph (just > before the first letter at position 0). > > The offending code, together with the proposed patch is:
I'd suggest (untested) > > DocIterator cur = kernel().bufferview()->cursor(); > ptrdiff_t start = 0, total = 0; > DocIterator it = DocIterator(kernel().buffer().inset()); > > for (start = 0; it != cur; it.forwardPos()) > ++start; > > for (total = start; it; it.forwardPos()) > ++total; > > - for (; cur && isLetter(cur); cur.forwardPos()) > + for (; cur && cur.pos() && isLetter(cur); cur.forwardPos()) > ++start; > > Unfortunately, I understand neither the code nor the fix. (I understand > that it is incrementing the start and total flags but little more.) Can > someone explain? At the end of this chunk, 'total' should count the total size of the document in chars, 'start' should point at the begin of the next word to spellcheck. The last for loop is there to skip a partial word (if the cursor is in the middle of it). > Angus (tired) Me too ;-) Alfredo