Fix for "Can't place cursor after combining accent"

This patch fixes behavior where attempting to place the cursor at
the end of a string where the last character is a combining accent
actually placed it before that accent. This was especially annoying
for editing Thai text, because it made it difficult to delete a
trailing tone mark.

Fixes bug 8947569 "Can't place cursor after combining accent" and bug
10398332 "[Thailand] Thai Language(IME) -- Can't delete Thai tone mark
while writing message"

Change-Id: Ida1933c8f0ab6cdb0200db39891e9389e4bdba86
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index a6e8c70..9dfd383 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1115,7 +1115,7 @@
 
         float dist = Math.abs(getPrimaryHorizontal(max) - horiz);
 
-        if (dist < bestdist) {
+        if (dist <= bestdist) {
             bestdist = dist;
             best = max;
         }