mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
Avoid crash when extending word selection
This happens when the cursor goes into a deeper inset, since selectWord() was called on the wrong Text object. Additionally, fix the new word selection when cursor goes before existing selection. Fixes bug #12529.
This commit is contained in:
parent
9f30de3c5d
commit
809a063358
@ -1874,8 +1874,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
bvcur.resetAnchor();
|
bvcur.resetAnchor();
|
||||||
if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
|
if (!bv->mouseSetCursor(cur, cmd.modifier() == ShiftModifier))
|
||||||
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
|
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
|
||||||
if (bvcur.wordSelection())
|
// FIXME: move this to mouseSetCursor?
|
||||||
selectWord(bvcur, WHOLE_WORD);
|
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();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mouse_button::button2:
|
case mouse_button::button2:
|
||||||
|
Loading…
Reference in New Issue
Block a user