mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 19:59:46 +00:00
Fix a crash when spellchecking when a Math inset is the last inset in the document. Make sure that the words between a math inset and the next inset are spellchecked. Also fix the count of the number of words when there are math insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32489 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8515bea89a
commit
8c8675e2ca
@ -3735,16 +3735,27 @@ int Buffer::spellCheck(DocIterator & from, DocIterator & to,
|
|||||||
DocIterator const end = doc_iterator_end(this);
|
DocIterator const end = doc_iterator_end(this);
|
||||||
for (; from != end; from.forwardPos()) {
|
for (; from != end; from.forwardPos()) {
|
||||||
// We are only interested in text so remove the math CursorSlice.
|
// We are only interested in text so remove the math CursorSlice.
|
||||||
while (from.inMathed())
|
while (from.inMathed()) {
|
||||||
from.forwardInset();
|
from.pop_back();
|
||||||
|
from.pos()++;
|
||||||
|
}
|
||||||
|
// If from is at the end of the document (which is possible
|
||||||
|
// when leaving the mathed) LyX will crash later.
|
||||||
|
if (from == end)
|
||||||
|
break;
|
||||||
to = from;
|
to = from;
|
||||||
if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
|
if (from.paragraph().spellCheck(from.pos(), to.pos(), wl, suggestions)) {
|
||||||
word_lang = wl;
|
word_lang = wl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not increase progress when from == to, otherwise the word
|
||||||
|
// count will be wrong.
|
||||||
|
if (from != to) {
|
||||||
from = to;
|
from = to;
|
||||||
++progress;
|
++progress;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user