bool badcursor = notifyCursorLeavesOrEnters(old, *this);
if (badcursor) {
fixIfBroken();
- bv().fixInlineCompletionPos();
+ bv().resetInlineCompletionPos();
}
old.endUndoGroup();
}
void Cursor::markEditPosition()
{
- if (inTexted() && new_word_.empty()) {
+ if (lyxrc.spellcheck_continuously && inTexted() && new_word_.empty()) {
FontSpan ow = locateWord(WHOLE_WORD);
if (ow.size() == 1) {
LYXERR(Debug::DEBUG, "start new word: "
void Cursor::checkNewWordPosition()
{
- if (new_word_.empty())
+ if (!lyxrc.spellcheck_continuously || new_word_.empty())
return ;
if (!inTexted())
clearNewWordPosition();
else {
- if (paragraph().id() != new_word_.paragraph().id())
+ // forget the position of the current new word if
+ // 1) the paragraph changes or
+ // 2) the count of nested insets changes or
+ // 3) the cursor pos is out of paragraph bound
+ if (pit() != new_word_.pit() ||
+ depth() != new_word_.depth() ||
+ new_word_.pos() > new_word_.lastpos()) {
+ clearNewWordPosition();
+ } else if (new_word_.fixIfBroken())
+ // 4) or the remembered position was "broken"
clearNewWordPosition();
else {
- FontSpan ow = new_word_.locateWord(WHOLE_WORD);
FontSpan nw = locateWord(WHOLE_WORD);
- if (nw.intersect(ow).empty())
+ if (nw.size()) {
+ FontSpan ow = new_word_.locateWord(WHOLE_WORD);
+ if (nw.intersect(ow).empty())
+ clearNewWordPosition();
+ else
+ LYXERR(Debug::DEBUG, "new word: "
+ << " par: " << pit()
+ << " pos: " << nw.first << ".." << nw.last);
+ } else {
clearNewWordPosition();
- else
- LYXERR(Debug::DEBUG, "new word: "
- << " par: " << pit()
- << " pos: " << nw.first << ".." << nw.last);
+ }
}
}
}
bool const broken_anchor = anchor_.fixIfBroken();
if (broken_cursor || broken_anchor) {
+ clearNewWordPosition();
clearSelection();
return true;
}