From 3716601573f5a562f98721130e25002ad88eb164 Mon Sep 17 00:00:00 2001 From: Fabrice Di Meglio Date: Wed, 31 Aug 2011 13:56:37 -0700 Subject: [PATCH] Fix bug #5243493 TextView selection is not working correctly when there is some RTL run into it - make the selection green highlight work Change-Id: I4e3b88e3720288f973b1b9e68afa8f800ad13779 --- core/java/android/text/Layout.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index 421e9959bd55d..768071f5dc295 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -1296,7 +1296,10 @@ public abstract class Layout { float h1 = getHorizontal(st, false, line); float h2 = getHorizontal(en, true, line); - dest.addRect(h1, top, h2, bottom, Path.Direction.CW); + float left = Math.min(h1, h2); + float right = Math.max(h1, h2); + + dest.addRect(left, top, right, bottom, Path.Direction.CW); } } }