From 64a8c4b35c8bd4396ee9a9fb232b6dbf6c6c7d7f Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 23 Sep 2007 16:30:13 +0000 Subject: [PATCH] Proper fix following reversion of r20422 in r20444. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20451 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/bufferview_funcs.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bufferview_funcs.cpp b/src/bufferview_funcs.cpp index cb29851bbb..77b1a8e341 100644 --- a/src/bufferview_funcs.cpp +++ b/src/bufferview_funcs.cpp @@ -157,8 +157,8 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit, int y = 0; int lastw = 0; - // Addup ontribution of nested insets, from inside to outside, - // keeping the outer paragraph for a special handling below + // Addup contribution of nested insets, from inside to outside, + // keeping the outer paragraph for a special handling below for (size_t i = dit.depth() - 1; i >= 1; --i) { CursorSlice const & sl = dit[i]; int xx = 0; @@ -179,9 +179,22 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit, if (rtl) x -= lastw; } + // remember width for the case that sl.inset() is positioned in an RTL inset - Dimension const dim = sl.inset().dimension(bv); - lastw = dim.wid; + if (i && dit[i - 1].text()) { + // If this Inset is inside a Text Inset, retrieve the Dimension + // from the containing text instead of using Inset::dimension() which + // might not be implemented. + // FIXME (Abdel 23/09/2007): this is a bit messy because of the + // elimination of Inset::dim_ cache. This coordOffset() method needs + // to be rewritten in light of the new design. + Dimension const & dim = bv.parMetrics(dit[i - 1].text(), + dit[i - 1].pit()).insetDimension(&sl.inset()); + lastw = dim.wid; + } else { + Dimension const dim = sl.inset().dimension(bv); + lastw = dim.wid; + } //lyxerr << "Cursor::getPos, i: " // << i << " x: " << xx << " y: " << y << endl; -- 2.39.2