string const argument = to_utf8(cmd.argument());
Cursor & cur = d->cursor_;
+ Cursor old = cur;
// Don't dispatch function that does not apply to internal buffers.
if (buffer_.isInternal()
p = Point(0, 0);
if (act == LFUN_SCREEN_DOWN && scrolled < height_)
p = Point(width_, height_);
- Cursor old = cur;
bool const in_texted = cur.inTexted();
cur.setCursor(doc_iterator_begin(cur.buffer()));
- if (cur != old)
- notifyCursorLeavesOrEnters(old, cur);
cur.selHandle(false);
buffer_.changed(true);
updateHoveredInset();
buffer_.undo().endUndoGroup();
dr.dispatched(dispatched);
+
+ // NOTE: The code below is copied from Cursor::dispatch. If you
+ // need to modify this, please update the other one too.
+
+ // notify insets we just entered/left
+ if (cursor() != old) {
+ old.beginUndoGroup();
+ old.fixIfBroken();
+ bool badcursor = notifyCursorLeavesOrEnters(old, cursor());
+ if (badcursor) {
+ cursor().fixIfBroken();
+ resetInlineCompletionPos();
+ }
+ old.endUndoGroup();
+ }
}
}
endUndoGroup();
+ // NOTE: The code below has been copied to BufferView::dispatch.
+ // If you need to modify this, please update the other one too.
+
// notify insets we just left
if (*this != old) {
old.beginUndoGroup();