From fab42d011c479313ae014c3f32317c204bac9dea Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Tue, 9 Sep 2008 14:12:08 +0000 Subject: [PATCH] fix sideways scrolling in tabulars with nested insets git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26347 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 61a9a68a73..ac51e1c023 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4002,14 +4002,16 @@ void InsetTabular::resetPos(Cursor & cur) const BufferView & bv = cur.bv(); int const maxwidth = bv.workWidth(); - if (&cur.inset() != this) { + int const scx_old = scx_; + int const i = cur.find(this); + if (i == -1) { scx_ = 0; } else { int const X1 = 0; int const X2 = maxwidth; int const offset = ADD_TO_TABULAR_WIDTH + 2; - int const x1 = xo(cur.bv()) + cellXPos(cur.idx()) + offset; - int const x2 = x1 + tabular.columnWidth(cur.idx()); + int const x1 = xo(cur.bv()) + cellXPos(cur[i].idx()) + offset; + int const x2 = x1 + tabular.columnWidth(cur[i].idx()); if (x1 < X1) scx_ = X1 + 20 - x1; @@ -4019,7 +4021,9 @@ void InsetTabular::resetPos(Cursor & cur) const scx_ = 0; } - cur.updateFlags(Update::Force | Update::FitCursor); + // only update if offset changed + if (scx_ != scx_old) + cur.updateFlags(Update::Force | Update::FitCursor); } @@ -4103,8 +4107,7 @@ void InsetTabular::movePrevCell(Cursor & cur, EntryDirection entry_from) } - // FIXME: this accesses the position cache before it is initialized - //resetPos(cur); + resetPos(cur); } -- 2.39.2