bool badcursor = notifyCursorLeavesOrEnters(old, *this);
if (badcursor) {
fixIfBroken();
- bv().fixInlineCompletionPos();
+ bv().resetInlineCompletionPos();
}
old.endUndoGroup();
}
void Cursor::resetAnchor()
{
anchor_ = *this;
+ checkNewWordPosition();
}
}
+void Cursor::markEditPosition()
+{
+ if (inTexted() && new_word_.empty()) {
+ FontSpan ow = locateWord(WHOLE_WORD);
+ if (ow.size() == 1) {
+ LYXERR(Debug::DEBUG, "start new word: "
+ << " par: " << pit()
+ << " pos: " << ow.first);
+ new_word_ = *this;
+ }
+ }
+}
+
+
+void Cursor::clearNewWordPosition()
+{
+ if (!new_word_.empty()) {
+ LYXERR(Debug::DEBUG, "clear new word: "
+ << " par: " << pit()
+ << " pos: " << pos());
+ new_word_.resize(0);
+ }
+}
+
+
+void Cursor::checkNewWordPosition()
+{
+ if (new_word_.empty())
+ return ;
+ if (!inTexted())
+ clearNewWordPosition();
+ else {
+ if (pit() != new_word_.pit())
+ clearNewWordPosition();
+ else {
+ FontSpan nw = locateWord(WHOLE_WORD);
+ 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();
+ }
+ }
+ }
+}
+
+
bool Cursor::posBackward()
{
if (pos() == 0)