mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Preventive fix inspired from ~
This commit is contained in:
parent
b034389e6d
commit
22edb3df96
@ -1361,18 +1361,23 @@ Inset * TextMetrics::editXY(Cursor & cur, int x, int y,
|
|||||||
if (edited == inset && cur.pos() == it->pos) {
|
if (edited == inset && cur.pos() == it->pos) {
|
||||||
// non-editable inset, set cursor after the inset if x is
|
// non-editable inset, set cursor after the inset if x is
|
||||||
// nearer to that position (bug 9628)
|
// nearer to that position (bug 9628)
|
||||||
|
// TODO: This should be replaced with an improvement of
|
||||||
|
// Cursor::moveToClosestEdge that handles rtl text. (Which could not
|
||||||
|
// be tested because of #10569.)
|
||||||
CoordCache::Insets const & insetCache = bv_->coordCache().getInsets();
|
CoordCache::Insets const & insetCache = bv_->coordCache().getInsets();
|
||||||
Dimension const & dim = insetCache.dim(inset);
|
if (insetCache.has(inset)) {
|
||||||
Point p = insetCache.xy(inset);
|
Dimension const & dim = insetCache.dim(inset);
|
||||||
bool const is_rtl = text_->isRTL(text_->getPar(pit));
|
Point p = insetCache.xy(inset);
|
||||||
if (is_rtl) {
|
bool const is_rtl = text_->isRTL(text_->getPar(pit));
|
||||||
// "in front of" == "right of"
|
if (is_rtl) {
|
||||||
if (abs(p.x_ - x) < abs(p.x_ + dim.wid - x))
|
// "in front of" == "right of"
|
||||||
cur.posForward();
|
if (abs(p.x_ - x) < abs(p.x_ + dim.wid - x))
|
||||||
} else {
|
cur.posForward();
|
||||||
// "in front of" == "left of"
|
} else {
|
||||||
if (abs(p.x_ + dim.wid - x) < abs(p.x_ - x))
|
// "in front of" == "left of"
|
||||||
cur.posForward();
|
if (abs(p.x_ + dim.wid - x) < abs(p.x_ - x))
|
||||||
|
cur.posForward();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user