void BufferView::scrollDocView(int value)
{
int const offset = value - d->scrollbarParameters_.position;
+
+ // No scrolling at all? No need to redraw anything
+ if (offset == 0)
+ return;
+
// If the offset is less than 2 screen height, prefer to scroll instead.
if (abs(offset) <= 2 * height_) {
- scroll(offset);
+ d->anchor_ypos_ -= offset;
updateMetrics();
buffer_.changed();
return;
Cursor cur(*this);
cur.reset(buffer_.inset());
tm.setCursorFromCoordinates(cur, 0, newy);
+
+ // update the bufferview cursor and notify insets
+ // FIXME: Care about the d->cursor_ flags to redraw if needed
+ Cursor old = d->cursor_;
mouseSetCursor(cur);
+ bool badcursor = notifyCursorLeavesOrEnters(old, d->cursor_);
+ if (badcursor)
+ d->cursor_.fixIfBroken();
}
case LFUN_NOTE_NEXT:
case LFUN_REFERENCE_NEXT:
case LFUN_WORD_FIND:
+ case LFUN_WORD_FINDADV:
case LFUN_WORD_REPLACE:
case LFUN_MARK_OFF:
case LFUN_MARK_ON:
flag.setEnabled(true);
break;
+ // @todo Test if current WorkArea is the search WorkArea
+ case LFUN_REGEXP_MODE:
+ flag.setEnabled(! this->cursor().inRegexped());
+ break;
+
case LFUN_NEXT_INSET_TOGGLE:
case LFUN_NEXT_INSET_MODIFY: {
// this is the real function we want to invoke
break;
}
+ case LFUN_WORD_FINDADV:
+ findAdv(this, cmd);
+ break;
+
case LFUN_MARK_OFF:
cur.clearSelection();
cur.resetAnchor();
// Notify left insets
if (cur != old) {
old.fixIfBroken();
- bool badcursor = notifyCursorLeaves(old, cur);
+ bool badcursor = notifyCursorLeavesOrEnters(old, cur);
if (badcursor)
cursor().fixIfBroken();
}
d->cursor_ = cur;
- updateLabels(buffer_);
+ buffer_.updateLabels();
updateMetrics();
buffer_.changed();
cap::saveSelection(cursor());
// Has the cursor just left the inset?
- bool badcursor = false;
bool leftinset = (&d->cursor_.inset() != &cur.inset());
- if (leftinset) {
+ if (leftinset)
d->cursor_.fixIfBroken();
- badcursor = notifyCursorLeaves(d->cursor_, cur);
- if (badcursor)
- cur.fixIfBroken();
- }
// FIXME: shift-mouse selection doesn't work well across insets.
bool do_selection = select && &d->cursor_.anchor().inset() == &cur.inset();
// FIXME: (2) if we had a working InsetText::notifyCursorLeaves,
// the leftinset bool would not be necessary (badcursor instead).
bool update = leftinset;
- if (!do_selection && !badcursor && d->cursor_.inTexted())
+ if (!do_selection && d->cursor_.inTexted())
update |= checkDepm(cur, d->cursor_);
d->cursor_.setCursor(cur);
if (height_ == 0 || width_ == 0)
return;
LYXERR(Debug::PAINTING, "\t\t*** START DRAWING ***");
+
Text & text = buffer_.text();
TextMetrics const & tm = d->text_metrics_[&text];
int const y = tm.first().second->position();