void LyXText::cursorBottom()
{
- ParagraphList::iterator lastpit =
- boost::prior(paragraphs().end());
+ ParagraphList::iterator lastpit = boost::prior(paragraphs().end());
setCursor(lastpit, lastpit->size());
}
else if (cur.selBegin().par() != cur.selEnd().par())
bv()->owner()->message(_("Cannot index more than one paragraph!"));
else
- idxstring = selectionAsString(*bv()->buffer(), false);
+ idxstring = cur.selectionAsString(false);
// Reset cursors to their original position.
cursor() = reset_cursor;
// finished. The solution used currently just works, to make it
// faster we need to be more clever and probably also have more
// calls to stuffClipboard. (Lgb)
- bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true));
+ bv()->stuffClipboard(cur.selectionAsString(true));
// This doesn't make sense, if there is no selection
if (!cur.selection())
{
LCursor & cur = bv()->cursor();
// stuff the selection onto the X clipboard, from an explicit copy request
- bv()->stuffClipboard(selectionAsString(*bv()->buffer(), true));
+ bv()->stuffClipboard(cur.selectionAsString(true));
// this doesnt make sense, if there is no selection
if (!cur.selection())
}
}
-
+// x is an absolute screen coord
// returns the column near the specified x-coordinate of the row
// x is set to the real beginning of this column
pos_type LyXText::getColumnNearX(ParagraphList::iterator pit,
ParagraphList::iterator pit;
Row const & row = *getRowNearY(y, pit);
bool bound = false;
- pos_type const pos = row.pos() + getColumnNearX(pit, row, x, bound);
+ int xx = x + xo_; // getRowNearX get absolute x coords
+ pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
cur.par() = parOffset(pit);
cur.pos() = pos;
cur.boundary() = bound;
// x,y are absolute screen coordinates
void LyXText::edit(LCursor & cur, int x, int y)
{
- int xx = x; // is modified by getColumnNearX
ParagraphList::iterator pit;
- Row const & row = *getRowNearY(y, pit);
+ Row const & row = *getRowNearY(y - yo_, pit);
bool bound = false;
+
+ int xx = x; // is modified by getColumnNearX
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
cur.par() = parOffset(pit);
cur.pos() = pos;
// try to descend into nested insets
InsetBase * inset = checkInsetHit(x, y);
if (inset) {
- // This should be just before or just behind the cursor position
- // set above.
+ // This should be just before or just behind the
+ // cursor position set above.
BOOST_ASSERT((pos != 0 && inset == pit->getInset(pos - 1))
|| inset == pit->getInset(pos));
- // Make sure the cursor points to the position before this inset.
+ // Make sure the cursor points to the position before
+ // this inset.
if (inset == pit->getInset(pos - 1))
--cur.pos();
inset->edit(cur, x, y);