Private(BufferView & bv): wh_(0), cursor_(bv),
anchor_pit_(0), anchor_ypos_(0),
inlineCompletionUniqueChars_(0),
- last_inset_(0), gui_(0)
+ last_inset_(0), bookmark_edit_position_(0), gui_(0)
{}
///
*/
Inset * last_inset_;
+ // cache for id of the paragraph which was edited the last time
+ int bookmark_edit_position_;
+
mutable TextMetricsCache text_metrics_;
/// Whom to notify.
}
+void BufferView::bookmarkEditPosition()
+{
+ // Don't eat cpu time for each keystroke
+ if (d->cursor_.paragraph().id() == d->bookmark_edit_position_)
+ return;
+ saveBookmark(0);
+ d->bookmark_edit_position_ = d->cursor_.paragraph().id();
+}
+
+
void BufferView::saveBookmark(unsigned int idx)
{
- // tenatively save bookmark, id and pos will be used to
+ // tentatively save bookmark, id and pos will be used to
// acturately locate a bookmark in a 'live' lyx session.
// pit and pos will be updated with bottom level pit/pos
// when lyx exits.
if (ypos - row_dim.ascent() < 0)
scrolled = scrollUp(- ypos + row_dim.ascent());
else if (ypos + row_dim.descent() > height_)
- scrolled = scrollDown(ypos - height_ + row_dim.descent());
+ scrolled = scrollDown(ypos - height_ + defaultRowHeight() );
+
// else, nothing to do, the cursor is already visible so we just return.
if (scrolled != 0) {
updateMetrics();
d->anchor_ypos_ = offset + pm.ascent();
else if (d->anchor_pit_ == max_pit)
d->anchor_ypos_ = height_ - offset - row_dim.descent();
+ else if (offset > height_)
+ d->anchor_ypos_ = height_ - offset - defaultRowHeight();
else
- d->anchor_ypos_ = defaultRowHeight() * 2 - offset - row_dim.descent();
+ d->anchor_ypos_ = defaultRowHeight() * 2;
updateMetrics();
buffer_.changed();
case WRAP_CODE:
case NOTE_CODE:
case BRANCH_CODE:
+ case PHANTOM_CODE:
case BOX_CODE:
case LISTINGS_CODE:
enable = (cmd.argument().empty() ||
return true;
if (a.empty() || b.empty())
return false;
+ if (a.depth() != b.depth())
+ return false;
return &a.innerParagraph() == &b.innerParagraph();
}