Partial fix for bug #9160.
}
+void Text::expandWordSel(Cursor & cur)
+{
+ // get selection of word around cur
+ Cursor c = cur;
+ c.selection(false);
+ c.text()->selectWord(c, WHOLE_WORD);
+ // use the correct word boundary, depending on selection direction
+ if (cur.top() > cur.normalAnchor())
+ cur.pos() = c.selEnd().pos();
+ else
+ cur.pos() = c.selBegin().pos();
+}
+
+
void Text::selectAll(Cursor & cur)
{
LBUFERR(this == cur.text());
void getWord(CursorSlice & from, CursorSlice & to, word_location const) const;
/// just selects the word the cursor is in
void selectWord(Cursor & cur, word_location loc);
+ /// expands the selection to the word the cursor is in
+ void expandWordSel(Cursor & cur);
/// select all text
void selectAll(Cursor & cur);
if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
// FIXME: move this to mouseSetCursor?
- if (bvcur.wordSelection() && bvcur.inTexted()) {
- // select word around new position
- Cursor c = bvcur;
- c.selection(false);
- c.text()->selectWord(c, WHOLE_WORD);
- // use the correct word boundary, depending on selection direction
- if (bvcur.top() > bvcur.normalAnchor())
- bvcur.pos() = c.selEnd().pos();
- else
- bvcur.pos() = c.selBegin().pos();
- }
+ if (bvcur.wordSelection() && bvcur.inTexted())
+ expandWordSel(bvcur);
break;
case mouse_button::button2:
// We continue with our existing selection or start a new one, so don't
// reset the anchor.
bvcur.setCursor(cur);
+ if (bvcur.wordSelection() && bvcur.inTexted())
+ expandWordSel(bvcur);
bvcur.selection(true);
bvcur.setCurrentFont();
if (cur.top() == old) {
if (bvcur.selIsMultiCell()) {
bvcur.pit() = bvcur.lastpit();
bvcur.pos() = bvcur.lastpos();
- }
+ } else
+ // Let InsetTableCell do it
+ cell(cur.idx())->dispatch(cur, cmd);
}
break;