From 68237d3c48005e16ebdaac06dc06ea88273b3cf4 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Fri, 11 Mar 2005 14:20:58 +0000 Subject: [PATCH] Fixed and extended bug 1792 fix git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9711 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/text2.C | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7ada4a7a01..c435488d02 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-03-11 Martin Vermeer + + * text2.C: fixed the fix, extended to other case. + 2005-03-08 Martin Vermeer * text2.C: fix for cursor up/down stuck in math [bug 1792] diff --git a/src/text2.C b/src/text2.C index 917808ec83..053c292199 100644 --- a/src/text2.C +++ b/src/text2.C @@ -803,6 +803,12 @@ pos_type LyXText::getColumnNearX(pit_type const pit, } } + // The following code is necessary because the cursor position past + // the last char in a row is logically equivalent to that before + // the first char in the next row. That's why insets causing row + // divisions -- Newline and display-style insets -- must be treated + // specially, so cursor up/down doesn't get stuck in an air gap -- MV + // Newline inset, air gap below: if (row.pos() < end && c >= end && par.isNewline(end - 1)) { if (bidi.level(end -1) % 2 == 0) tmpx -= singleWidth(par, end - 1); @@ -810,11 +816,16 @@ pos_type LyXText::getColumnNearX(pit_type const pit, tmpx += singleWidth(par, end - 1); c = end - 1; } - - if (row.pos() < end && c >= end + // Air gap above display inset: + if (row.pos() < end && c >= end && end < par.size() && par.isInset(end) && par.getInset(end)->display()) { c = end - 1; } + // Air gap below display inset: + if (row.pos() < end && c >= end && par.isInset(end - 1) + && par.getInset(end - 1)->display()) { + c = end - 1; + } x = int(tmpx) + xo; return c - row.pos();