mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
parent
5f8959d40e
commit
2b493ff70f
14
src/Text.cpp
14
src/Text.cpp
@ -1369,6 +1369,20 @@ void Text::selectWord(Cursor & cur, word_location loc)
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
|
@ -171,6 +171,8 @@ public:
|
||||
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);
|
||||
|
||||
|
@ -1875,17 +1875,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
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:
|
||||
@ -1953,6 +1944,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// 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) {
|
||||
|
@ -5043,7 +5043,9 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (bvcur.selIsMultiCell()) {
|
||||
bvcur.pit() = bvcur.lastpit();
|
||||
bvcur.pos() = bvcur.lastpos();
|
||||
}
|
||||
} else
|
||||
// Let InsetTableCell do it
|
||||
cell(cur.idx())->dispatch(cur, cmd);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user