From: Abdelrazak Younes Date: Wed, 12 Sep 2007 08:15:56 +0000 (+0000) Subject: Fix PageDown/Up temporarily. X-Git-Tag: 1.6.10~8378 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=8319910995fdfaa1cd401d2a82cfbd79accd4bf5;p=features.git Fix PageDown/Up temporarily. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20237 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 9ea8674456..f00bb10279 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1535,7 +1535,7 @@ void TextMetrics::cursorNext(Cursor & cur) int x = cur.x_target(); setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1); - cur.dispatch(FuncRequest(cur.selection()? LFUN_DOWN_SELECT: LFUN_DOWN)); + text_->dispatch(cur, FuncRequest(cur.selection()? LFUN_DOWN_SELECT: LFUN_DOWN)); if (cpar == cur.pit() && cpos == cur.pos()) // we have a row which is taller than the workarea. The diff --git a/src/bufferview_funcs.cpp b/src/bufferview_funcs.cpp index 6c218eb53e..e8c3eff286 100644 --- a/src/bufferview_funcs.cpp +++ b/src/bufferview_funcs.cpp @@ -245,13 +245,23 @@ Point getPos(BufferView const & bv, DocIterator const & dit, bool boundary) // FIXME: This does not work within mathed! CurStatus status(BufferView const * bv, DocIterator const & dit) { + // FIXME: it's be better to have something like TextMetrics::status(). TextMetrics const & tm = bv->textMetrics(dit.bottom().text()); - if (tm.has(dit.bottom().pit())) - return CUR_INSIDE; - else if (dit.bottom().pit() < bv->anchor_ref()) + pit_type const pit = dit.bottom().pit(); + if (!tm.has(pit)) { + if (dit.bottom().pit() < bv->anchor_ref()) + return CUR_ABOVE; + else + return CUR_BELOW; + } + + ParagraphMetrics const & pm = tm.parMetrics(pit); + if (pm.position() < 0) return CUR_ABOVE; - else + else if (pm.position() > bv->workHeight()) return CUR_BELOW; + + return CUR_INSIDE; } namespace {