From 08feb0e14cd9733d1d921344f1dc67e04a2bebb0 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 20 Nov 2009 22:28:51 +0000 Subject: [PATCH] Fix bug #6161: Wrong cursor position in bidi text. If the first character is a separator, we are in RTL text. This character will not be painted on screen and thus we should not count it and skip to the next. This bug pretty much destroyed cursor placement in RTL text on a row with large gaps. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32116 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextMetrics.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 2c74a8c8b6..fe7a928e14 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -1234,6 +1234,12 @@ pos_type TextMetrics::getColumnNearX(pit_type const pit, return 0; } + // if the first character is a separator, we are in RTL + // text. This character will not be painted on screen + // and thus we should not count it and skip to the next. + if (par.isSeparator(bidi.vis2log(vc))) + ++vc; + while (vc < end && tmpx <= x) { c = bidi.vis2log(vc); last_tmpx = tmpx;